refactor: 移除LLM旧兼容入口并统一scene单路由

变更项:

1. LLMRegistry 仅保留 scene 入口,删除 backend_name/backend_ref/scene_ref 等兼容解析分支,未声明 scene 时仅保留直连配置。

2. Dify/GlobalNews/GameTask 插件初始化改为仅传 scene,不再拼接 backend/provider/url 等旧兼容字段。

3. 清理插件配置冗余:dify/global_news/game_task/douyu 的 config.toml 删除 backend 字段,统一由 scene 映射后端。

4. 后台 system API 调整为严格模式:插件依赖扫描仅采集 scene;scene 保存时必须绑定有效 backend。

5. 后台页面去除拓扑中的配置Backend冗余列,并新增前端校验,禁止提交空场景或未绑定后端。
This commit is contained in:
liuwei
2026-04-20 14:45:03 +08:00
parent 7b6bd19781
commit ef49588485
10 changed files with 31 additions and 83 deletions

View File

@@ -2,7 +2,6 @@
enable = true
# 通过 scene 绑定后端,便于后台统一切换百科出题与判分模型。
scene = "game.task"
backend = "openai_compatible_game_task"
command = ["/t", "/a", "/s", "/r", "/l", "/h"]
command-format = """
🎮 百科问答指令:

View File

@@ -80,22 +80,11 @@ class GameTaskPlugin(MessagePluginInterface):
/h - 查看未完成任务
""")
plugin_config = self._config.get("GameTask", {})
self.authorization = plugin_config.get("authorization", "")
self.url = plugin_config.get("url", "")
self.model = plugin_config.get("model", "")
llm_config = plugin_config.get("llm", {}) or {}
if not llm_config:
# 严格场景路由:仅通过 scene 映射具体后端与模型参数。
llm_config = {
# 场景路由优先,后台改 scene 即可替换出题/判分模型。
"scene": plugin_config.get("scene", ""),
"backend": plugin_config.get("backend", ""),
"provider": "openai_compatible",
"authorization": self.authorization,
"url": self.url,
"model": self.model,
"stream": False,
"temperature": 0.2,
"max_tokens": 1000,
}
self.llm_client = UnifiedLLMClient(llm_config)