Handle empty prompt in chat streaming with error callback

- Add error handling for empty prompts in streamChat method
- Ensure proper error message generation and callback invocation
- Improve error propagation in chat streaming scenarios
This commit is contained in:
Max 2025-03-03 15:26:24 +08:00
parent c74d32390c
commit 48d65c0e39

View file

@ -631,6 +631,7 @@ func (ast *Assistant) streamChat(
// if the prompt is empty, return the error
if prompt == "" {
chatMessage.New().Error(retry.Error()).Done().Callback(cb).Write(c.Writer)
return nil, retry
}