package dingtalk import "context" // DingtalkQAParams 钉钉卡片链路完成一次问答后的落库参数(由 BotConfig.OnDingtalkQA 消费) type DingtalkQAParams struct { Question string Answer string SenderStaffId string // 钉钉 staffId,写入 chat_message.user_id } // BotConfig 每个机器人独立配置(一个 robot_config 一份) type BotConfig struct { // 业务侧标识,便于日志与按 ID 检索 RobotConfigID string `json:"robot_config_id"` // 本地 robot_config.RecordID Name string `json:"name"` // 机器人名称(仅日志展示) // 钉钉机器人凭证 ClientID string `json:"client_id"` // AppKey / Client ID ClientSecret string `json:"client_secret"` // AppSecret / Client Secret RobotCode string `json:"robot_code"` // 机器人 robotCode,企业内部应用一般等同于 ClientID CardTemplateId string `json:"card_template_id"` // AI 卡片模板 ID // RAGFlow 真实 ID(注意:是 ragflow 侧 id,不是本地 record_id) RagChatId string `json:"rag_chat_id"` // RAGFlow chat id(来自 chat_assistant.rag_chat_id) RagSessionId string `json:"rag_session_id"` // RAGFlow session id(来自 chat_session.rag_session_id) // 与 chat_message 表关联的本地业务 ID(由 bll 在 buildBotConfig 时注入) AssistantId string `json:"assistant_id"` // chat_assistant.record_id SessionId string `json:"session_id"` // chat_session.record_id CreatorId string `json:"creator_id"` // robot_config.creator_id → chat_message.creator_id // OnDingtalkQA RAG 成功且卡片最终更新成功后写入 chat_message(可为 nil) OnDingtalkQA func(ctx context.Context, p DingtalkQAParams) error `json:"-"` }