Skip to content

Commit

Permalink
support markdown of code block
Browse files Browse the repository at this point in the history
support markdown of code block
  • Loading branch information
Xyy-tj committed Mar 7, 2024
1 parent 774a49d commit 362b0a5
Showing 1 changed file with 5 additions and 11 deletions.
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

0 comments on commit 362b0a5

Please sign in to comment.