mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
DingTalk can receive interactive card callbacks, but the card UI still depends on a published template, so the adapter now supports a template-backed card path with text commands as the reliable fallback. Telegram and WeChat use the same allow-once, allow-always, and deny semantics so manual authorization behaves the same across platforms. Constraint: DingTalk button rendering requires an operator-provided interactive card template id Rejected: Treat the existing AI streaming card template as a permission card | it cannot guarantee visible action buttons Confidence: high Scope-risk: moderate Directive: Do not remove the text approval fallback unless DingTalk card template provisioning is guaranteed Tested: bun test adapters/common/__tests__/permission.test.ts adapters/dingtalk/__tests__/permission-card.test.ts adapters/telegram/__tests__/telegram.test.ts adapters/common/__tests__/config.test.ts src/server/__tests__/adapters.test.ts Tested: bunx tsc -p adapters/tsconfig.json --noEmit Tested: bun run check:adapters Tested: cd desktop && bun run build Tested: bun run check:server Tested: bun run check:docs Tested: git diff --check Not-tested: bun run quality:pr is blocked by existing CLI core approval policy; see artifacts/quality-runs/2026-05-03T13-19-56-232Z/report.md
1.7 KiB
1.7 KiB
钉钉接入
钉钉接入走 DingTalk Stream,不需要公网回调地址。桌面端设置页支持扫码创建并授权机器人,授权成功后会把 clientId / clientSecret 写入 ~/.claude/adapters.json。
配置方式
打开 Desktop Webapp 的 Settings -> IM 接入 -> 钉钉。
推荐方式:
- 点击“扫码绑定”
- 使用钉钉手机 App 扫码
- 在钉钉里确认创建机器人
- 等待桌面端显示已绑定
如果扫码不可用,也可以手动填写:
Client IDClient Secret- 可选
Stream Endpoint - 可选
Allowed Users - 可选
权限卡片模板 ID
配对用户
钉钉机器人绑定完成后,还需要让具体用户通过 IM 配对码授权:
- 在
配对管理里生成配对码 - 在钉钉私聊里把配对码发给机器人
- 显示配对成功后即可开始聊天
配对用户会出现在“已配对用户”列表里,可以随时解绑。解绑后该用户需要重新发送新的配对码才能使用。
运行 adapter
桌面端发布版会通过 sidecar 自动启动。开发时可以手动运行:
cd adapters
bun install
bun run dingtalk
当前行为
- 只处理钉钉单聊消息
- 使用
sessionWebhook回复文本 / Markdown - 支持用户图片附件进入模型输入
- 支持 AI Card 流式输出和 thinking / 输入状态展示
- 支持
/new、/projects、/status、/clear、/stop、/help - 权限确认支持
/allow <requestId>、/always <requestId>、/deny <requestId>文本回复 - 如果配置了已发布的钉钉互动卡片模板 ID,会优先发送权限卡片,并通过 DingTalk Stream 的
/v1.0/card/instances/callback接收按钮回调;卡片发送失败时自动回退到文本命令 - 群聊后续再扩展