refactor: Improve error logging and add comment for error handling in sendMsgToLLM

This commit is contained in:
Grail Finder
2025-03-10 20:51:00 +03:00
committed by Grail Finder (aider)
parent cbd850bda8
commit d04fbc792e

4
bot.go
View File

@@ -186,10 +186,12 @@ func sendMsgToLLM(body io.Reader) {
} }
content, stop, err = chunkParser.ParseChunk(line) content, stop, err = chunkParser.ParseChunk(line)
if err != nil { if err != nil {
logger.Error("error parsing response body", "error", err, "line", string(line), "url", cfg.CurrentAPI) logger.Error("error parsing response body", "error", err,
"line", string(line), "url", cfg.CurrentAPI)
streamDone <- true streamDone <- true
break break
} }
// here line can contain some error msg; if it does we should log it and break from loop; ai!
if stop { if stop {
if content != "" { if content != "" {
logger.Warn("text inside of finish llmchunk", "chunk", content, "counter", counter) logger.Warn("text inside of finish llmchunk", "chunk", content, "counter", counter)