FoloToy / folotoy-server-self-hosting

Config files for self-hosting the FoloToy Server. Documents: https://docs.folotoy.com
https://tool.folotoy.com
GNU General Public License v3.0
477 stars 86 forks source link

希望支持 cloudflare workers ai #145

Open yoyicue opened 8 months ago

yoyicue commented 8 months ago

比如免费额度的 whisper https://developers.cloudflare.com/workers-ai/models/whisper/

yoyicue commented 8 months ago

worker ai 介绍: https://developers.cloudflare.com/workers-ai/platform/pricing/

lewangdev commented 8 months ago

支持的,设置一下api base

yoyicue commented 8 months ago

curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/@cf/openai/whisper \ -X POST \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --data-binary @talking-llama.mp3

这个cloudflare的api在设置api base的时候怎么选,怎么设置?我选择 openai-whisper OPENAI_WHISPER_API_BASE: https://api.cloudflare.com/client/v4/accounts/{my_cloudflare_account_id}/ai/run/@cf/openai/whisper OPENAI_WHISPER_KEY: {my_api_token} OPENAI_WHISPER_MODEL: whisper

不对。

lewangdev commented 8 months ago

了解了🤝,谢谢。whisper的url不支持,下一个版本会支持的

lewangdev commented 7 months ago

在 docker-compose.yml 使用这个tag:24.14.6.2-beta

image

可以在 docker-compose.yml 中添加以下环境变量来使用

      STT_TYPE: cf-workers-ai-asr
      CF_WORKERS_AI_ASR_ACCOUNT_ID: 3ccbf9e8xxxxxxxxxxxx4576285
      CF_WORKERS_AI_ASR_API_TOKEN: RT0Pxxxxxxx
      CF_WORKERS_AI_ASR_MODEL_ID: "@cf/openai/whisper"

      LLM_TYPE: cf-workers-ai
      CF_WORKERS_AI_ACCOUNT_ID: 3ccbf9e8xxxxxxxxxxxx4576285
      CF_WORKERS_AI_API_TOKEN: RT0Pxxxxxxx
      #CF_WORKERS_AI_MODEL_ID: "@cf/openchat/openchat-3.5-0106"

或者在 roles.json 中定义

 {
        "start_text": "哈哈哈哈哈,我是一个超快可爱的大小兔,请问有什么我可以帮助你的吗?",
        "prompt": "你是一个知识渊博,乐于助人的智能机器人,你的名字叫“小兔”,你的任务是陪我聊天",
        "max_message_count": 5,
        "llm_type": "cf-workers-ai",
        "llm_config": {
          "account_id": "3ccbf9e8xxxxxxxxxxxx4576285"
          "api_token": "RT0Pxxxxxxx"
          "model_id": "@cf/openchat/openchat-3.5-0106"
        },
        "stt_type": "cf-workers-ai-asr",
        "stt_config": {
          "account_id": "3ccbf9e8xxxxxxxxxxxx4576285"
          "api_token": "RT0Pxxxxxxx"
          "model_id": "@cf/openai/whisper"
        }
      }
yoyicue commented 7 months ago

谢谢,发觉 @cf/openai/whisper 模型不太行...