mirror of
https://github.com/open-webui/computer.git
synced 2026-11-22 21:50:43 -05:00
refac
This commit is contained in:
1 parent
2d0f6fc9c8
commit
f634471053
3 files changed
+50
-8
No files matched your search
@@ -142,6 +142,7 @@
|
||||
let voiceCaptureChunks: Blob[] = [];
|
||||
let voiceCaptureMimeType = 'audio/webm';
|
||||
let selectedSlashCommandIndex = $state(0);
|
||||
let modelSelector: ModelSelector | undefined = $state();
|
||||
const voiceModeAvailable = $derived(
|
||||
$ttsEnabled && $ttsConfigured && ($voiceModeSttMode === 'browser' || $sttConfigured)
|
||||
);
|
||||
@@ -979,6 +980,7 @@
|
||||
if (onplan && '/plan'.startsWith(slashCommandQuery)) ids.push('plan');
|
||||
if (hasChatContent && onfork && '/fork'.startsWith(slashCommandQuery)) ids.push('fork');
|
||||
if (hasChatContent && onstatus && '/status'.startsWith(slashCommandQuery)) ids.push('status');
|
||||
if ('/model'.startsWith(slashCommandQuery)) ids.push('model');
|
||||
if (
|
||||
hasChatContent &&
|
||||
onskillslist &&
|
||||
@@ -1093,6 +1095,11 @@
|
||||
onstatus();
|
||||
return;
|
||||
}
|
||||
if (commandId === 'model') {
|
||||
inputText = '';
|
||||
void modelSelector?.openSelector();
|
||||
return;
|
||||
}
|
||||
if (commandId === 'skills:list' && onskillslist) {
|
||||
inputText = '';
|
||||
onskillslist();
|
||||
@@ -1331,6 +1338,31 @@
|
||||
</span>
|
||||
</button>
|
||||
{/if}
|
||||
{#if slashCommandIds.includes('model')}
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`${$t('chat.commandModel')}: ${$t('chat.commandModelDesc')}`}
|
||||
use:tooltip={{
|
||||
content: $t('chat.commandModelDesc'),
|
||||
placement: 'top'
|
||||
}}
|
||||
class="slash-command-row flex items-center gap-2 w-full h-6 px-2 rounded-xl text-xs text-left transition-colors duration-75
|
||||
{selectedSlashCommand('model') ? 'app-interactive-active' : ''}"
|
||||
onmousedown={(e) => e.preventDefault()}
|
||||
onclick={() => {
|
||||
runSlashCommand('model');
|
||||
}}
|
||||
onmouseenter={() => selectSlashCommand('model')}
|
||||
>
|
||||
<span class="app-icon-muted flex items-center justify-center w-4 shrink-0">
|
||||
<Icon name="spark" size={13} strokeWidth={1.7} />
|
||||
</span>
|
||||
<span class="flex-1 min-w-0 flex items-baseline gap-1.5 overflow-hidden">
|
||||
<span class="truncate">{$t('chat.commandModel')}</span>
|
||||
<span class="app-muted text-[0.625rem] truncate shrink-0">/model</span>
|
||||
</span>
|
||||
</button>
|
||||
{/if}
|
||||
{#if slashCommandIds.includes('skills:list')}
|
||||
<button
|
||||
type="button"
|
||||
@@ -1557,7 +1589,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="self-end mr-1 flex items-center gap-2">
|
||||
<ModelSelector bind:selectedModel onchange={onsettingschange} />
|
||||
<ModelSelector bind:this={modelSelector} bind:selectedModel onchange={onsettingschange} />
|
||||
<DictateButton
|
||||
ontext={(text) => {
|
||||
inputText += text;
|
||||
|
||||
@@ -76,18 +76,26 @@
|
||||
};
|
||||
});
|
||||
|
||||
async function toggle() {
|
||||
async function focusSearchInput() {
|
||||
await tick();
|
||||
await tick();
|
||||
searchInputEl?.focus();
|
||||
searchInputEl?.select();
|
||||
}
|
||||
|
||||
export async function openSelector() {
|
||||
if ($chatModels.length === 0 && !nullable) return;
|
||||
open = true;
|
||||
search = '';
|
||||
await focusSearchInput();
|
||||
}
|
||||
|
||||
async function toggle() {
|
||||
if (open) {
|
||||
open = false;
|
||||
return;
|
||||
}
|
||||
open = true;
|
||||
search = '';
|
||||
await tick();
|
||||
// Focus search after DropdownMenu renders
|
||||
await tick();
|
||||
searchInputEl?.focus();
|
||||
await openSelector();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -773,6 +773,8 @@
|
||||
"chat.commandForkDesc": "Clone chat",
|
||||
"chat.commandStatus": "Status",
|
||||
"chat.commandStatusDesc": "Context usage, chat id",
|
||||
"chat.commandModel": "Model",
|
||||
"chat.commandModelDesc": "Open model selector",
|
||||
"chat.statusContextUsage": "Context usage",
|
||||
"chat.statusEstimated": "Estimated context",
|
||||
"chat.statusChatId": "Chat id",
|
||||
|
||||
Reference in new issue
Block a user