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;
|
||||
var toolDiv = document.createElement('div');
|
||||
toolDiv.className = 'tool-box' + (archived ? ' archived' : '');
|
||||
toolDiv.dataset.toolName = msg.toolName;
|
||||
renderToolBoxContent(toolDiv, msg.toolName, msg.content, null, false);
|
||||
fragment.appendChild(toolDiv);
|
||||
break;
|
||||
@@ -259,12 +260,17 @@ function _renderMessagesIntoFragment(fragment, msgs, imageMessageIds, opts) {
|
||||
if (msg._choiceHandled) continue;
|
||||
const prevBoxes = fragment.querySelectorAll('.tool-box');
|
||||
const lastToolBox = prevBoxes[prevBoxes.length - 1];
|
||||
if (lastToolBox && !lastToolBox.querySelector('.tool-result')) {
|
||||
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);
|
||||
if (lastToolBox && !lastToolBox.querySelector('.tool-result') && !lastToolBox.querySelector('.todo-list')) {
|
||||
// todo_write: nachträglich die Todo-Liste rendern (sichtbar)
|
||||
if (lastToolBox.dataset.toolName === 'todo_write') {
|
||||
lastToolBox.appendChild(buildTodoList(msg.content || '', msg.isError));
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user