diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-01-31 12:57:53 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-01-31 12:57:53 +0300 |
| commit | 3a11210f52a850f84771e1642cafcc3027b85075 (patch) | |
| tree | aa4ec3f49b4ed8221a045fc221b09b26bee2c15d /tui.go | |
| parent | fa192a262410eb98b42ff8fb9e0f4e1111240514 (diff) | |
Enha: avoid recursion in llm calls
Diffstat (limited to 'tui.go')
| -rw-r--r-- | tui.go | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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 |
