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(cowork): skip image ingest on scoped surfaces

Akarshan Biswasc43210ac21cd
diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx
index acf67b0ad..d46beffd1 100644
--- a/web-app/src/containers/ChatInput.tsx
+++ b/web-app/src/containers/ChatInput.tsx
@@ -1273,7 +1273,10 @@ const ChatInput = memo(function ChatInput({
newFiles.length > 0 ? [...prev, ...newFiles] : prev
)
- if (currentThreadId && newFiles.length > 0) {
+ // Cowork keys attachments by session id (`scopeKey`) and sends them as
+ // data URLs on submit. Ingesting against a leftover chat `currentThreadId`
+ // can fail and strip the chip we just added.
+ if (!scopeKey && currentThreadId && newFiles.length > 0) {
const ingestTotal = newFiles.length
void (async () => {
setFileIngestProgress({ completed: 0, total: ingestTotal })
@@ -1362,7 +1365,7 @@ const ChatInput = memo(function ChatInput({
} else {
setMessage('')
}
- }, [attachmentsKey, currentThreadId, setAttachmentsForThread, serviceHub, setFileIngestProgress])
+ }, [attachmentsKey, currentThreadId, scopeKey, setAttachmentsForThread, serviceHub, setFileIngestProgress])
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const files = e.target.files