Skip to content

Commit

Permalink
fix: ignore markdown codeblock (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archeb authored May 29, 2024
1 parent f9810c4 commit 0ec307b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/models/chathistories/recap.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ func (m *Model) summarizeChatHistoriesSlice(chatID int64, s string) ([]*openai.C
}

var outputs []*openai.ChatHistorySummarizationOutputs
resp.Choices[0].Message.Content = strings.TrimPrefix(resp.Choices[0].Message.Content, "```json")
resp.Choices[0].Message.Content = strings.TrimPrefix(resp.Choices[0].Message.Content, "```")
resp.Choices[0].Message.Content = strings.TrimSuffix(resp.Choices[0].Message.Content, "```")

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

0 comments on commit 0ec307b

Please sign in to comment.