Giter Site home page Giter Site logo

sorakang0820 / fanyi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from markmester/fanyi

0.0 0.0 0.0 31 KB

A (Golang) slackbot that provides auto-translation utilizing ChatGPTs davinci model.

License: MIT License

Shell 1.93% Go 90.86% Makefile 6.23% Dockerfile 0.97%

fanyi's Introduction

Fanyi

Fanyi is a translation slack bot that utilizes Chat-GPT's davinci-003 model for real-time translation.

Motivation

Living in a bi-lingual household and not able to find any suitable auto-translation option, Fanyi was developed to be able to easily and collaboratively chat with each other. Fanyi utilizes Chat-GPT's davinci-003 for translation, which provides context and dialect aware translations. This translation engine seems to provide better translation than other current options (based solely on empirical data).

Current Feature-Set

  • Provides auto-translation for a channel between 2 languages.
  • Respond to message with a flag emoji(e.g. πŸ‡¨πŸ‡³ πŸ‡ΊπŸ‡Έ πŸ‡¬πŸ‡§) and Fanyi will translate to the language of that flag's country.
  • Saves user configuration (e.g. channels configured for auto-translation) to local storage.

Future Feature-Set

  • Feature to allow users to setup a channel that will auto translate from the source channel and mirror the conversation into the new, language specific channel.

  • Enable dialect selection. This was tested in an earlier version of this app, and it seemed to work great (for our use case - Wuhan, Chinese dialect), but I did not have time to integrate it into this version.

  • Feedback loop for mistranslated messages. ChatGPT is smart enough to take feedback and re-craft a response (possibly with a rewording of the text). A user could respond, indicating the translation doesn't make sense and it could try agin with a new translation and/or prompt the OP to reword the message.

  • Incorporate chat history to ChatGPT engine. This would allow it to learn the message style and help translate better.

  • S3 config store

Configuration

Rename the .env.sample to .env and fill the env vars with your credentials. See Set Up Your Slack App and Get an OpenAPI API Key for details on how to obtain env vars info.

Note: The environmental variable prefixed with AWS are only relevant for deployment of the app to AWS. For local deployments, these can be ignored.

Set Up Your Slack App

  1. Create an app at your Slack App Settings page at api.slack.com/apps
  2. Choose "From an app manifest", select the workspace you want to use, then paste the contents of manifest.yml into the dialog marked "Enter app manifest below".
  3. On the OAuth & Permissions page, install the app and get a Bot User OAuth Token - it begins with xoxb-. Copy this new token to your .env file as SLACK_BOT_TOKEN
  4. On the Basic Information page, scroll down to App-Level Tokens and click Generate Token and Scopes. Add the following scopes connections:write scope, give your token a name, and click Generate. Copy this new token to your .env file as SLACK_APP_TOKEN

Get an OpenAPI API Key

Register for a paid OpenAPI account and obtain a ChatGPT API key

Run

Local

After setting up the App Configuration, run:

    ENV=.env make build
    ENV=.env make up

By default, this will start a bot in 'ephemeral' mode. This means any user configurations (e.g. channel auto-translation preferences) will not be saved when the bot restarts. The configuration can be persisted by following the instructions in the .env.example

ECS

The app can be deployed to ECS using the docker-compose ECS context. To deploy, configure a .env file according to the .env.example file and run: `ENV=.env make deploy".

fanyi's People

Contributors

markmester avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.