Fix: recover bot; llama.cpp fix

This commit is contained in:
Grail Finder
2025-06-15 11:44:39 +03:00
parent 30e322d9c6
commit d4daa02155
12 changed files with 113 additions and 38 deletions

View File

@ -66,12 +66,13 @@ func (p *lcpRespParser) ParseBytes(body []byte) (map[string]any, error) {
p.log.Error("failed to unmarshal", "error", err)
return nil, err
}
if len(resp.Choices) == 0 {
p.log.Error("empty choices", "resp", resp)
err := errors.New("empty choices in resp")
return nil, err
}
text := resp.Choices[0].Message.Content
// if len(resp.Choices) == 0 {
// p.log.Error("empty choices", "resp", resp)
// err := errors.New("empty choices in resp")
// return nil, err
// }
// text := resp.Choices[0].Message.Content
text := resp.Content
li := strings.Index(text, "{")
ri := strings.LastIndex(text, "}")
if li < 0 || ri < 1 {