Skip to content

Commit

Permalink
chore: reuse glamour renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Mar 3, 2023
1 parent 94fdb0c commit a0fc376
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func main() {

client := gpt3.NewClient(apiKey)
scanner := bufio.NewScanner(os.Stdin)
renderer, _ := glamour.NewTermRenderer(glamour.WithEnvironmentConfig())
messages := []gpt3.ChatCompletionMessage{
{
Role: "system",
Expand Down Expand Up @@ -58,7 +59,7 @@ func main() {
totalTokens = resp.Usage.TotalTokens
message := resp.Choices[0].Message.Content

rendered, _ := glamour.RenderWithEnvironmentConfig(message)
rendered, _ := renderer.Render(message)
fmt.Println(rendered)
messages = append(
messages, gpt3.ChatCompletionMessage{
Expand Down

0 comments on commit a0fc376

Please sign in to comment.