Skip to content

Conversation

@dinhlongviolin1
Copy link
Contributor

@dinhlongviolin1 dinhlongviolin1 commented Dec 1, 2025

Describe Your Changes

  • Attachment can now be injected directly in chat
  • 4 modes (Auto, Include in chat, Ingest as embeddings, Ask every time)
  • Auto: for Local (llamacpp), there is a threshold option so that the file with be injected directly into chat if doest use up the amount of context available (75% default). Otherwise will be using embeddings. for Remote, always need to select what type of ingestion they want (embeddings or inject into chat) since no ctx size to do token estimation.
  • Fix bug issue with new chat file attachments (now works properly similar to when thread has been created beforehand).

Settings page

image

Auto mode Llama.cpp

image image image

Dialog showing selection options

image

With multiple files

image

Fixes Issues

  • Closes #
  • Closes #

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Copilot AI review requested due to automatic review settings December 1, 2025 19:17
Copilot finished reviewing on behalf of dinhlongviolin1 December 1, 2025 19:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements a comprehensive file attachment system with multiple ingestion modes, allowing users to choose how documents are processed in chat conversations. The feature supports automatic, inline injection, embeddings-based indexing, and per-file prompting modes, with special handling for local models that can estimate context usage.

Key Changes:

  • Added four attachment processing modes: Auto (with context threshold), Include in chat (inline injection), Ingest as embeddings (RAG), and Ask every time (prompt per file)
  • Implemented intelligent context estimation for local models to automatically decide between inline injection and embeddings based on available context
  • Created a centralized attachment processing library that handles both images and documents with proper error handling and status updates

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
web-app/src/lib/attachmentProcessing.ts New centralized attachment processing logic with support for inline and embedding modes
web-app/src/hooks/useChatAttachments.ts New Zustand store for managing attachments per thread with transfer functionality
web-app/src/hooks/useAttachmentIngestionPrompt.ts New hook for showing modal dialog to prompt user for ingestion mode choice
web-app/src/containers/dialogs/AttachmentIngestionDialog.tsx New dialog component for attachment ingestion mode selection
web-app/src/lib/messages.ts Updated to inject inline file contents into chat completion messages
web-app/src/lib/completion.ts Modified to include inline documents in message metadata
web-app/src/hooks/useChat.ts Refactored to use centralized attachment processing with context estimation
web-app/src/containers/ChatInput.tsx Updated to use new attachment store and process documents with mode selection
web-app/src/containers/ThreadContent.tsx Enhanced to display attachment indicators and allow viewing inline content
web-app/src/routes/settings/attachments.tsx Added new settings for parse mode and auto-inline threshold
web-app/src/hooks/useAttachments.ts Added parseMode and autoInlineContextRatio settings
extensions/rag-extension/src/index.ts Implemented parseDocument method for text extraction
extensions/rag-extension/settings.json Added new settings UI for parse mode and auto-inline threshold
extensions/llamacpp-extension/src/index.ts Enhanced embed function to handle large documents with dynamic ubatch sizing and chunk aggregation
web-app/src/locales/*/common.json Added translation strings for attachment indicators and dialog (incomplete translations)
web-app/src/locales/*/settings.json Added translation strings for new attachment settings
web-app/package.json Updated @tanstack/react-router from 1.117.0 to ^1.121.34
yarn.lock Updated dependencies for react-router and related packages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

Barecheck - Code coverage report

Total: 29.82%

Your code coverage diff: -0.08% ▾

Uncovered files and lines
FileLines
core/src/browser/extensions/rag.ts25-26
web-app/src/containers/ChatInput.tsx133, 187-189, 194-198, 201-203, 206, 208-214, 216-219, 221-232, 234-235, 248-249, 251-253, 270-272, 274-275, 277-279, 295-296, 300-303, 317-318, 323-324, 330-331, 338-341, 346-348, 356, 358-375, 377-385, 387-395, 397-402, 404-413, 416, 418, 420-424, 426, 428-437, 440-444, 446-480, 482-494, 496-505, 507-515, 533-565, 568-588, 590-591, 593-598, 600-601, 603-609, 611-614, 616-620, 622-630, 633, 636-641, 643-654, 656-659, 662-672, 675-684, 687-689, 691-692, 695, 697-700, 703-704, 707-710, 712-713, 716-719, 721-740, 742-743, 745-748, 750-751, 753-759, 761-765, 767-770, 772-778, 780-782, 784, 786-802, 804-814, 817-821, 823-828, 830-834, 836-837, 839-845, 848, 850-851, 854-857, 859-862, 865-875, 877-879, 881-882, 884-885, 888-891, 893-902, 904-913, 915-921, 923-926, 928-930, 933-934, 936-939, 942-943, 946-950, 953-954, 956-959, 962-964, 967-969, 972-975, 977-978, 980-984, 986-988, 992-994, 997-1000, 1002-1003, 1005-1006, 1008-1013, 1016-1022, 1024-1028, 1031, 1033-1037, 1040-1047, 1049-1052, 1054-1056, 1058-1069, 1071-1077, 1079-1085, 1088-1091, 1093, 1129-1139, 1141-1148, 1151-1156, 1158-1163, 1165, 1169-1175, 1179-1187, 1189-1195, 1197-1212, 1215-1218, 1220-1221, 1223, 1225-1226, 1228, 1285, 1323-1328, 1330-1334, 1336-1339, 1341-1351, 1358-1372, 1375-1384, 1386-1390, 1392-1398, 1400-1412, 1418-1422, 1424-1426, 1440-1442, 1447-1451, 1482-1496, 1499-1513, 1521-1538, 1546, 1560, 1572-1578, 1580-1586, 1591-1608
web-app/src/containers/ThreadContent.tsx3-5, 12-18, 23, 28-29, 31, 33-37, 45-47, 49-53, 55-58, 60-64, 66-73, 75, 77, 80-82, 96-99, 101, 104-107, 109-112, 114-116, 118-121, 124-129, 131-133, 135-143, 145, 147-150, 152-153, 156-163, 166-175, 177-178, 180-182, 184, 186-194, 196-217, 219-221, 223-235, 237-240, 242-247, 249-253, 255, 259-262, 264-275, 279-292, 294-297, 299-307, 310-311, 313, 315-322, 325-333, 335-342, 345-346, 348-351, 353, 355-357, 361-371, 373-384, 386-390, 393-400, 402-412, 414-425, 428-435, 437-438, 441-446, 448-449, 452-455, 457-466, 468-471, 473-478, 480-487, 489-492, 494-497, 499-504, 506-512, 514, 516-523, 525, 528-536, 538, 540-544, 546-556, 558-559
web-app/src/containers/dialogs/AttachmentIngestionDialog.tsx1, 9-11, 13-19, 21-23, 25, 27-36, 38-42, 44-53, 55-62, 64-71, 73
web-app/src/hooks/useAttachmentIngestionPrompt.ts32-42, 44-47, 49-52
web-app/src/hooks/useAttachments.ts38-39, 59-61, 63-64, 66-94, 96-100, 103-131, 133-148, 150-165, 167-182, 184-199, 201-216, 218-233, 235-250, 252-267
web-app/src/hooks/useChat.ts52-62, 64-68, 72-78, 106-114, 119-125, 127-130, 132-138, 141-149, 151-163, 165-171, 173-177, 179-185, 187-188, 190-192, 195, 197-199, 201-202, 205-211, 213-214, 216-221, 223-228, 230-233, 235-237, 240-242, 310-311, 315-319, 322, 325-334, 336-346, 349-351, 354-356, 358-362, 370-375, 377-382, 392-394, 416-438, 441, 443, 445, 448, 451-456, 458-459, 464-466, 469-473, 476, 479-481, 483-493, 526-528, 534-539, 544-546, 551-553, 558, 567-571, 573, 576-580, 583-616, 635-636, 639-642, 662-663, 693-697, 709, 727-729, 731, 733, 740, 751-766, 777-778, 780-785, 788, 790-797, 819-823, 827, 864-866, 869-870, 872-873, 875-893, 895-905, 907-912, 914-923, 927-929, 931-933, 936-941, 1005-1006, 1015-1016, 1019, 1021-1040, 1042-1058, 1069-1070, 1073-1075, 1078, 1080-1111, 1117-1118
web-app/src/hooks/useChatAttachments.ts26-36, 38, 40-43, 45-47, 49-51, 53-62
web-app/src/hooks/useTokensCount.ts23-27, 29, 31-33, 35-37, 39-41, 44-45, 52-57, 59-65, 71-74, 77-79, 82-92, 94-104, 106, 108-114, 116-132, 135-137, 139-152, 154, 156-159, 161-163, 165-172, 174-177, 179-189, 191-205, 207-209, 212, 214-216, 219-221, 224-232, 234-240, 242-255, 258, 260-264, 266-270
web-app/src/lib/attachmentProcessing.ts52-54, 63-65, 68-69, 79-80, 82-89, 94-101, 103-105, 107-110, 112-113, 115-121, 123, 125-126, 129-158, 160-162, 164-171, 173-177, 180-182, 184-186, 188-197, 199-212
web-app/src/lib/completion.ts75-80, 98-106, 121-126, 187-195, 197, 199-200, 202-204, 206, 208, 211-216, 218-225, 227-237, 240-248, 250-263, 265-281, 283-304, 320-326, 377, 380-385, 387-390, 464-465, 468-469, 484, 486, 488-494, 496-498, 500-502, 544-545, 554-555, 580-585, 595, 599-603, 607-623, 632-633, 646-655, 657-665, 668-677
web-app/src/lib/fileMetadata.ts24-27, 29-38, 40, 42-43, 53-56, 58-59, 61-63, 66-69, 72-104, 107-109, 111-112
web-app/src/lib/messages.ts23-25, 28, 30-32, 34-41, 44-46, 49-50, 91, 94, 99-101, 114-118, 122-137, 139-142, 155-156, 196-198, 200, 202-203, 205-206, 208-209, 211-217
web-app/src/routes/__root.tsx1, 4-27, 32-39, 41-44, 46-54, 57, 60-63, 66-74, 77-81, 83-85, 88-92, 94, 96-98, 101-103, 105-110, 112-116, 118-119, 121-124, 128-132, 135-139, 141-144, 147, 150-157, 159, 161, 164-168, 170-174, 176-178, 180, 182, 184-188, 190-197, 199, 201-207, 209, 211, 213-214, 216, 219-226, 229, 231-232, 234, 236-249, 252-259, 261
web-app/src/routes/settings/attachments.tsx1-5, 7-12, 14-16, 19-26, 29-32, 34-36, 38-42, 45-47, 50-52, 55-76, 79, 82, 85-90, 93, 95-97, 100-103, 106-112, 115-133, 135, 137-156, 159-164, 166-177, 179-202, 204-205, 208-214, 216-227, 229-230, 232-242, 244, 246-252, 254
web-app/src/services/rag/default.ts8-17, 20-24, 27-37, 40-42, 44-49, 52-58, 60-61
web-app/src/types/attachment.ts40-45, 56-61

Copilot AI review requested due to automatic review settings December 2, 2025 04:51
Copilot finished reviewing on behalf of dinhlongviolin1 December 2, 2025 04:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 20 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

dinhlongviolin1 and others added 3 commits December 2, 2025 12:33
Implemented batch‑based embedding for both rag-extension and vector-db-extension.
- Introduced a `batchSize` parameter with a sensible default.
- Processed texts in chunks to avoid large single calls to the LlamaCPP embed API.
- Mapped batch results to global indices and added per‑batch error handling.
- Logged failures and re‑thrown errors with contextual information.

This change improves memory usage, resilience to API timeouts, and overall scalability of the embedding pipeline.
Copilot AI review requested due to automatic review settings December 2, 2025 05:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 2, 2025 06:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot finished reviewing on behalf of dinhlongviolin1 December 2, 2025 06:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copilot AI review requested due to automatic review settings December 2, 2025 07:52
qnixsynapse
qnixsynapse previously approved these changes Dec 2, 2025
Copilot finished reviewing on behalf of dinhlongviolin1 December 2, 2025 07:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 13 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

qnixsynapse
qnixsynapse previously approved these changes Dec 3, 2025
Copilot AI review requested due to automatic review settings December 3, 2025 08:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dinhlongviolin1 dinhlongviolin1 merged commit c74bbbd into release/v0.7.4 Dec 3, 2025
13 checks passed
@dinhlongviolin1 dinhlongviolin1 deleted the feat/improve-file-attachments branch December 3, 2025 08:49
@github-actions github-actions bot added this to the v0.7.6 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants