fengs2021/dsh-feishu-bridge0

dsh-feishu-bridge

DSH 飞书机器人桥接插件,支持通过飞书机器人与 DSH 对话,消息由 AI 处理并以流式交互卡片实时发回,无需公网 Webhook。

AI 分析

核心用途是将 DSH 的 AI 能力桥接到飞书客户端。适合习惯使用飞书进行日常沟通、需要通过飞书单聊或群聊 @ 机器人来调用 DSH 的团队或个人。

套件
dsh-feishu-bridge
版本
1.1.0
授權
MIT
最近更新
2026年8月17日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:fengs2021/dsh-feishu-bridge

Usage

  1. Open the bot chat in Feishu (or add the bot to a group)
  2. Message it directly; in groups, @ the bot
  3. Commands: /help, /reset, /status

Channel direct-send (DSH → Feishu): de_channel_send channels=feishu content=...; attachments via attachments=[{kind:'image'|'file', path|url|base64, fileName?}]; target defaults to the most recent Feishu chat, or explicit target: 'p2p:oc_xxx'. Implemented in lib/channel-registry.js (standalone, zero deps on the notification module).

配置

~/.dsh/profiles/web/cordis.patch.yml 中覆盖配置(全部可选,均有默认值):

- id: feishu-bridge
  config:
    botOpenId: 'ou_xxxxxx'     # 机器人 open_id(群聊 @ 判断用;见下方获取方式)
    allowlist: ['ou_xxxxxx']   # open_id 白名单;空数组 = 允许所有人
    cwd: '~'                   # 新会话工作目录(默认用户主目录)
    enableGroup: true          # 是否响应群聊中 @ 机器人的消息
    maxReplyChars: 3500        # 文本模式单条回复上限(超出分段)
    typingHint: true           # 文本模式下收到先回「思考中」提示
    replyMarkdown: true        # 文本模式回复使用 markdown 排版
    streamCard: true           # 流式卡片模式(默认开;关闭则退回文本分段回复)
    cardPollMs: 600            # 流式轮询间隔(毫秒,兜底检测 turn 结束)
    cardMinIntervalMs: 1200    # 卡片更新最小间隔(毫秒,飞书接口限频保护)
    maxTurnMs: 600000          # 单轮最长等待(毫秒),超时停止更新并提示
    larkBin: 'lark-cli'        # lark-cli 可执行文件路径
    stateFile: '~/.dsh/plugins/dsh-feishu-bridge/state.json'

botOpenId 获取方式

  1. 插件启动时自动探测(/open-apis/bot/v3/info;部分应用权限下返回为空);
  2. 在任意群里 @ 机器人发一条消息,插件日志会打印 learned botOpenId=ou_xxx from group mention,填入配置即可;
  3. 飞书开放平台后台 → 应用 → 机器人,查看机器人 open_id。

使用

  1. 在飞书中搜索并打开机器人会话(或让管理员把机器人拉进群聊);
  2. 直接发消息即可对话;群聊中需 @ 机器人;

渠道直发(DSH → 飞书)

插件在 apply 时把主动发送能力登记到 DSH 渠道注册表(与 dsh-memory-evolve 通知模块的 globalThis.__dshChannelNotify 约定一致),因此 DSH 的 de_channel_send / de_notify 工具可直接发到飞书:

  • 文本:de_channel_send channels=feishu content=...
  • 附件:attachments=[{kind:'image'|'file', path|url|base64, fileName?}](本地路径/base64 经临时目录 + 相对路径发送;图片走 --image,其余走 --file
  • 目标:缺省 = 最近交互的飞书会话(插件 state 记录);显式传 target: 'p2p:oc_xxx'
  • 实现:lib/channel-registry.js(独立模块,零依赖通知模块)
  1. 命令:
    • /help — 帮助
    • /reset — 清空当前对话上下文,重新开始
    • /status — 查看会话状态(sessionId / 模型 / 已处理消息数)