From b407ab879b2317e00bf5bce86ea3100172f91ece Mon Sep 17 00:00:00 2001 From: Augustin Date: Wed, 22 Apr 2026 19:12:32 +0200 Subject: [PATCH] fix(studio): forward AI thinking chunks to frontend instead of dropping them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ThinkingBlock component existed but was dead code — the backend silently discarded all --- internal/api/handlers_chat.go | 14 +++++++++++++- web/src/api/client.js | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/api/handlers_chat.go b/internal/api/handlers_chat.go index cf69338..869bd49 100644 --- a/internal/api/handlers_chat.go +++ b/internal/api/handlers_chat.go @@ -73,8 +73,20 @@ RÈGLES ABSOLUES: flusher, canFlush := w.(http.Flusher) result, err := orb.SendStream(body.Message, func(chunk string) { - // Skip thinking tags - user doesn't see them if strings.HasPrefix(chunk, "" { + data, _ := json.Marshal(map[string]string{"thinking_end": "true"}) + w.Write([]byte("data: " + string(data) + "\n\n")) + if canFlush { + flusher.Flush() + } return } data, _ := json.Marshal(map[string]string{"content": chunk}) diff --git a/web/src/api/client.js b/web/src/api/client.js index 594f1a4..f8b43db 100644 --- a/web/src/api/client.js +++ b/web/src/api/client.js @@ -68,7 +68,9 @@ const api = { if (data.done) { resolve(full); return } if (data.content) { full += data.content - if (onChunk) onChunk(full) + if (onChunk) onChunk(full, data) + } else if (data.thinking !== undefined || data.thinking_end) { + if (onChunk) onChunk(full, data) } } catch {} }