Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cff5b89
feat(chat): extract text from document attachments and infer image MI…
GTanger Oct 27, 2026
326ede3
fix(chat): address document extraction review feedback for budgets, X…
GTanger Oct 27, 2026
e01d571
fix(chat-attachments): support attribute-less xlsx rows and odf repea…
GTanger Oct 27, 2026
e714d72
fix(chat-attachments): bound ODF output size before table construction
GTanger Oct 27, 2026
1308735
fix(chat-attachments): bound XLSX output size and recheck aggregate b…
GTanger Oct 27, 2026
9ac8858
fix(chat-attachments): avoid double counting cell bytes in extractXls…
GTanger Oct 27, 2026
7740205
feat(chat-attachments): sort PDF text runs by (Y, X) coordinates and …
GTanger Oct 30, 2026
36a9801
fix(chat-attachments): return previous run X from flushRun for strict…
GTanger Oct 30, 2026
0baaa52
Merge remote-tracking branch 'upstream/main' into feat/document-attac…
GTanger Nov 2, 2026
85aa5af
Merge upstream/main into feat/document-attachment-extraction
GTanger Nov 6, 2026
e4b13ea
fix(test): close test block in ChatInput.queue-attachments.test.mjs
GTanger Nov 6, 2026
79d4bcd
Merge remote-tracking branch 'upstream/main' into feat/document-attac…
GTanger Nov 7, 2026
75eec7b
Merge remote-tracking branch 'upstream/main' into feat/document-attac…
GTanger Nov 7, 2026
5f7f794
Merge remote-tracking branch 'upstream/main' into feat/document-attac…
GTanger Nov 7, 2026
4e446c4
fix(chat): bound XML/XLSX/PDF parsers and preserve As-file uploads fo…
GTanger Nov 7, 2026
c49fbc4
fix(chat): remove unused variables in walkXml document parsers
GTanger Nov 7, 2026
e10d762
Merge remote-tracking branch 'upstream/main' into feat/document-attac…
GTanger Nov 9, 2026
72e3cc2
fix(chat): address review feedback for document attachment extraction
GTanger Nov 9, 2026
fb7fb17
fix(chat): bound remaining document scanners and preserve attachment …
GTanger Nov 9, 2026
e9dfa21
Merge remote-tracking branch 'upstream/main' into feat/document-attac…
GTanger Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions components/ChatInput-draft-attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,43 @@ export function draftImagesToAttachedImages(images: ChatDraftImage[] | undefined
}

export function textFileToDraftFile(file: AttachedTextFile): ChatDraftFile {
return { name: file.name, mimeType: file.mimeType, content: file.content, size: file.size };
return {
name: file.name,
mimeType: file.mimeType,
content: file.content,
size: file.size,
...(file.uploadId ? { uploadId: file.uploadId } : {}),
};
}

export function attachedTextFilesToDraftFiles(
files: AttachedTextFile[],
uploads: Array<{ id: string; status: string }>,
): ChatDraftFile[] {
const doneUploadIds = new Set(uploads.filter((upload) => upload.status === "done").map((upload) => upload.id));
return files
.filter((file) => !file.uploadId || doneUploadIds.has(file.uploadId))
.map(textFileToDraftFile);
}

/** Recovery and Edit relocation can merge individually valid drafts past picker
* budgets. Keep every well-formed file; sending validates the composed request,
* not the picker file-count or text-byte limits. */
export function draftFilesToAttachedFiles(files: ChatDraftFile[] | undefined): AttachedTextFile[] {
return (files ?? []).filter((file) => file !== null && typeof file === "object"
&& typeof file.name === "string"
&& typeof file.mimeType === "string"
&& typeof file.content === "string"
&& Number.isFinite(file.size)
&& file.size >= 0);
return (files ?? [])
.filter((file) => file !== null && typeof file === "object"
&& typeof file.name === "string"
&& typeof file.mimeType === "string"
&& typeof file.content === "string"
&& Number.isFinite(file.size)
&& file.size >= 0)
.map((file) => ({
name: file.name,
mimeType: file.mimeType,
content: file.content,
size: file.size,
...(file.uploadId ? { uploadId: file.uploadId } : {}),
}));
}

export function revokeImagePreview(image: AttachedImage): void {
Expand Down
Loading
Loading