This commit is contained in:
Timothy Jaeryang Baek committed 2026-08-05 07:12:28 -05:00
1 parent 9c7ce154e7
commit 29eeda9f9a
6 files changed
+205 -13

No files matched your search

+47 -4
View File
@@ -2586,14 +2586,44 @@
const message = error?.detail ?? error?.message ?? $i18n.t('Context compaction failed');
toast.error(message, { id: toastId });
} finally {
messageInput?.setText('');
prompt = '';
document.getElementById('chat-input')?.focus();
}
};
const handleStatusCommand = () => {
messageInput?.showStatus();
document.getElementById('chat-input')?.focus();
};
const handleModelCommand = (modelId = '') => {
if (!modelId) {
const currentModels = (atSelectedModel?.id ? [atSelectedModel.id] : selectedModels).filter(
Boolean
);
toast.message(
currentModels.length
? `Current model: ${currentModels.join(', ')}`
: $i18n.t('Model not selected')
);
messageInput?.setText('');
prompt = '';
document.getElementById('chat-input')?.focus();
return;
}
const model = $models.find((model) => model.id === modelId);
if (!model) {
toast.error(`Model not found: ${modelId}`);
messageInput?.setText('');
prompt = '';
document.getElementById('chat-input')?.focus();
return;
}
atSelectedModel = undefined;
selectedModels = [model.id];
saveSessionSelectedModels();
toast.success(`Model switched to: ${model.id}`);
messageInput?.setText('');
prompt = '';
document.getElementById('chat-input')?.focus();
@@ -2640,12 +2670,15 @@
} catch (error) {
toast.error(`${error}`, { id: toastId });
} finally {
messageInput?.setText('');
prompt = '';
document.getElementById('chat-input')?.focus();
}
};
const clearCommandInput = () => {
messageInput?.setText('');
prompt = '';
};
const submitHandler = async (userPrompt, { _raw = false } = {}) => {
console.log('submitHandler', userPrompt, $chatId);
@@ -2658,17 +2691,27 @@
}
if (String(userPrompt).trim() === '/compact') {
clearCommandInput();
await handleManualCompact();
return;
}
if (String(userPrompt).trim() === '/status') {
clearCommandInput();
handleStatusCommand();
return;
}
if (String(userPrompt).trim() === '/fork') {
clearCommandInput();
await handleForkChat();
return;
}
const modelCommandMatch = String(userPrompt)
.trim()
.match(/^\/model(?:\s+([\s\S]+))?$/);
if (modelCommandMatch) {
handleModelCommand(modelCommandMatch[1]?.trim() ?? '');
return;
}
if (pendingOAuthTools.length > 0) {
toast.warning($i18n.t('Please connect all required integrations before sending a message'));