~/Projects/folotoy-server-self-hosting
git clone https://code.lsong.org/folotoy-server-self-hosting
Commit
- Commit
- e4e965d75e88a70e78dab2afebfebca6e27d6a08
- Author
- Lsong <[email protected]>
- Date
- 2023-10-31 16:05:21 +0800 +0800
- Diffstat
.gitignore | 158 ------------------------------------------------ docker-compose.yml | 82 ++++++++++++------------ roles.json | 14 ++++
update
diff --git a/.gitignore b/.gitignore index 68bc17f9ff2104a9d7b6777058bb4c343ca72609..e4befae13d9cfd417c4320da7029296eb33abb92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,161 +1,3 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -__pycache__/ *.py[cod] -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ diff --git a/docker-compose.yml b/docker-compose.yml index fe3d1c6f9eac4fb08c3791dad66955b69357a9f1..ac72ec34d29005331b573cea970b634721a4f406 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,79 +31,84 @@ LOG_LEVEL: DEBUG ROLES_FILE_PATH: /roles.json - # Default STT(Sound To Text) type + # Default LLM(Large Language Model) type - # Options: [openai-whisper, azure-whisper, azure-stt] + # Options: [openai, azure-openai] -services: + - "1883:1883/tcp" nginx: - # OpenAI Whisper - #OPENAI_WHISPER_API_BASE: https://one-api.xxxx.com/v1 - OPENAI_WHISPER_KEY: sk-Gnkw1ZnG5rUWbzVl316dddddddddddddddddd + # OpenAI - OPENAI_WHISPER_MODEL: whisper-1 + # OPENAI_OPENAI_API_BASE: https://one-api.xxx.com/v1 - emqx: image: emqx/emqx:latest + - "18083:18083/tcp" - emqx: +services: restart: always - AZURE_WHISPER_API_BASE: https://xxxxx.openai.azure.com + # Azure OpenAI - AZURE_WHISPER_KEY: 9afbef65bcf6487eeeeeeeeeeeeeeeeeee + # AZURE_OPENAI_KEY: ef0f2781b5a24b15baaaaaaaaaaaaaaaaaaaaaaa - emqx: - "18083:18083/tcp" emqx: - nginx: + # AZURE_OPENAI_VERSION: "2023-05-15" - # Azure STT + AZURE_OPENAI_KEY: c97f2b499aeb46ebbe29aef5a2052906 - AZURE_STT_KEY: 3eba91b6143f4d3eeeeeeeeeeeeeeeeeeeeeeeee + AZURE_OPENAI_ENDPOINT: https://openai8.openai.azure.com/ - image: emqx/emqx:latest + restart: always services: - # Default LLM(Large Language Model) type + # Baidu YIYAN API - # Options: [openai, azure-openai] + # LLM_TYPE: yiyan - image: emqx/emqx:latest restart: always -services: restart: always - image: emqx/emqx:latest + restart: always ports: + emqx: image: emqx/emqx:latest - - "1883:1883/tcp" - image: emqx/emqx:latest - "18083:18083/tcp" + nginx: services: - restart: always + - "18083:18083/tcp" - image: emqx/emqx:latest nginx: +services: restart: always + emqx: - restart: always + nginx: version: '3' - restart: always + nginx: services: - + # OPENAI_WHISPER_MODEL: whisper-1 - restart: always emqx: + image: emqx/emqx:latest + emqx: restart: always + nginx: image: emqx/emqx:latest - restart: always + nginx: restart: always - YIYAN_SECRET: xxxxxxxxxxxxxxxxxxxxx + AZURE_WHISPER_DEPLOYMENT_NAME: whisper + AZURE_WHISPER_API_VERSION: 2023-09-01-preview - restart: always + # Azure STT + AZURE_STT_KEY: 72b7178841d045f18eb49a881e260a22 + nginx: - "1883:1883/tcp" - VOICE_EXECUTOR_MAX_WORKERS: 2 # Default TTS(Text to Sound) type # Options: [edge-tts, azure-tts, elevenlabs] # edge-tts is Free but slow - TTS_TYPE: edge-tts + TTS_TYPE: azure-tts # Azure TTS - AZURE_TTS_KEY: 3eba91b6143f4d399edeeeeeeeeeeeeeeeeeeeee + AZURE_TTS_KEY: 72b7178841d045f18eb49a881e260a22 - AZURE_TTS_SERVICE_REGION: eastasia + AZURE_TTS_SERVICE_REGION: eastus2 # elevenlabs + # If your elevenlabs is a free account, keep 2 here + VOICE_EXECUTOR_MAX_WORKERS: 2 ELEVENLABS_TTS_KEY: a920b73991e68d5c9c9aaaaaaaaaaaaaaaa ELEVENLABS_TTS_MODEL: eleven_multilingual_v2 - AUDIO_DOWNLOAD_URL: http://192.168.52.164:8082 + SPEECH_UDP_SERVER_HOST: 192.168.8.160 + SPEECH_UDP_SERVER_PORT: 8085 + + AUDIO_DOWNLOAD_URL: http://192.168.8.160:8082 AUDIO_SAVE_PATH: /audio # MQTT Broker @@ -111,6 +116,3 @@ MQTT_BROKER_PORT: 1883 MQTT_CLIENT_ID: folotoy MQTT_USERNAME: folotoy MQTT_PASSWORD: folotoy - - SPEECH_UDP_SERVER_HOST: 192.168.52.164 - SPEECH_UDP_SERVER_PORT: 8085 diff --git a/roles.json b/roles.json index 47e45f5b8d587ec0f0713a338834cdb0d29d2a8b..53f2ed0c767993d9fb6b51cdc787b3d7e8486c0e 100644 --- a/roles.json +++ b/roles.json @@ -1,5 +1,6 @@ { "1": { + "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "model": "gpt-3.5-turbo", "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "prompt": "你扮演一个孩子的小伙伴,名字叫小兔兔,性格和善,说话活泼可爱,对孩子充满爱心,经常赞赏和鼓励孩子,用5岁孩子容易理解语言提供有趣和创新的回答,每次回复根据聊天主题询问她的看法以激发她的思考和好奇心,现在她来到了你身边问了第一个问题:[你是谁]", @@ -10,9 +11,11 @@ "top_p": 0.95, "frequency_penalty": 0, "presence_penalty": 0, "voice_name": "zh-CN-XiaoxiaoNeural", + "stt_type": "azure-whisper", "language": "zh" }, "2": { + "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "model": "gpt-3.5-turbo", "start_text": "你好,俺是东北兔,请问有什么俺可以帮助你的吗?", "prompt": "你是一个知识渊博,乐于助人的智能机器人,你的名字叫“东北兔”,你的任务是陪我聊天,请用简短的对话方式,用中文讲一段话,每次回答不超过50个字!", @@ -23,9 +26,11 @@ "top_p": 0.95, "frequency_penalty": 0, "presence_penalty": 0, "voice_name": "zh-CN-liaoning-XiaobeiNeural", + "stt_type": "azure-whisper", "language": "zh" }, "3": { + "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "model": "gpt-3.5-turbo", "start_text": "Hi, I'm Fofo. Nice to meet you.", "prompt": "Your name is \"Fofo\". Your task is to chat with me. Please respond in English, keeping your answers brief – no more than 50 words each time!", @@ -36,9 +41,11 @@ "top_p": 0.95, "frequency_penalty": 0, "presence_penalty": 0, "voice_name": "en-US-AnaNeural", + "stt_type": "azure-whisper", "language": "en" }, "4": { + "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "model": "gpt-3.5-turbo", "start_text": "你好,额是陕西兔,请问有什么额可以帮助你的吗? ", "prompt": "你擅于鼓励别人,乐观积极,无论别人和你说了什么,你都能夸对方,让人快乐", @@ -49,9 +56,11 @@ "top_p": 0.95, "frequency_penalty": 0, "presence_penalty": 0, "voice_name": "zh-CN-shaanxi-XiaoniNeural", + "stt_type": "azure-whisper", "language": "zh" }, "5": { + "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "model": "gpt-3.5-turbo", "start_text": "你好,我是童话故事兔,想听什么童话故事吗?试试说,我想听听三只小猫咪的故事", "prompt": "你是一个知识渊博的智能机器人,你的名字叫“故事兔”,你的任务是讲故事给一位7岁孩子的听,你要先听取孩子想听的故事主题,然后根据孩子的说的内容,用中文讲一段故事,每个故事不超过200个字!", @@ -62,9 +71,11 @@ "top_p": 0.95, "frequency_penalty": 0, "presence_penalty": 0, "voice_name": "zh-CN-XiaoyiNeural", + "stt_type": "azure-whisper", "language": "zh" }, "6": { + "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "model": "gpt-3.5-turbo", "start_text": "你好,我是台湾兔,请问有什么我可以帮助你的吗?", "prompt": "你是一个知识渊博,乐于助人的智能机器人,你的名字叫“台湾兔”,你的任务是陪我聊天,请用简短的对话方式,用中文讲一段话,每次回答不超过50个字!", @@ -75,9 +86,11 @@ "top_p": 0.95, "frequency_penalty": 0, "presence_penalty": 0, "voice_name": "zh-TW-HsiaoChenNeural", + "stt_type": "azure-whisper", "language": "zh" }, "7": { + "start_text": "你好,我是小兔兔,请问有什么我可以帮助你的吗?", "model": "gpt-3.5-turbo", "start_text": "你好,我是口算兔,我们一起来玩玩口算游戏吧?", "prompt": "我是一个6岁小朋友,你陪我玩口算游戏。你出题,我回答结果。如果答对了你就说好棒,答错了你就告诉我正确答案,并且鼓励我。你一题一题的出,我一个个回答。不要有太多的解释说明。明白了吗?", @@ -88,6 +101,7 @@ "top_p": 0.95, "frequency_penalty": 0, "presence_penalty": 0, "voice_name": "zh-CN-YunxiaNeural", + "stt_type": "azure-whisper", "language": "zh" } }