✨ feat(llm): 优化 DeepSeek 适配器 (#2160)
检查bot是否运行正常 / bot check (push) Canceled after 0s
CodeQL Code Security Analysis / Analyze (python) (push) Canceled after 0s
Ruff Lint / Ruff Lint (push) Canceled after 0s
Sequential Lint and Type Check / ruff-call (push) Canceled after 0s
Release Drafter / Update Release Draft (push) Canceled after 0s
Force Sync to Aliyun / sync (push) Canceled after 0s
Update Version / update-version (push) Canceled after 0s
Sequential Lint and Type Check / pyright-call (push) Canceled after 0s

* ✨ feat(llm): 新增 Grok 适配器及 API 密钥重置指令

- 新增 Grok 适配器并支持原生推特检索工具 `x_search`
- 优化 DeepSeek 适配器以迁移至 Responses 协议,增强多模态支持
- 在 LLM 管理插件中新增 `llm reset` 子命令以重置 Key 状态
- 增强 MCP 连接异常处理及流关闭容错能力

* 🚨 auto fix by pre-commit hooks

---------

Co-authored-by: webjoin111 <455457521@qq.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Rumio
2026-09-22 09:02:15 +08:00
committed by GitHub
co-authored by webjoin111 pre-commit-ci[bot]
parent 39ed1ade14
commit 33d6ea1335
13 changed files with 307 additions and 52 deletions
@@ -44,6 +44,11 @@ __plugin_meta__ = PluginMetadata(
llm keys <ProviderName>
- 查看指定提供商的所有API Key状态。
llm reset [ProviderName]
- 重置 API Key 的熔断与冷却状态。
- 带参数: 仅重置指定提供商的所有 Key。
- 不带参数: 全局重置所有提供商的所有 Key。
llm mcp [action] [targets...]
- 管理 MCP (Model Context Protocol) 服务。
- 不带参数: 查看当前配置的 MCP 服务列表及序号。
@@ -74,6 +79,9 @@ llm_cmd = on_alconna(
"test", Args["model_name", str], alias=["ping"], help_text="测试模型连通性"
),
Subcommand("keys", Args["provider_name", str], help_text="查看API密钥状态"),
Subcommand(
"reset", Args["provider_name", str, ""], help_text="重置API密钥状态"
),
Subcommand(
"mcp",
Option("添加", Args["json_strs", MultiVar(str)], alias=["add"]),
@@ -173,6 +181,22 @@ async def handle_keys(arp: Arparma, provider_name: Match[str]):
await llm_cmd.finish(MessageUtils.build_message(image))
@llm_cmd.assign("reset")
async def handle_reset(arp: Arparma):
"""处理 'llm reset' 命令"""
provider_name = arp.query("reset.provider_name", "").strip()
target_log = provider_name if provider_name else "ALL"
logger.info(
f"执行 API Key 重置操作: {target_log}",
command="LLM Manage",
session=arp.header_result,
)
_success, msg = await DataSource.reset_keys(
provider_name if provider_name else None
)
await llm_cmd.finish(msg)
@llm_cmd.assign("mcp")
async def handle_mcp(arp: Arparma, event: Event):
"""处理 'llm mcp' 命令"""