mirror of
https://github.com/open-webui/computer.git
synced 2026-12-02 01:42:55 -05:00
refac
This commit is contained in:
1 parent
e7afb6cba3
commit
e68ece23ea
4 files changed
+42
-5
No files matched your search
@@ -95,6 +95,7 @@
|
||||
onqueueedit?: (id: string) => void;
|
||||
onqueuedelete?: (id: string) => void;
|
||||
onsettingschange?: () => void;
|
||||
ontoolapprovalchange?: (mode: ToolApprovalMode) => void;
|
||||
}
|
||||
let {
|
||||
inputText = $bindable(),
|
||||
@@ -123,7 +124,8 @@
|
||||
onqueuesendnow,
|
||||
onqueueedit,
|
||||
onqueuedelete,
|
||||
onsettingschange
|
||||
onsettingschange,
|
||||
ontoolapprovalchange
|
||||
}: Props = $props();
|
||||
|
||||
let editorEl: HTMLDivElement | undefined = $state();
|
||||
@@ -1507,6 +1509,7 @@
|
||||
bind:planMode
|
||||
bind:requestParams
|
||||
onchange={onsettingschange}
|
||||
{ontoolapprovalchange}
|
||||
onfiles={(files) => {
|
||||
if (files) processFiles(Array.from(files));
|
||||
}}
|
||||
|
||||
@@ -35,7 +35,13 @@
|
||||
import { socketStore } from '$lib/stores/socket.svelte';
|
||||
import { onMount, onDestroy, tick } from 'svelte';
|
||||
import { get } from 'svelte/store';
|
||||
import { currentWorkspace, openChatTab, streamingBehavior, widescreenMode } from '$lib/stores';
|
||||
import {
|
||||
currentWorkspace,
|
||||
openChatTab,
|
||||
streamingBehavior,
|
||||
toolApprovalMode as defaultToolApprovalMode,
|
||||
widescreenMode
|
||||
} from '$lib/stores';
|
||||
import { getPathDisplayName } from '$lib/utils/paths';
|
||||
import {
|
||||
ttsEnabled,
|
||||
@@ -663,7 +669,7 @@
|
||||
const dm = get(defaultModel);
|
||||
if (dm) selectedModel = dm;
|
||||
else if (models.length) selectedModel = models[0].id;
|
||||
toolApprovalMode = 'auto';
|
||||
toolApprovalMode = get(defaultToolApprovalMode);
|
||||
planMode = false;
|
||||
requestParams = {};
|
||||
voiceModeEnabled = false;
|
||||
@@ -1062,6 +1068,12 @@
|
||||
persistChatSettings();
|
||||
}
|
||||
|
||||
function handleToolApprovalModeChange(mode: ToolApprovalMode) {
|
||||
toolApprovalMode = mode;
|
||||
defaultToolApprovalMode.set(mode);
|
||||
persistChatSettings();
|
||||
}
|
||||
|
||||
function firstUserMessageTitle(): string {
|
||||
const message = allMessages.find((m) => m.role === 'user' && !isPendingHiddenMessage(m));
|
||||
return message ? message.content.replace(/\s+/g, ' ').trim().slice(0, 80) : '';
|
||||
@@ -1705,6 +1717,7 @@
|
||||
onsend={send}
|
||||
onplan={handlePlanCommand}
|
||||
onsettingschange={persistChatSettings}
|
||||
ontoolapprovalchange={handleToolApprovalModeChange}
|
||||
{queuedMessages}
|
||||
onqueuesendnow={handleQueueSendNow}
|
||||
onqueueedit={handleQueueEdit}
|
||||
@@ -1834,6 +1847,7 @@
|
||||
onfork={handleForkChat}
|
||||
onplan={handlePlanCommand}
|
||||
onsettingschange={persistChatSettings}
|
||||
ontoolapprovalchange={handleToolApprovalModeChange}
|
||||
onstatus={handleStatusCommand}
|
||||
onskillslist={handleSkillsListCommand}
|
||||
oncancel={handleCancel}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
planMode?: boolean;
|
||||
requestParams?: Record<string, unknown>;
|
||||
onchange?: () => void;
|
||||
ontoolapprovalchange?: (mode: ToolApprovalMode) => void;
|
||||
}
|
||||
let {
|
||||
onfiles,
|
||||
@@ -20,7 +21,8 @@
|
||||
toolApprovalMode = $bindable('auto'),
|
||||
planMode = $bindable(false),
|
||||
requestParams = $bindable({}),
|
||||
onchange
|
||||
onchange,
|
||||
ontoolapprovalchange
|
||||
}: Props = $props();
|
||||
|
||||
let open = $state(false);
|
||||
@@ -108,7 +110,8 @@
|
||||
|
||||
function selectMode(mode: ToolApprovalMode) {
|
||||
toolApprovalMode = mode;
|
||||
onchange?.();
|
||||
if (ontoolapprovalchange) ontoolapprovalchange(mode);
|
||||
else onchange?.();
|
||||
}
|
||||
|
||||
function triggerUpload() {
|
||||
|
||||
Reference in new issue
Block a user