From ff24ad4af7c3b88227b9387a5a660e83e82aef76 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Thu, 11 Sep 2025 13:53:17 +0300 Subject: Fix: listen to the finish signal --- bot.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot.go b/bot.go index 1f7a15b..4a7fa90 100644 --- a/bot.go +++ b/bot.go @@ -190,7 +190,6 @@ func sendMsgToLLM(body io.Reader) { for { var ( answerText string - stop bool chunk *models.TextChunk ) counter++ @@ -239,9 +238,11 @@ func sendMsgToLLM(body io.Reader) { streamDone <- true break } - if stop { + if chunk.Finished { if chunk.Chunk != "" { logger.Warn("text inside of finish llmchunk", "chunk", chunk, "counter", counter) + answerText = strings.ReplaceAll(chunk.Chunk, "\n\n", "\n") + chunkChan <- answerText } streamDone <- true break -- cgit v1.2.3