diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-12-29 12:09:18 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-12-29 12:09:18 +0300 |
| commit | 3eaf87cd9d38e845cd4eb5f1396b2aa4c9acd44d (patch) | |
| tree | 9343c6969bc782aca3ac94016db3f5eb05bbde39 /bot.go | |
| parent | cae7dea2e7c149edd055b542a2a08b53af8a0ac8 (diff) | |
| parent | 631c3b6a9b4c8b23f88885f257cd90ae1f45834a (diff) | |
Merge branch 'master' into doc/tutorial
Diffstat (limited to 'bot.go')
| -rw-r--r-- | bot.go | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -677,7 +677,6 @@ out: tv.ScrollToEnd() // Send chunk to audio stream handler if cfg.TTS_ENABLED { - // audioStream.TextChan <- chunk extra.TTSTextChan <- chunk } case toolChunk := <-openAIToolChan: @@ -685,11 +684,16 @@ out: toolResp.WriteString(toolChunk) tv.ScrollToEnd() case <-streamDone: - botRespMode = false - if cfg.TTS_ENABLED { - // audioStream.TextChan <- chunk - extra.TTSFlushChan <- true - logger.Debug("sending flushchan signal") + // drain any remaining chunks from chunkChan before exiting + for len(chunkChan) > 0 { + chunk := <-chunkChan + fmt.Fprint(tv, chunk) + respText.WriteString(chunk) + tv.ScrollToEnd() + // Send chunk to audio stream handler + if cfg.TTS_ENABLED { + extra.TTSTextChan <- chunk + } } break out } |
