Skip to content

Commit

Permalink
test:markdown v1
Browse files Browse the repository at this point in the history
  • Loading branch information
ivhu committed Dec 8, 2024
1 parent f9c2364 commit 6325892
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions handler/gemini_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ func handleGroupChat(b *gotgbot.Bot, ctx *ext.Context, ai ai.AiInterface, s *tak

resp, err := ai.HandleText(setTake(s))
a <- struct{}{}
resp = utils.EscapeMarkdownChars(resp)
resp = strings.ReplaceAll(resp, " **", "- **")
resp = strings.ReplaceAll(resp, "\n* ", "\n- ")
if err != nil {
s.tokeListYou = append(s.tokeListYou, "nop")
log.Error().Err(err).Msg("gemini say error")
Expand All @@ -119,7 +120,7 @@ func handleGroupChat(b *gotgbot.Bot, ctx *ext.Context, ai ai.AiInterface, s *tak
log.Debug().Msgf("gemini say: %s", resp)
}
_, err = ctx.EffectiveMessage.Reply(b, resp, &gotgbot.SendMessageOpts{
ParseMode: "MarkdownV2",
ParseMode: "Markdown",
})
if err != nil {
log.Error().Err(err)
Expand Down Expand Up @@ -176,7 +177,7 @@ func sendRespond(resp string, b *gotgbot.Bot, ctx *ext.Context) error {
log.Debug().Msgf("gemini say in chat: %s", resp)
for i := 0; i < 3; i++ {
_, err := ctx.EffectiveMessage.Reply(b, resp, &gotgbot.SendMessageOpts{
ParseMode: "MarkdownV2",
ParseMode: "Markdown",
})
if err != nil {
log.Error().Err(err)
Expand Down

0 comments on commit 6325892

Please sign in to comment.