Giter Site home page Giter Site logo

yuchanns / b-komachi-ai-worker Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 3.0 994 KB

A sophisticated Telegram bot Vocabulary Assistant deployed on Cloudflare Worker.

TypeScript 99.53% JavaScript 0.47%
azure-openai chatgpt cloudflare-workers telegram-bot vocabulary-learning

b-komachi-ai-worker's Introduction

I'm Hanchin Hsieh, AKA yuchanns. I'm a big Fan of LiSA(織部 里沙).

Creating and maintaining Go Binding for Apache OpenDAL. Once a @containerd CTL Emeritus.

You can ask me about Go, CloudNative, nvim, and AsahiLinux.

Speaking of Desktop OS, I have a set of beautiful dotfiles.

b-komachi-ai-worker's People

Contributors

yuchanns avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

beyoung bfreedom

b-komachi-ai-worker's Issues

[Feature] Enhancement for parsing sentences.

When it comes to sentences input into the bot, it only translates the meaning of them.
We can do more about it.

  • Split words and sentences into two parts.
  • Keep the word parts what it is.
  • Enhance the sentence parts:
    • Analyzing what grammar is used in this sentence.
    • Showing the common patterns users can use with this grammar.
    • Guessing the vocabulary users may not be familiar with.

[Feature] Enhancement for TTS

This might be a bit out of topic.
Using the Edge/Azure TTS is monotonous for users, and is not compliant with what we named for the bot .
We can train and turn the TTS voice into the real Hoshino Ai voice using rvc-tts.

This is a low priority. Just put it here for some day.

[Feature] Support Google Gemini Pro

Google has launched its free AI API Gemini Pro, which works well on the word analysis prompt, too.

Refer to Get API key to create your API key.

Try the below snippet to test with:

#!/bin/bash

API_KEY="YOUR_API_KEY"

curl \
  -X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key='${API_KEY} \
  -H 'Content-Type: application/json' \
  -d @<(echo '{
  "contents": [
    {
      "parts": [
        {
          "text": "你现在是一个高级英语翻译引擎,负责将用户提供的英文单词进行翻译,并按照以下明确的步骤来操作:1. 直接对单词进行翻译,不需要提供任何额外的解释或说明。2. 如果用户提供的单词存在拼写错误,应自动修正为你认为最可能正确的单词形式,并且无需向用户指出拼写错误。3. 你需要提供其原始形态,并附上相应的美式音标。4. 列举单词的所有含义,包括词性,并且为每个含义提供至少一个中英文双语的例句,确保整体提供至少三个例句。5. 罗列单词相关的词根、前缀和后缀。6. 提供与该单词相关的派生词。7. 列出单词的近义词。8. 列出形似单词。在执行这些指令时,请确保你提供的翻译内容既精确又全面,并且以清晰、组织良好的 toml 格式来展示所有信息。例如:输入: like你的输出应该是:\n[word]\ntext = \"like\"\n[pronunciation]\nipa = \"/laɪk/\"\n[[meaning]]\npart_of_speech = \"v.\"\ndefinitions = [\"喜欢\",\"喜爱\",]\n[[meaning]]\npart_of_speech = \"prep.\"\ndefinitions = [\"像\",\"如同\",]\n[[example]]\nsentence = \"I really like chocolate ice cream.\"\ntranslation = \"我真的很喜欢巧克力冰淇淋\"\n[[example]]\nsentence = \"She looks like her mother.\"\ntranslation = \"她长得像她的母亲\"\n[[example]]\nsentence = \"I like your idea\"\ntranslation = \"我喜欢你的想法\"\n[origin]\netymology = \"源自古英语“lician”,意为“爱、喜欢”。\"\n[related]\nprefixes = []\nsuffixes = [\"-ly\"]\nroots = [\"lik-\"]\n[[derivatives]]\nword = \"dislike\"\nmeaning = [\"不喜欢\", \"厌恶\"]\n[[derivatives]]\nword = \"alike\"\nmeaning = [\"相似的\", \"相同的\", \"相似地\", \"相同地\"]\n[[derivatives]]\nword = \"unlike\"\nmeaning = [\"不像\", \"与...不同\"]\n[[synonyms]]\nword = \"love\"\nmeaning = [\"爱\", \"情感\"]\n[[synonyms]]\nword = \"enjoy\"\nmeaning = [\"享受\", \"喜爱\"]\n[[synonyms]]\nword = \"adore\"\nmeaning = [\"崇拜\", \"爱慕\"]\n[[synonyms]]\nword = \"appreciate\"\nmeaning = [\"欣赏\", \"感激\", \"重视\"]\n[[homophones]]\nword = \"hike\"\nmeaning = [\"远足\", \"徒步\"]\n[[homophones]]\nword = \"bike\"\nmeaning = [\"自行车\"]\n输入: prevelent\n\n\n"
        }
      ]
    }
  ],
  "generationConfig": {
    "temperature": 0.3,
    "topK": 1,
    "topP": 1,
    "maxOutputTokens": 2048,
    "stopSequences": []
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
    },
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
    }
  ]
}')

FYI: https://ai.google.dev/docs

[Feature] Text-To-Speech each sentence

Currently, the bot only generates tts voice for users' input words/sentences, while example sentences answered by AI LLM are not included.
This would be helpful to Language Learners if we enable speech voice for each sentence.

Bonus:
People may type misspelled words which are later corrected by LLM, but the speech still uses the wrong contents. We should replace the TTS inputs.

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.