This commit is contained in:
Timothy Jaeryang Baek 2026-08-25 15:14:11 -04:00
parent bc4c91e6d6
commit f158f892f4
2 changed files with 31 additions and 15 deletions

View file

@ -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);
};

View file

@ -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