mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-28 05:27:35 +00:00
refac
This commit is contained in:
parent
bc4c91e6d6
commit
f158f892f4
2 changed files with 31 additions and 15 deletions
|
|
@ -4034,13 +4034,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
const oauthRedirectHandler = async (tool: {
|
||||
id: string;
|
||||
serverId: string;
|
||||
authType?: string | null;
|
||||
}) => {
|
||||
const oauthRedirectHandler = async (
|
||||
tool: {
|
||||
id: string;
|
||||
serverId: string;
|
||||
authType?: string | null;
|
||||
},
|
||||
draft = getChatInputDraft()
|
||||
) => {
|
||||
await tick();
|
||||
saveSessionSelectedModels();
|
||||
await saveDraft(getChatInputDraft(), null, false);
|
||||
await saveDraft(draft, null, false);
|
||||
initiateOAuthRedirect(tool);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -179,11 +179,11 @@
|
|||
!($_user?.permissions?.chat?.temporary_enforced ?? false)));
|
||||
|
||||
export let prompt = '';
|
||||
export let files = [];
|
||||
export let files: any[] = [];
|
||||
|
||||
export let selectedToolIds = [];
|
||||
export let selectedSkillIds = [];
|
||||
export let selectedFilterIds = [];
|
||||
export let selectedToolIds: string[] = [];
|
||||
export let selectedSkillIds: string[] = [];
|
||||
export let selectedFilterIds: string[] = [];
|
||||
|
||||
export let imageGenerationEnabled = false;
|
||||
export let webSearchEnabled = false;
|
||||
|
|
@ -191,7 +191,12 @@
|
|||
export let toolApprovalMode = 'full';
|
||||
export let onToolApprovalModeChange: Function = () => {};
|
||||
|
||||
export let pendingOAuthTools = [];
|
||||
export let pendingOAuthTools: {
|
||||
id: string;
|
||||
name?: string;
|
||||
serverId: string;
|
||||
authType?: string | null;
|
||||
}[] = [];
|
||||
export let oauthRedirectHandler: Function = () => {};
|
||||
|
||||
let showTerminalMenu = false;
|
||||
|
|
@ -221,7 +226,8 @@
|
|||
integrationsMenuCloseOnOutsideClick = true;
|
||||
}
|
||||
|
||||
$: onChange({
|
||||
let chatInputDraft: any;
|
||||
$: chatInputDraft = {
|
||||
prompt,
|
||||
files: files
|
||||
.filter((file) => file.type !== 'image')
|
||||
|
|
@ -239,7 +245,9 @@
|
|||
webSearchEnabled,
|
||||
codeInterpreterEnabled,
|
||||
toolApprovalMode
|
||||
});
|
||||
};
|
||||
|
||||
$: onChange(chatInputDraft);
|
||||
|
||||
const inputVariableHandler = async (text: string): Promise<string> => {
|
||||
inputVariables = extractInputVariables(text);
|
||||
|
|
@ -2259,7 +2267,11 @@
|
|||
bind:webSearchEnabled
|
||||
bind:imageGenerationEnabled
|
||||
bind:codeInterpreterEnabled
|
||||
{oauthRedirectHandler}
|
||||
oauthRedirectHandler={(tool: {
|
||||
id: string;
|
||||
serverId: string;
|
||||
authType?: string | null;
|
||||
}) => oauthRedirectHandler(tool, chatInputDraft)}
|
||||
{onWebSearchToggle}
|
||||
closeOnOutsideClick={integrationsMenuCloseOnOutsideClick}
|
||||
onShowValves={(e) => {
|
||||
|
|
@ -2479,7 +2491,7 @@
|
|||
<Tooltip content={$i18n.t('Click to connect')} placement="top">
|
||||
<button
|
||||
on:click|preventDefault={() => {
|
||||
oauthRedirectHandler(pendingTool);
|
||||
oauthRedirectHandler(pendingTool, chatInputDraft);
|
||||
}}
|
||||
type="button"
|
||||
class="group px-2 py-[0.3125rem] flex gap-1.5 items-center text-xs rounded-full transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue