Merge pull request #22 from southseact-3d/codex/show-undo-and-redo-buttons-with-zero-output
Show builder undo/redo controls when message has zero output
This commit is contained in:
@@ -1984,7 +1984,12 @@ function renderMessages(session) {
|
|||||||
}
|
}
|
||||||
el.chatArea.appendChild(userCard);
|
el.chatArea.appendChild(userCard);
|
||||||
|
|
||||||
if (msg.reply || msg.error || (status === 'running' && msg.partialOutput)) {
|
const isOpencodeMsg = msg.cli === 'opencode' || msg.phase === 'build';
|
||||||
|
const isLatestMessage = latestMessage && latestMessage.id === msg.id;
|
||||||
|
const shouldShowUndoRedo = isOpencodeMsg && isLatestMessage && (status === 'done' || status === 'error' || status === 'cancelled');
|
||||||
|
const shouldRenderAssistantCard = msg.reply || msg.error || (status === 'running' && msg.partialOutput) || shouldShowUndoRedo;
|
||||||
|
|
||||||
|
if (shouldRenderAssistantCard) {
|
||||||
console.log('[RenderMessages] Creating assistant card for message:', {
|
console.log('[RenderMessages] Creating assistant card for message:', {
|
||||||
id: msg.id,
|
id: msg.id,
|
||||||
cli: msg.cli,
|
cli: msg.cli,
|
||||||
@@ -2015,10 +2020,6 @@ function renderMessages(session) {
|
|||||||
assistantMeta.appendChild(rawBtn);
|
assistantMeta.appendChild(rawBtn);
|
||||||
|
|
||||||
// Add Undo/Redo buttons - show for latest message when done, errored, or cancelled
|
// Add Undo/Redo buttons - show for latest message when done, errored, or cancelled
|
||||||
const isOpencodeMsg = msg.cli === 'opencode' || msg.phase === 'build';
|
|
||||||
const isLatestMessage = latestMessage && latestMessage.id === msg.id;
|
|
||||||
const shouldShowUndoRedo = isOpencodeMsg && isLatestMessage && (status === 'done' || status === 'error' || status === 'cancelled');
|
|
||||||
|
|
||||||
if (shouldShowUndoRedo) {
|
if (shouldShowUndoRedo) {
|
||||||
const undoBtn = document.createElement('button');
|
const undoBtn = document.createElement('button');
|
||||||
undoBtn.className = 'ghost';
|
undoBtn.className = 'ghost';
|
||||||
|
|||||||
Reference in New Issue
Block a user