diff options
author | Grail Finder (aider) <wohilas@gmail.com> | 2025-03-10 20:51:08 +0300 |
---|---|---|
committer | Grail Finder (aider) <wohilas@gmail.com> | 2025-03-10 20:51:08 +0300 |
commit | d963304f61b0014e92573185cfdcf0f55ce382ad (patch) | |
tree | fa344a9d6fcc66a72fb53deb10d54b593b9372e2 | |
parent | d04fbc792eba0443025fb3f264e108007562009b (diff) |
feat: add error detection and handling for LLM API responses
-rw-r--r-- | bot.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -191,7 +191,12 @@ func sendMsgToLLM(body io.Reader) { streamDone <- true break } - // here line can contain some error msg; if it does we should log it and break from loop; ai! + // Handle error messages in response content + if content != "" && strings.Contains(strings.ToLower(content), "error") { + logger.Error("API error response detected", "content", content, "url", cfg.CurrentAPI) + streamDone <- true + break + } if stop { if content != "" { logger.Warn("text inside of finish llmchunk", "chunk", content, "counter", counter) |