fix: todo_write Ergebnisse nach History-Load/Poll sichtbar rendern
tool_use case setzt jetzt dataset.toolName auf das DOM-Element. tool_result case erkennt todo_write und ruft buildTodoList() auf statt ein hidden text-div anzuhängen.
This commit is contained in:
1 parent
1e7b68fb09
commit
e81983cab6
1 file changed
+12
-6
+12
-6
@@ -240,6 +240,7 @@ function _renderMessagesIntoFragment(fragment, msgs, imageMessageIds, opts) {
|
|||||||
if (!isToolVisible(msg.toolName)) continue;
|
if (!isToolVisible(msg.toolName)) continue;
|
||||||
var toolDiv = document.createElement('div');
|
var toolDiv = document.createElement('div');
|
||||||
toolDiv.className = 'tool-box' + (archived ? ' archived' : '');
|
toolDiv.className = 'tool-box' + (archived ? ' archived' : '');
|
||||||
|
toolDiv.dataset.toolName = msg.toolName;
|
||||||
renderToolBoxContent(toolDiv, msg.toolName, msg.content, null, false);
|
renderToolBoxContent(toolDiv, msg.toolName, msg.content, null, false);
|
||||||
fragment.appendChild(toolDiv);
|
fragment.appendChild(toolDiv);
|
||||||
break;
|
break;
|
||||||
@@ -259,12 +260,17 @@ function _renderMessagesIntoFragment(fragment, msgs, imageMessageIds, opts) {
|
|||||||
if (msg._choiceHandled) continue;
|
if (msg._choiceHandled) continue;
|
||||||
const prevBoxes = fragment.querySelectorAll('.tool-box');
|
const prevBoxes = fragment.querySelectorAll('.tool-box');
|
||||||
const lastToolBox = prevBoxes[prevBoxes.length - 1];
|
const lastToolBox = prevBoxes[prevBoxes.length - 1];
|
||||||
if (lastToolBox && !lastToolBox.querySelector('.tool-result')) {
|
if (lastToolBox && !lastToolBox.querySelector('.tool-result') && !lastToolBox.querySelector('.todo-list')) {
|
||||||
const rd = document.createElement('div');
|
// todo_write: nachträglich die Todo-Liste rendern (sichtbar)
|
||||||
rd.className = 'tool-result' + (msg.isError ? ' tool-error' : '');
|
if (lastToolBox.dataset.toolName === 'todo_write') {
|
||||||
rd.textContent = truncate(msg.content || '', 300);
|
lastToolBox.appendChild(buildTodoList(msg.content || '', msg.isError));
|
||||||
rd.hidden = true;
|
} else {
|
||||||
lastToolBox.appendChild(rd);
|
const rd = document.createElement('div');
|
||||||
|
rd.className = 'tool-result' + (msg.isError ? ' tool-error' : '');
|
||||||
|
rd.textContent = truncate(msg.content || '', 300);
|
||||||
|
rd.hidden = true;
|
||||||
|
lastToolBox.appendChild(rd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user