refac
This commit is contained in:
1 parent
bc4c91e6d6
commit
f158f892f4
2 files changed
+31
-15
No files matched your search
@@ -4034,13 +4034,17 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const oauthRedirectHandler = async (tool: {
|
const oauthRedirectHandler = async (
|
||||||
id: string;
|
tool: {
|
||||||
serverId: string;
|
id: string;
|
||||||
authType?: string | null;
|
serverId: string;
|
||||||
}) => {
|
authType?: string | null;
|
||||||
|
},
|
||||||
|
draft = getChatInputDraft()
|
||||||
|
) => {
|
||||||
|
await tick();
|
||||||
saveSessionSelectedModels();
|
saveSessionSelectedModels();
|
||||||
await saveDraft(getChatInputDraft(), null, false);
|
await saveDraft(draft, null, false);
|
||||||
initiateOAuthRedirect(tool);
|
initiateOAuthRedirect(tool);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -179,11 +179,11 @@
|
|||||||
!($_user?.permissions?.chat?.temporary_enforced ?? false)));
|
!($_user?.permissions?.chat?.temporary_enforced ?? false)));
|
||||||
|
|
||||||
export let prompt = '';
|
export let prompt = '';
|
||||||
export let files = [];
|
export let files: any[] = [];
|
||||||
|
|
||||||
export let selectedToolIds = [];
|
export let selectedToolIds: string[] = [];
|
||||||
export let selectedSkillIds = [];
|
export let selectedSkillIds: string[] = [];
|
||||||
export let selectedFilterIds = [];
|
export let selectedFilterIds: string[] = [];
|
||||||
|
|
||||||
export let imageGenerationEnabled = false;
|
export let imageGenerationEnabled = false;
|
||||||
export let webSearchEnabled = false;
|
export let webSearchEnabled = false;
|
||||||
@@ -191,7 +191,12 @@
|
|||||||
export let toolApprovalMode = 'full';
|
export let toolApprovalMode = 'full';
|
||||||
export let onToolApprovalModeChange: Function = () => {};
|
export let onToolApprovalModeChange: Function = () => {};
|
||||||
|
|
||||||
export let pendingOAuthTools = [];
|
export let pendingOAuthTools: {
|
||||||
|
id: string;
|
||||||
|
name?: string;
|
||||||
|
serverId: string;
|
||||||
|
authType?: string | null;
|
||||||
|
}[] = [];
|
||||||
export let oauthRedirectHandler: Function = () => {};
|
export let oauthRedirectHandler: Function = () => {};
|
||||||
|
|
||||||
let showTerminalMenu = false;
|
let showTerminalMenu = false;
|
||||||
@@ -221,7 +226,8 @@
|
|||||||
integrationsMenuCloseOnOutsideClick = true;
|
integrationsMenuCloseOnOutsideClick = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$: onChange({
|
let chatInputDraft: any;
|
||||||
|
$: chatInputDraft = {
|
||||||
prompt,
|
prompt,
|
||||||
files: files
|
files: files
|
||||||
.filter((file) => file.type !== 'image')
|
.filter((file) => file.type !== 'image')
|
||||||
@@ -239,7 +245,9 @@
|
|||||||
webSearchEnabled,
|
webSearchEnabled,
|
||||||
codeInterpreterEnabled,
|
codeInterpreterEnabled,
|
||||||
toolApprovalMode
|
toolApprovalMode
|
||||||
});
|
};
|
||||||
|
|
||||||
|
$: onChange(chatInputDraft);
|
||||||
|
|
||||||
const inputVariableHandler = async (text: string): Promise<string> => {
|
const inputVariableHandler = async (text: string): Promise<string> => {
|
||||||
inputVariables = extractInputVariables(text);
|
inputVariables = extractInputVariables(text);
|
||||||
@@ -2259,7 +2267,11 @@
|
|||||||
bind:webSearchEnabled
|
bind:webSearchEnabled
|
||||||
bind:imageGenerationEnabled
|
bind:imageGenerationEnabled
|
||||||
bind:codeInterpreterEnabled
|
bind:codeInterpreterEnabled
|
||||||
{oauthRedirectHandler}
|
oauthRedirectHandler={(tool: {
|
||||||
|
id: string;
|
||||||
|
serverId: string;
|
||||||
|
authType?: string | null;
|
||||||
|
}) => oauthRedirectHandler(tool, chatInputDraft)}
|
||||||
{onWebSearchToggle}
|
{onWebSearchToggle}
|
||||||
closeOnOutsideClick={integrationsMenuCloseOnOutsideClick}
|
closeOnOutsideClick={integrationsMenuCloseOnOutsideClick}
|
||||||
onShowValves={(e) => {
|
onShowValves={(e) => {
|
||||||
@@ -2479,7 +2491,7 @@
|
|||||||
<Tooltip content={$i18n.t('Click to connect')} placement="top">
|
<Tooltip content={$i18n.t('Click to connect')} placement="top">
|
||||||
<button
|
<button
|
||||||
on:click|preventDefault={() => {
|
on:click|preventDefault={() => {
|
||||||
oauthRedirectHandler(pendingTool);
|
oauthRedirectHandler(pendingTool, chatInputDraft);
|
||||||
}}
|
}}
|
||||||
type="button"
|
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
|
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
|
||||||
|
|||||||
Reference in new issue
Block a user