diff --git a/static/chat.html b/static/chat.html
index 4fb3c89..e351854 100644
--- a/static/chat.html
+++ b/static/chat.html
@@ -1888,6 +1888,9 @@ async function runChat(text) {
const reader = r.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
+ // Тип события живёт между порциями: сеть режет «event: text\n» и «data: …» по разным
+ // чтениям, и 10.09.2026 так молча пропал блок разбора сметы на 11 КБ.
+ let eventType = '';
while (true) {
const {done, value} = await reader.read();
@@ -1897,7 +1900,6 @@ async function runChat(text) {
const lines = buffer.split('\n');
buffer = lines.pop();
- let eventType = '';
for (const line of lines) {
if (line.startsWith('event: ')) {
eventType = line.slice(7);
@@ -1934,8 +1936,11 @@ async function runChat(text) {
addTyping().textContent = label;
} else if (eventType === 'done') {
removeTyping();
- // Always show final result if we haven't shown text yet
- if (!aiText && data.result) {
+ // Показанное короче итога — часть потока не дошла: ставим ответ целиком, тот же,
+ // что лёг в историю. Равные длины — норма, пузырь не трогаем.
+ if (data.result && data.result.length > aiText.length) {
+ if (aiDiv) aiDiv.remove();
+ aiText = data.result;
aiDiv = addMsg('ai', data.result);
}
} else if (eventType === 'spend') {