Skip to main content

环境变量

自建服务器文件在线生成工具

最新版的文件在这里:docker-compose.yml请复制最新的文档来并修改其中的参数

该文件用于配置全局参数,例如:全局使用的TTS(文本转语音)LLM(大型语言模型)STT(语音转文字)以及服务器地址端口和配置。

如果您想要在全局设置 TTS 的语音类型,您可以添加以下字段(请根据您的 TTS 类型 选择添加相应的字段):

  • OPENAI_TTS_VOICE_NAME(alloy, echo, fable, onyx, nova, shimmer)
  • AZURE_OPENAI_TTS_VOICE_NAME(alloy, echo, fable, onyx, nova, shimmer)
  • AZURE_TTS_VOICE_NAME(声音列表)
  • EDGE_TTS_VOICE_NAME(声音列表)
  • ELEVENLABS_TTS_VOICE_ID(声音列表)
  • ALIYUN_TTS_APP_KEY(App Key)
  • DIFY_TTS_KEY

如果您想要给每个角色设置特定的 TTS,请查看角色配置

caution
  • 请注意将your_vps_ip为自己的 ip。将各种服务的 Key 修改为 自己的 Key。特别注意AUDIO_DOWNLOAD_URL带有http://SPEECH_UDP_SERVER_HOST不带

  • 确保所有使用了的端口都打开,1883/tcp8082/tcp18083/tcp8083/tcp8085/udp,尤其注意 8085端口是 UDP。对于一些 VPS,可能需要去安全组打开,请一定确保打开成功,特别是确保 8085UDP

  • 您只需要填入你自己设置的 TTS, LLM, STT, 相应的参数。例如:STT_TYPE 选择了openai-whisper,则需要填入对应的 OPENAI_WHISPER_KEY,OPENAI_WHISPER_MODEL,OPENAI_WHISPER_API_BASE

  • 每次修改后,都需要重编,执行以下命令:

    docker compose up -d
  • 该文件中的 TTSLLMSTT 都优先级低于 roles.json,如果在 role.json 中定义了 TTSLLMSTT,该文件中的定义将不会生效。搭建完成后如果测试发现与这里定义的服务有冲突,请检查 roles.json

  • ROLES_FILE_PATH 字段配置的是 roles.json 的路径,请确保该路径是正确的。

FoloToy 服务器接受以下环境变量以进行运行时配置:

变量名描述默认值
HTTPX_TIMEOUT请求超时时间5
ROLES_FILE_PATH角色配置文件roles.json
STT_TYPE声音转文字引擎类别: openai-whisper, azure-stt, azure-whisper, dify-stt, aliyun-asropenai-whisper
OPENAI_WHISPER_API_BASEOpenAI Whisper API Base Urlhttps://api.openai.com/v1
OPENAI_WHISPER_KEYOpenAI Whisper API Keysk-AAAAAAAAA
OPENAI_WHISPER_MODELOpenAI Whipser Modelwhisper-1
AZURE_WHISPER_API_BASEAzure Whisper API Base Url, 可用区域查询 https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability
AZURE_WHISPER_KEYAzure Whisper API Key
AZURE_WHISPER_DEPLOYMENT_NAMEDeploy Name
AZURE_WHISPER_API_VERSIONAPI Version, https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#request-a-speech-to-text-transcription2023-09-01-preview
AZURE_STT_KEYAzure Speech Services Key, https://learn.microsoft.com/en-us/azure/ai-services/speech-service/overview
AZURE_STT_SERVICE_REGIONAzure Speech Services Region
DIFY_STT_API_BASEDify sound-to-text API Base Url. You need to enable sound-to-text feature in dify configurtionshttp://192.168.52.164/v1
DIFY_STT_KEYDify sound-to-text API Keysk-AAAAAAAA
ALIYUN_ASR_ACCESS_KEY_IDaliyun access key id获取token请参考:https://help.aliyun.com/document_detail/450514.html
ALIYUN_ASR_ACCESS_KEY_SECRETaliyun access secret key获取token请参考: https://help.aliyun.com/document_detail/450514.html
ALIYUN_ASR_APP_KEYaliyun app key获取 app key 请参考:https://help.aliyun.com/document_detail/72214.html
LLM_TYPELarge Language Model Type: openai, azure-openai, gemini, dify, qianfan, xiaodu, moonshot, groq, ollama, anthropicopenai
OPENAI_OPENAI_API_BASEOpenAI API Base Urlhttps://api.openai.com/v1
OPENAI_OPENAI_KEYOpenAI API Keysk-AAAAAAAA
OPENAI_OPENAI_MODELOpenAI Modelgpt-3.5-turbo
AZURE_OPENAI_KEYAzure OpenAI API Key
AZURE_OPENAI_ENDPOINTAzure OpenAI API Endpoint
AZURE_OPENAI_API_VERSIONAzure OpenAI API Version, ,可用版本查询 https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#completions2023-05-15
AZURE_OPENAI_MODELOpenAI Modelgpt-35-turbo
DIFY_API_BASEDify API Base Urlhttp://192.168.52.164/v1
DIFY_KEYDify API Keysk-AAAAAAAA
GEMINI_API_BASEGemini API Base Urlhttps://generativelanguage.googleapis.com
GEMINI_KEYGemini API Keysk-AAAAAAAA
QIANFAN_CLIENT_IDQianfan API Key13rBTgx*e03XE
QIANFAN_SECRETQianfan Secret Key KeyzYxtMI***QLerLgQ2W5e
QIANFAN_MODELQianfan Model Keyyi_34b_chat
MOONSHOT_API_BASEhttps://platform.moonshot.cn/https://api.moonshot.cn/v1
MOONSHOT_KEYsk-xxxxx
MOONSHOT_MODELmoonshot-v1-8k
OLLAMA_API_BASEhttps://ollama.comhttp://localhost:11434
OLLAMA_MODELgemma:2b
GROQ_API_BASEGroq api basehttps://api.groq.com/openai/v1
GROQ_MODELGroq modelmixtral-8x7b-32768
GROQ_KEYGroq api key
ANTHROPIC_API_BASEhttps://api.anthropic.com
ANTHROPIC_KEYsk-ant-api03-xx
ANTHROPIC_MODELclaude-3-sonnet-20240229
ANTHROPIC_MAX_TOKENS1024
VOICE_EXECUTOR_MAX_WORKERSVoice task threadpool max size2
TTS_TYPE文转声音引擎类别: openai-tts, azure-tts, azure-openai-tts, aliyun-tts, elevenlabs, edge-ttsedge-tts
AZURE_TTS_KEYAzure Speech Services Key
AZURE_TTS_SERVICE_REGIONAzure Speech Services Region
ELEVENLABS_TTS_KEYelevenlabs.io API Key
ELEVENLABS_TTS_MODELelevenlabs.io Modeleleven_multilingual_v2
OPENAI_TTS_API_BASEOpenAI API Base Urlhttps://api.openai.com/v1
OPENAI_TTS_KEYOpenAI API Keysk-AAAAAA
OPENAI_TTS_MODELOpenAI Text to speech modeltts-1
ALIYUN_TTS_ACCESS_KEY_IDaliyun access key id获取token请参考:https://help.aliyun.com/document_detail/450514.html
ALIYUN_TTS_ACCESS_KEY_SECRETaliyun access secret key获取token请参考: https://help.aliyun.com/document_detail/450514.html
ALIYUN_TTS_APP_KEYaliyun app key获取 app key 请参考:https://help.aliyun.com/document_detail/72214.html
DIFY_TTS_API_BASEDify Base Urlhttps://api.dify.ai/v1
DIFY_TTS_KEYDify App key
AZURE_OPENAI_TTS_API_BASEhttps://xxx.openai.azure.com/
AZURE_OPENAI_TTS_API_VERSION2024-02-15-preview
AZURE_OPENAI_TTS_DEPLOYMENT_NAMEtts
AZURE_OPENAI_TTS_KEYhttps://learn.microsoft.com/en-us/azure/ai-services/openai/text-to-speech-quickstart?tabs=command-line#rest-api
AZURE_OPENAI_TTS_MODELtts-1
AUDIO_DOWNLOAD_URL录音和生成的语音的下载目录
AUDIO_SAVE_PATH录音和生成的语言的存放目录
MQTT_BROKER_HOSTMQTT Broker Host
MQTT_BROKER_PORTMQTT Broker Port1883
MQTT_CLIENT_ID用户服务器登录的 MQTT Client ID loginfolotoy
MQTT_USERNAME用户服务器登录的 MQTT Username loginfolotoy
MQTT_PASSWORD用户服务器登录的 MQTT Password loginfolotoy
SPEECH_UDP_SERVER_HOST接受语音数据的 udp 服务主机地址
SPEECH_UDP_SERVER_PORT接受语音数据的 udp 服务端口8085
LOG_LEVEL日志级别: INFO,DEBUG,WARNINGDEBUG
INTEGRATION_MQTT是否开启 MQTT 集成接口false
SENTENCE_SEPARATORS用于分句的标点符号,!。?,!.?
TZ用于建立本地时区,例如在日志中使用本地时间。 查看 时区代码列表.Asia/Shanghai