# CatGPT: AI translator

An early experiment in agentic interaction, using desktop translation to explore a conversational interface

Source: https://works.im0o.top/en/projects/catgpt/
Date: 2024-06-20
Tags: Python, Vue, pywebview, GPT / DeepL, Agentic interaction, Experimental project

## Project links

- [Source](https://github.com/jz0ojiang/ai-translator)
- [Demo video](https://www.bilibili.com/video/BV1paERzREZC/)


CatGPT was one of my early experiments in agentic interaction. I used translation as the starting point, building a chat-style desktop tool with Python and Vue: enter text, choose a language, and see the result below it.

## Translation as a conversation

The interface has separate DeepL and ChatGPT options. You can use either one or view both results together. Inputs and source-labelled translations stay in the same conversation, so you can scroll back as you continue translating.

![Two labelled translations of the same input](https://image.im0o.top/2026/20261117104102811.webp)

The source language can be detected automatically, while a menu selects the target language. I kept the input controls and message history together in one desktop window.

[Desktop demonstration](https://www.bilibili.com/video/BV1paERzREZC/)

## A web interface in a desktop window

Vue, TypeScript, and Vite provide the interface inside pywebview. Python exposes methods such as translate to the page. The frontend sends the text, languages, and selected translation options; Python returns the labelled results.

GPT requests use a configurable OpenAI-compatible endpoint. Python prepares the translation instructions, detects the source language, and handles authentication, connection, and API errors. The page can also invoke Python methods to minimize, toggle fullscreen, or close the window. A native option switches to operating-system window controls.

![A Vue page runs inside pywebview and calls Python methods for translation](https://image.im0o.top/2026/20261117104107407.webp "A Vue page runs inside pywebview and calls Python methods for translation")

## A command-line entry point

I also kept an interactive GPT-only terminal mode. It asks for the source text and target language, prints a translation, then accepts another request:

~~~bash
python app.py --nogui
~~~

A normal launch opens the GUI:

~~~bash
python app.py
~~~

The endpoint and API key come from environment variables, a .env file, or command-line arguments. Python handles translation requests for both entry points, with error messages shown in the interface or terminal.

[Source code](https://github.com/jz0ojiang/ai-translator)

