Compare commits
2 Commits
c02b21ca37
...
2f3d95356a
Author | SHA1 | Date | |
---|---|---|---|
2f3d95356a | |||
137c568129 |
@ -64,12 +64,11 @@ func LLMRequest(messages []Message) (string, error) {
|
|||||||
go HandleDelayedContent(receiver)
|
go HandleDelayedContent(receiver)
|
||||||
|
|
||||||
response, err := CreateChatCompletionStream(model, messages, maxTokens, receiver)
|
response, err := CreateChatCompletionStream(model, messages, maxTokens, receiver)
|
||||||
if err != nil && response != "" {
|
|
||||||
Warn("Received partial response. Error: %v\n", err)
|
|
||||||
err = nil // ignore partial response error
|
|
||||||
}
|
|
||||||
|
|
||||||
if response != "" {
|
if response != "" {
|
||||||
|
if err != nil {
|
||||||
|
Warn("Received partial response. Error: %v\n", err)
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
// there was some content, so break to a new line after it
|
// there was some content, so break to a new line after it
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ func CreateChatCompletionRequest(model string, messages []Message, maxTokens int
|
|||||||
Model: model,
|
Model: model,
|
||||||
Messages: chatCompletionMessages,
|
Messages: chatCompletionMessages,
|
||||||
MaxTokens: maxTokens,
|
MaxTokens: maxTokens,
|
||||||
|
N: 1, // limit responses to 1 "choice". we use choices[0] to reference it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user