From 2807e1e89264e06b45c053fac08eb4fcb4720eec Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 22 Feb 2025 15:43:14 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20template=20of=20FastG?= =?UTF-8?q?PT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/config/default.py | 15 +++++++++++++++ astrbot/core/provider/sources/dashscope_source.py | 2 +- astrbot/core/provider/sources/openai_source.py | 6 ++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index 880e7b404..0b06b3f92 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -540,6 +540,14 @@ CONFIG_METADATA_2 = { "variables": {}, "timeout": 60, }, + "fastgpt": { + "id": "fastgpt", + "type": "openai_chat_completion", + "enable": True, + "key": [], + "api_base": "https://api.fastgpt.in/api/v1", + "timeout": 60, + }, "whisper(API)": { "id": "whisper", "type": "openai_whisper_api", @@ -582,6 +590,13 @@ CONFIG_METADATA_2 = { "obvious_hint": True, "hint": "可选。工作流固定输入变量,将会作为工作流的输入。也可以在对话时使用 /set 指令动态设置变量。如果变量名冲突,优先使用动态设置的变量。", }, + # "fastgpt_app_type": { + # "description": "应用类型", + # "type": "string", + # "hint": "FastGPT 应用的应用类型。", + # "options": ["agent", "workflow", "plugin"], + # "obvious_hint": True, + # }, "dashscope_app_type": { "description": "应用类型", "type": "string", diff --git a/astrbot/core/provider/sources/dashscope_source.py b/astrbot/core/provider/sources/dashscope_source.py index eb1db3607..9fd26c90b 100644 --- a/astrbot/core/provider/sources/dashscope_source.py +++ b/astrbot/core/provider/sources/dashscope_source.py @@ -125,4 +125,4 @@ class ProviderDashscope(ProviderOpenAIOfficial): raise Exception("暂不支持获得 阿里云百炼 的历史消息记录。") async def terminate(self): - await self.api_client.close() + pass \ No newline at end of file diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index a3114a6c1..6752568d0 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -48,8 +48,10 @@ class ProviderOpenAIOfficial(Provider): base_url=provider_config.get("api_base", None), timeout=self.timeout ) - - self.set_model(provider_config['model_config']['model']) + + model_config = provider_config.get("model_config", {}) + model = model_config.get("model", "unknown") + self.set_model(model) async def get_models(self): try: