translate-tools / linguist

Translate web pages, highlighted text, Netflix subtitles, private messages, speak the translated text, and save important translations to your personal dictionary to learn words even offline
https://linguister.io
BSD 3-Clause "New" or "Revised" License
686 stars 23 forks source link

Add ChatGPT translator. #230

Open BrightXiaoHan opened 1 year ago

BrightXiaoHan commented 1 year ago

Is it possible to adapt openai api to this project?

vitonsky commented 1 year ago

As i know, ChatGPT it's a proprietary language model learned to be chat partner. So ChatGPT is not have API to translate texts.

But if you can adopt their API to translate texts, you can add translator to a Linguist.

Actually, you can add any translator implementation, see custom translators docs.

All you need - implement JS class with few methods that will handle requests to translate

vitonsky commented 1 year ago

I investigated your idea, it looks that it possible to implement.

Also, i found a browser extension https://github.com/yetone/openai-translator that implement your idea. This browser extension cannot to translate web pages, but can translate single text.

I will implement ChatGPT translator in future release. Thank you for idea

lrq3000 commented 4 months ago

I would suggest to support OpenAI API, with a custom URL, so that you would get support for both OpenAI's ChatGPT AND local LLMs with a single function (because most local LLMs implement an "OpenAI-like API" to try to be compatible with apps that already support ChatGPT). Eg, ollama, koboldcpp and text-generation-webui all offer OpenAI-like APIs.