log prediction failures
This commit is contained in:
commit
f529626c6c
1 changed files with 3 additions and 0 deletions
|
@ -129,6 +129,7 @@ func GenerateHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := activeSession.llm.Predict(req.Context, prompt, fn); err != nil {
|
if err := activeSession.llm.Predict(req.Context, prompt, fn); err != nil {
|
||||||
|
log.Printf("llm.Predict failed with %s", err)
|
||||||
ch <- gin.H{"error": err.Error()}
|
ch <- gin.H{"error": err.Error()}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -345,11 +346,13 @@ func streamResponse(c *gin.Context, ch chan any) {
|
||||||
|
|
||||||
bts, err := json.Marshal(val)
|
bts, err := json.Marshal(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("streamResponse: json.Marshal failed with %s", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
bts = append(bts, '\n')
|
bts = append(bts, '\n')
|
||||||
if _, err := w.Write(bts); err != nil {
|
if _, err := w.Write(bts); err != nil {
|
||||||
|
log.Printf("streamResponse: w.Write failed with %s", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue