This commit is contained in:
Timothy Jaeryang Baek
2026-03-01 12:30:03 -06:00
parent 769ef856bc
commit 18865a9fef
5 changed files with 81 additions and 32 deletions
+13 -5
View File
@@ -44,7 +44,8 @@
pinnedChats,
showEmbeds,
selectedTerminalId,
showFileNavPath
showFileNavPath,
showFileNavDir
} from '$lib/stores';
import { WEBUI_API_BASE_URL } from '$lib/constants';
@@ -446,6 +447,15 @@
saveChatHandler(_chatId, history);
};
const terminalEventHandler = (type: string, data: any) => {
if (!data?.path) return;
if (type === 'terminal:display_file') {
displayFileHandler(data.path, { showControls, showFileNavPath });
} else if (type === 'terminal:write_file' || type === 'terminal:replace_file_content') {
showFileNavDir.set(data.path);
}
};
const chatEventHandler = async (event, cb) => {
console.log(event);
@@ -579,10 +589,8 @@
eventConfirmationInputPlaceholder = data.placeholder;
eventConfirmationInputValue = data?.value ?? '';
eventConfirmationInputType = data?.type ?? '';
} else if (type === 'display_file') {
if (data?.path) {
displayFileHandler(data.path, { showControls, showFileNavPath });
}
} else if (type.startsWith('terminal:')) {
terminalEventHandler(type, data);
} else {
console.log('Unknown message type', data);
}