飞书桥接 + AWS Bedrock Provider:Claude 模型被误报为协议不匹配
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 65/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- typescript
调研方向
阅读 src/lib/bridge/conversation-engine.ts 中针对 Claude 模型的检查,并将其协议允许列表与 runtime-compat.ts 中的 CLAUDE_CODE_READY_PRESETS 进行比较。检查 Feishu 桥接如何解析提供商和模型,然后验证 Bedrock 和 Vertex 的 Claude 模型不再触发不匹配错误,而不支持的协议仍会触发该错误。
由索引模型根据 Issue 内容生成。
描述
问题描述
在飞书桥接(Feishu Bridge)中,将 Provider 配置为 AWS Bedrock(protocol: 'bedrock')并使用 Claude 模型(如 global.anthropic.claude-sonnet-5)时,发送消息会报错:
Error: Provider "AWS Bedrock" uses bedrock protocol but model "global.anthropic.claude-sonnet-5" is an Anthropic model. Please configure the correct provider for this bridge channel.
即使模型 ID 是 Bedrock 上真实存在、可用的模型,该报错依然会触发,无法正常使用。
根因
src/lib/bridge/conversation-engine.ts 附近(约第 183-191 行)有一段 fail-fast 保护逻辑:
const isAnthropicModel = modelLower.includes('claude') || ['sonnet','opus','haiku'].includes(modelLower);
const isNonAnthropicProtocol = !['anthropic', 'openai-compatible', 'openrouter'].includes(resolved.protocol);
if (isAnthropicModel && isNonAnthropicProtocol) {
throw new Error(...);
}
问题在于协议白名单 ['anthropic', 'openai-compatible', 'openrouter'] 里漏掉了 bedrock 和 vertex。而 AWS Bedrock 和 Google Vertex AI 恰恰是官方支持、专门用来托管运行 Claude/Anthropic 模型的两个云协议——这一点可以从代码库自身另一处常量得到印证(runtime-compat.ts):
const CLAUDE_CODE_READY_PRESETS = new Set(['anthropic-official', 'bedrock', 'vertex']);
这里已经明确把 bedrock、vertex 和 anthropic-official 并列,认定它们都是能正常运行 Claude Code 的正规协议。
因此,只要 provider 的 protocol 是 bedrock(或 vertex),并且模型名包含 "claude"/"sonnet"/"opus"/"haiku",这条 guard 就会必定误报,把"协议本来就是用来服务 Anthropic 模型的"错误判断为"协议和模型不匹配"。
复现步骤
- 在 CodePilot 中新建一个 Provider,protocol 选择
bedrock,配置好 AWS 凭证。 - 将该 Provider 设为某个飞书桥接频道/群的默认 Provider,模型填一个真实存在的 Claude 模型 ID(例如
global.anthropic.claude-sonnet-5)。 - 在飞书里给机器人发消息。
- 收到报错:
Provider "AWS Bedrock" uses bedrock protocol but model "..." is an Anthropic model...
建议修复
将 conversation-engine.ts 中的协议白名单补全为:
const isNonAnthropicProtocol = !['anthropic', 'openai-compatible', 'openrouter', 'bedrock', 'vertex'].includes(resolved.protocol);
环境
- CodePilot 桌面版(macOS)
- 触发场景:飞书消息桥接(Feishu Bridge)+ AWS Bedrock Provider
- 主要语言
- TypeScript
- 星标
- 6.5k
- 派生
- 697
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
op7418/CodePilot 的其他 Issue
-
bug P0-crash-or-interrupt
难度 2/5 1-3 小时 新手友好度 68/100
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
bug P0-crash-or-interrupt
难度 4/5 3-5 天 新手友好度 48/100
-
无法正常应用内更新未关闭bug
难度 4/5 3-5 天 新手友好度 48/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
backnotprop/plannotator#2914 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/vscode-containers#655 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
dsh-tauri-desk/deepseek-harness-desktop#1477 · 1 条评论 ·