-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: file attachment #6766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat: file attachment #6766
Conversation
This commit introduces a new field, `is_embedding`, to the `SessionInfo` structure to clearly mark sessions running dedicated embedding models. Key changes: - Adds `is_embedding` to the `SessionInfo` interface in `AIEngine.ts` and the Rust backend. - Updates the `loadLlamaModel` command signatures to pass this new flag. - Modifies the llama.cpp extension's **auto-unload logic** to explicitly **filter out** and **not unload** any currently loaded embedding models when a new text generation model is loaded. This is a critical performance fix to prevent the embedding model (e.g., used for RAG) from being repeatedly reloaded. Also includes minor code style cleanup/reformatting in `jan-provider-web/provider.ts` for improved readability.
There was a problem hiding this 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 PR introduces a comprehensive file attachment feature for document retrieval-augmented generation (RAG) in the Jan application. It provides capabilities for uploading, indexing, and semantically searching documents (PDFs, text files, Office docs, etc.) during chat conversations.
- Implements a complete RAG pipeline with vector storage, semantic search, and document parsing
- Adds settings UI for configuring attachment behavior (file size limits, chunk sizes, search modes)
- Introduces new extension architecture for RAG and vector database operations
Reviewed Changes
Copilot reviewed 92 out of 95 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
web-app/src/types/attachment.ts | Defines unified attachment types for images and documents |
web-app/src/services/uploads/default.ts | Implements document ingestion service with RAG extension integration |
web-app/src/routes/settings/attachments.tsx | Provides settings UI for attachment configuration |
web-app/src/hooks/useAttachments.ts | Manages attachment settings state and persistence |
web-app/src/containers/ChatInput.tsx | Extends chat input with document and image attachment capabilities |
src-tauri/plugins/tauri-plugin-vector-db | New Tauri plugin for vector database operations with sqlite-vec support |
extensions/rag-extension | RAG extension providing document retrieval tools and orchestration |
core/src/browser/extensions/vector-db.ts | Core vector database extension interface |
Comments suppressed due to low confidence (2)
web-app/src/locales/en/common.json:1
- Removed trailing empty line at end of file.
{
src-tauri/plugins/tauri-plugin-vector-db/src/db.rs:1
- [nitpick] Missing space after closing brace. Consider formatting:
if mag_a == 0.0 || mag_b == 0.0 { return Ok(0.0) }
use crate::VectorDBError;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this 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 92 out of 95 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (2)
web-app/src/hooks/useThreadScrolling.tsx:1
- Dependencies in useCallback should only include values that actually affect the callback. Remove
setIsAtBottom
andsetHasScrollbar
from dependencies as they are stable setState functions.
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
src-tauri/plugins/tauri-plugin-vector-db/src/db.rs:1
- [nitpick] Format the early return with proper spacing and line breaks for better readability.
use crate::VectorDBError;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this 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.
- Added shallow equality guard for `connectedServers` state to prevent redundant updates when the fetched server list hasn't changed. - Updated error handling for server fetch to only clear the state when it actually contains data. - Introduced `newHasActiveModels` variable and conditional updater for `hasActiveModels` to avoid unnecessary state changes. - Adjusted error handling for active model fetch to only set `hasActiveModels` to `false` when the current state differs. These changes reduce needless re‑renders and improve component performance.
Describe Your Changes
Overview: File Attachment Feature
What Files Are Supported
Document Formats:
How It Works
Architecture:
Key Components:
Settings (extensions/rag-extension/settings.json):
Internal Tools Exposed:
Ingestion Flow:
Notable Features:
Fixes Issues
Self Checklist