Cmd changes (#541)

This commit is contained in:
Patrick Devine
2023-09-18 12:26:56 -07:00
committed by GitHub
parent 94e1d96b29
commit 80dd44e80a
2 changed files with 90 additions and 67 deletions

View File

@@ -218,8 +218,12 @@ func GenerateHandler(c *gin.Context) {
ch <- r
}
if err := loaded.llm.Predict(c.Request.Context(), req.Context, prompt, fn); err != nil {
ch <- gin.H{"error": err.Error()}
if req.Prompt == "" {
ch <- api.GenerateResponse{Model: req.Model, Done: true}
} else {
if err := loaded.llm.Predict(c.Request.Context(), req.Context, prompt, fn); err != nil {
ch <- gin.H{"error": err.Error()}
}
}
}()