Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sorz/chatlibre

ChatGPT Translate for Mastodon. Enable ChatGPT API-powered translation on your Mastodon instance.
https://github.com/sorz/chatlibre

chatgpt mastodon translation

Last synced: about 2 months ago
JSON representation

ChatGPT Translate for Mastodon. Enable ChatGPT API-powered translation on your Mastodon instance.

Awesome Lists containing this project

README

        

# ChatGPT Translate for Mastodon
Enable ChatGPT API-powered translation on your Mastodon instance!

A lightweight scirpt that act as LibreTranslate service but chat with GPT to
get translation done.

## Setup

Prerequisite: [openai-python](https://github.com/openai/openai-python)

Run the script:

```bash
export OPENAI_API_KEY=sk-xxxxxxxxxx
./chatlibre.py
```

Update Mastodon [environment variables](https://docs.joinmastodon.org/admin/config/#libre_translate_endpoint):

```
LIBRE_TRANSLATE_ENDPOINT=http://localhost:8080
LIBRE_TRANSLATE_API_KEY=whatever
```

(We don't check LibreTranslate API key, so this value doesn't matter)

Then restart your Mastodon web server.

## Run as systemd service

Clone this repo into `/opt/chatlibre`, then

```bash
cd /opt/chatlibre
cp systemd/* /etc/systemd/system/
echo sk-xxxxxxxxxx > openai_key
chmod og-r openai_key
```

Edit `chatlibre.service` if you use path other than `/opt/chatlibre`.

Edit `chatlibre.socket` to change listen address and port number.

```bash
systemctl daemon-reload
systemctl enable --now chatlibre.socket
```