From 3a11210f52a850f84771e1642cafcc3027b85075 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 31 Jan 2026 12:57:53 +0300 Subject: Enha: avoid recursion in llm calls --- tui.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tui.go') diff --git a/tui.go b/tui.go index d222d15..e164423 100644 --- a/tui.go +++ b/tui.go @@ -873,7 +873,8 @@ func init() { // there is no case where user msg is regenerated // lastRole := chatBody.Messages[len(chatBody.Messages)-1].Role textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) - go chatRound("", cfg.UserRole, textView, true, false) + // go chatRound("", cfg.UserRole, textView, true, false) + chatRoundChan <- &models.ChatRoundReq{Role: cfg.UserRole} return nil } if event.Key() == tcell.KeyF3 && !botRespMode { @@ -1176,7 +1177,8 @@ func init() { // INFO: continue bot/text message // without new role lastRole := chatBody.Messages[len(chatBody.Messages)-1].Role - go chatRound("", lastRole, textView, false, true) + // go chatRound("", lastRole, textView, false, true) + chatRoundChan <- &models.ChatRoundReq{Role: lastRole, Resume: true} return nil } if event.Key() == tcell.KeyCtrlQ { @@ -1347,7 +1349,8 @@ func init() { } colorText() } - go chatRound(msgText, persona, textView, false, false) + // go chatRound(msgText, persona, textView, false, false) + chatRoundChan <- &models.ChatRoundReq{Role: persona, UserMsg: msgText} // Also clear any image attachment after sending the message go func() { // Wait a short moment for the message to be processed, then clear the image attachment -- cgit v1.2.3