Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Support markdown of code block #276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions code/handlers/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down