From 28340b23c10056da12e8e36979ce24303e52854e Mon Sep 17 00:00:00 2001 From: xiaohei Date: Sun, 12 Apr 2026 02:02:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A3=9E=E4=B9=A6=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=AD=A3=20-=20ms?= =?UTF-8?q?g=5Ftype=3Dinteractive=E9=9C=80=E7=94=A8content=E4=BC=A0card=20?= =?UTF-8?q?JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/feishu.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/server/feishu.ts b/src/server/feishu.ts index 1906b02..2f208de 100644 --- a/src/server/feishu.ts +++ b/src/server/feishu.ts @@ -190,6 +190,26 @@ export function buildDecisionCard(card: DecisionCardOptions): Record { const token = await getTenantToken(); const url = `https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=${receiveIdType}`; + + const cardContent = { + header: { + title: { tag: 'plain_text', content: card.title }, + template: 'blue', + }, + elements: [ + { tag: 'div', text: { tag: 'plain_text', content: card.description } }, + { + tag: 'action', + actions: card.options.map((opt) => ({ + tag: 'button', + text: { tag: 'plain_text', content: opt.label }, + type: opt.style === 'danger' ? 'danger' : opt.style === 'primary' ? 'primary' : 'default', + value: { action: opt.key }, + })), + }, + ], + }; + const res = await fetch(url, { method: 'POST', headers: { @@ -199,7 +219,7 @@ export async function sendDecisionCard(card: DecisionCardOptions, receiveId: str body: JSON.stringify({ receive_id: receiveId, msg_type: 'interactive', - card: buildDecisionCard(card), + content: JSON.stringify(cardContent), }), }); const data = await res.json();