Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

fix empty response

Michael Yang2bc06565c7ca
diff --git a/llm/ggml_llama.go b/llm/ggml_llama.go
index 0c2937325..010d579ab 100644
--- a/llm/ggml_llama.go
+++ b/llm/ggml_llama.go
@@ -497,8 +497,10 @@ func (llm *llama) Predict(ctx context.Context, prevContext []int, prompt string,
return fmt.Errorf("error unmarshaling llm prediction response: %v", err)
}
- fn(api.GenerateResponse{Response: p.Content})
- nextContext.WriteString(p.Content)
+ if p.Content != "" {
+ fn(api.GenerateResponse{Response: p.Content})
+ nextContext.WriteString(p.Content)
+ }
if p.Stop {
embd, err := llm.Encode(ctx, nextContext.String())