Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(web-app): let ChatInput take the async main-chat submit handler

thinhlpgcb3bb7716292
diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx
index 7f5e559e3..68bbc444e 100644
--- a/web-app/src/containers/ChatInput.tsx
+++ b/web-app/src/containers/ChatInput.tsx
@@ -125,7 +125,8 @@ type ChatInputProps = {
projectAssistantId?: string
/** Whether this surface applies assistant instructions and selection. */
supportsAssistants?: boolean
- /** Returning `'refused'` keeps the draft and attachments: nothing was sent. */
+ /** Returning `'refused'` keeps the draft and attachments: nothing was sent.
+ * An async handler (main chat) always clears them: it never refuses. */
onSubmit?: (
text: string,
files?: Array<{ type: 'file'; mediaType: string; url: string }>,
@@ -135,7 +136,7 @@ type ChatInputProps = {
/** What the user typed, before @path references were expanded into
* `text`, so a cancelled send can hand it back unchanged. */
draft?: string
- ) => void | 'refused'
+ ) => void | 'refused' | Promise<void>
onStop?: () => void
chatStatus?: ChatStatus
/**