Skip to content

配置指南

本文档详细介绍飞书插件的所有配置选项。

基础配置

必填项

json
{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "cli_xxxxx",
      "appSecret": "xxxxx"
    }
  }
}

可选配置

json
{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "cli_xxxxx",
      "appSecret": "xxxxx",
      "domain": "feishu",
      "requireMention": true,
      "connectionMode": "websocket"
    }
  }
}

配置项详解

配置项类型默认值说明
enabledbooleanfalse是否启用飞书频道
appIdstring-飞书应用 ID
appSecretstring-飞书应用密钥
domainstring"feishu"域名,feishu 或 lark
requireMentionbooleantrue是否需要 @ 机器人才回复
connectionModestring"websocket"连接方式:websocket 或 webhook
historyLimitnumber50私聊消息历史条数

群组配置

可以为每个群聊单独配置不同的行为:

json
{
  "channels": {
    "feishu": {
      "requireMention": true,
      "groupPolicy": "open",
      "groups": {
        "oc_xxxxx": {
          "requireMention": false,
          "groupPolicy": "open",
          "systemPrompt": "你是一个专业的客服助手"
        }
      }
    }
  }
}

群组策略 (groupPolicy)

说明
open开放,所有群成员都可以交互
allowlist仅白名单用户可以交互
disabled禁用该群

requireMention 配置

  • true(默认):需要 @ 机器人才会回复
  • false:群内任何消息都会触发回复
  • "open":智能判断,必要时才要求 @

工具开关

可以禁用不需要的工具组以减少 context 开销:

json
{
  "channels": {
    "feishu": {
      "tools": {
        "doc": true,
        "wiki": true,
        "bitable": true,
        "calendar": true,
        "task": true,
        "drive": false
      }
    }
  }
}

消息配置

回复模式

json
{
  "channels": {
    "feishu": {
      "replyMode": "auto"
    }
  }
}
说明
auto自动选择最佳模式
static静态消息(一次性发送)
streaming流式消息(实时打字效果)

卡片配置

json
{
  "channels": {
    "feishu": {
      "footer": {
        "status": true,
        "elapsed": true
      }
    }
  }
}

心跳配置

json
{
  "channels": {
    "feishu": {
      "heartbeat": {
        "every": "30m",
        "activeHours": {
          "start": "08:00",
          "end": "22:00",
          "timezone": "Asia/Shanghai"
        }
      }
    }
  }
}

完整配置示例

json
{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "cli_xxxxx",
      "appSecret": "xxxxx",
      "domain": "feishu",
      "requireMention": true,
      "groupPolicy": "open",
      "connectionMode": "websocket",
      "historyLimit": 50,
      "replyMode": "auto",
      "footer": {
        "status": true,
        "elapsed": true
      },
      "tools": {
        "doc": true,
        "wiki": true,
        "bitable": true,
        "calendar": true,
        "task": true,
        "drive": true
      },
      "heartbeat": {
        "every": "30m"
      },
      "groups": {
        "oc_team_chat": {
          "requireMention": false,
          "groupPolicy": "open",
          "systemPrompt": "你是一个团队协作助手"
        }
      }
    }
  }
}

下一步

Released under the MIT License.