Skip to content

Commit 0ec307b

Browse files
authored
fix: ignore markdown codeblock (#205)
1 parent f9810c4 commit 0ec307b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/models/chathistories/recap.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func (m *Model) summarizeChatHistoriesSlice(chatID int64, s string) ([]*openai.C
8989
}
9090

9191
var outputs []*openai.ChatHistorySummarizationOutputs
92+
resp.Choices[0].Message.Content = strings.TrimPrefix(resp.Choices[0].Message.Content, "```json")
93+
resp.Choices[0].Message.Content = strings.TrimPrefix(resp.Choices[0].Message.Content, "```")
94+
resp.Choices[0].Message.Content = strings.TrimSuffix(resp.Choices[0].Message.Content, "```")
9295

9396
err = json.Unmarshal([]byte(resp.Choices[0].Message.Content), &outputs)
9497
if err != nil {

0 commit comments

Comments
 (0)