diff --git a/ui/src/ui/app-chat.ts b/ui/src/ui/app-chat.ts index 3347aade8fd..d9d8dc1c525 100644 --- a/ui/src/ui/app-chat.ts +++ b/ui/src/ui/app-chat.ts @@ -325,7 +325,7 @@ function waitForPendingChatModelSwitch( if (!pending) { return true; } - return pending.then((ok) => ok !== false); + return pending; } function clearSubmittedComposerState( @@ -341,7 +341,7 @@ function clearSubmittedComposerState( host.chatAttachments.every( (attachment, index) => attachmentSubmitSignature(attachment) === - attachmentSubmitSignature(submittedAttachments[index]!), + attachmentSubmitSignature(submittedAttachments[index]), ); const clearedDraft = host.chatMessage === submittedDraft && attachmentsUnchanged; const clearedAttachments = clearedDraft; diff --git a/ui/src/ui/chat/session-controls.ts b/ui/src/ui/chat/session-controls.ts index 129eae230e5..27604693882 100644 --- a/ui/src/ui/chat/session-controls.ts +++ b/ui/src/ui/chat/session-controls.ts @@ -350,7 +350,7 @@ async function switchChatModel(state: AppViewState, nextModel: string): Promise< let switchPromise: Promise; const clearPendingSwitch = () => { if (state.chatModelSwitchPromises?.[targetSessionKey] === switchPromise) { - const nextSwitches = { ...(state.chatModelSwitchPromises ?? {}) }; + const nextSwitches = { ...state.chatModelSwitchPromises }; delete nextSwitches[targetSessionKey]; state.chatModelSwitchPromises = nextSwitches; } @@ -374,7 +374,7 @@ async function switchChatModel(state: AppViewState, nextModel: string): Promise< } })(); state.chatModelSwitchPromises = { - ...(state.chatModelSwitchPromises ?? {}), + ...state.chatModelSwitchPromises, [targetSessionKey]: switchPromise, }; return switchPromise;