From 66ccb7a7322780a61b675e827794a8330aef3f89 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 21 Feb 2026 20:28:12 +0300 Subject: [PATCH] Fix: collapsing thinking while thinking --- bot.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bot.go b/bot.go index b469fb3..227751d 100644 --- a/bot.go +++ b/bot.go @@ -1197,6 +1197,16 @@ func chatToText(messages []models.RoleMsg, showSys bool) string { } return "[yellow::i][thinking... (press Alt+T to expand)][-:-:-]" }) + // Handle incomplete thinking blocks (during streaming when hasn't arrived yet) + if strings.Contains(text, "") && !strings.Contains(text, "") { + // Find the incomplete thinking block and replace it + startIdx := strings.Index(text, "") + if startIdx != -1 { + content := text[startIdx+len(""):] + placeholder := fmt.Sprintf("[yellow::i][thinking... (%d chars) (press Alt+T to expand)][-:-:-]", len(content)) + text = text[:startIdx] + placeholder + } + } } return text