From 362b0a5c88492c9c13dcf623900ad5a41787dd89 Mon Sep 17 00:00:00 2001 From: Fan Zhaoyu Date: Thu, 7 Mar 2024 20:45:41 +0800 Subject: [PATCH] support markdown of code block support markdown of code block --- code/handlers/msg.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/code/handlers/msg.go b/code/handlers/msg.go index 3b752149..cb4e05ab 100644 --- a/code/handlers/msg.go +++ b/code/handlers/msg.go @@ -161,14 +161,8 @@ func withMainMd(msg string) larkcard.MessageCardElement { if i != nil { return nil } - mainElement := larkcard.NewMessageCardDiv(). - Fields([]*larkcard.MessageCardField{larkcard.NewMessageCardField(). - Text(larkcard.NewMessageCardLarkMd(). - Content(msg). - Build()). - IsShort(true). - Build()}). - Build() + mainElement := larkcard.NewMessageCardMarkdown(). + Content(msg).Build() return mainElement } @@ -753,7 +747,7 @@ func sendNewTopicCard(ctx context.Context, sessionId *string, msgId *string, content string) { newCard, _ := newSendCard( withHeader("👻️ 已开启新的话题", larkcard.TemplateBlue), - withMainText(content), + withMainMd(content), withNote("提醒:点击对话框参与回复,可保持话题连贯")) replyCard(ctx, msgId, newCard) } @@ -762,7 +756,7 @@ func sendOldTopicCard(ctx context.Context, sessionId *string, msgId *string, content string) { newCard, _ := newSendCard( withHeader("🔃️ 上下文的话题", larkcard.TemplateBlue), - withMainText(content), + withMainMd(content), withNote("提醒:点击对话框参与回复,可保持话题连贯")) replyCard(ctx, msgId, newCard) } @@ -771,7 +765,7 @@ func sendVisionTopicCard(ctx context.Context, sessionId *string, msgId *string, content string) { newCard, _ := newSendCard( withHeader("🕵️图片推理结果", larkcard.TemplateBlue), - withMainText(content), + withMainMd(content), withNote("让LLM和你一起推理图片的内容~")) replyCard(ctx, msgId, newCard) }