-
Notifications
You must be signed in to change notification settings - Fork 45
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
RFC: Files Table and DuckDB #788
Comments
re |
Organizing files into projects like claude could be useful..eg you could assume that every chat with uploaded files is an anonymous project, once you name em, you can easily attach em to other chats. See https://www.anthropic.com/news/projects |
Re expiry, we can trigger removal of old files when we add new ones |
We could provide a little toggle next to file re full or RAG mode...Then the place where the file was inserted could have text content inlined or search results Overall lgtm, lets do it! |
Add Files Table and DuckDB File Integration
We've been adding DuckDB support to ChatCraft and it has some powerful features we'd like to use with files. For example, being able to use SQL to query CSV, JSON, or Excel files, do full-text search of large text files, etc. DuckDB-wasm also has its own concept of a file system, which we'd like to connect to our current files feature.
Current Behaviour
Our current file feature mostly lives in
src/hooks/use-file-import.tsx
. Users can copy/paste, drag-and-drop, or clickOptions > Attach Files...
to include file content in messages. In other words, file contents (text or extracted text, images as base64 encoded URLs) are included in messages to be sent to the LLM. This works well for small files.Now that we have DuckDB and the concept of Tables, we want to add Files as well. Files would be separate from messages, and would be stored in binary form in Dexie.
Proposed Changes
1. New Dexie Table
Add a new Table to Dexie,
files
, with the following layout:2. File Processing Logic
Modify
src/hooks/use-file-import.tsx
as follows:files
table3. DuckDB Integration
We need to expose files in the current chat (and possibly all files?) to the DuckDB virtual filesystem. This would allow us to do SQL queries against the file data, for example:
It would be nice if DuckDB could also write to the Dexie
files
table, so you can safe the results of things back into the chat.4. UI Changes
/embed <filename>
,/delete <filename>
,/download <filename>
)Migration Strategy
We need to decide how to deal with existing
imageUrls[]
(i.e., base64 encoded image strings) inmessages
table when we do the next db migration. The table looks like this:We have a few options:
Delete Option
Archive Option
Migrate to Files Option
Proposed Implementation Phases
This is a complex change that needs to get done in pieces over many smaller issues/PRs.
Phase 1: Basic Files Support
Phase 2: DuckDB Integration
Phase 3: Enhanced Features
Phase 4: Optimization
The text was updated successfully, but these errors were encountered: