fix: fix nil pointer error (#96)

This commit is contained in:
Zhang Minghan 2024-03-11 10:22:42 +08:00
parent 8a6945cf17
commit f5e1e0e9a8

View File

@ -68,7 +68,7 @@ func (c *ChatInstance) GetFunctionCalling(props *ChatProps) *FunctionsPayload {
}
func getChoice(form *ChatResponse) *globals.Chunk {
if len(form.Payload.Choices.Text) == 0 {
if form == nil || len(form.Payload.Choices.Text) == 0 {
return &globals.Chunk{Content: ""}
}