fix: streaming tool_use + скрытие сырого кода от пользователя
- readline вместо async for — убирает буферизацию stdout
- tool events показывают статус ("Читаю файл..."), не сырой Python-код
- done event как fallback для финального ответа
- tab_id для изоляции сессий между вкладками
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+8
-3
@@ -280,12 +280,17 @@ async function sendMessage() {
|
||||
aiDiv.textContent = aiText;
|
||||
msgs.scrollTop = msgs.scrollHeight;
|
||||
} else if (eventType === 'tool') {
|
||||
addMsg('tool', '🔧 ' + data.tool + (data.input.command ? ': ' + data.input.command : data.input.file_path ? ': ' + data.input.file_path : ''));
|
||||
// Show minimal status, not raw code
|
||||
const toolNames = {Bash: 'Выполняю...', Read: 'Читаю файл...', Write: 'Создаю файл...', Edit: 'Редактирую...', Glob: 'Ищу файлы...', Grep: 'Ищу в файлах...'};
|
||||
const label = toolNames[data.tool] || 'Обрабатываю...';
|
||||
removeTyping();
|
||||
addTyping().textContent = label;
|
||||
} else if (eventType === 'done') {
|
||||
if (!aiDiv && data.result) {
|
||||
removeTyping();
|
||||
// Always show final result if we haven't shown text yet
|
||||
if (!aiText && data.result) {
|
||||
aiDiv = addMsg('ai', data.result);
|
||||
}
|
||||
// cost info hidden from user
|
||||
}
|
||||
eventType = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user