Add bots files handling logic
This commit is contained in:
@@ -373,6 +373,65 @@ export const AppData = {
|
||||
* Most of a bot message read aloud; the rest is cut.
|
||||
*/
|
||||
SpeechMaxChars: 4000,
|
||||
/**
|
||||
* Bot files: a bot's own directory and a workspace's shared one live
|
||||
* under `DATA_DIR` (`DATA_DIR/bots/<id>`, `DATA_DIR/workspaces/<id>`),
|
||||
* on the data volume, never on a computer.
|
||||
*/
|
||||
BotDataDir: "bots",
|
||||
WorkspaceDataDir: "workspaces",
|
||||
/**
|
||||
* The per-owner quota when the General settings page has none saved.
|
||||
*/
|
||||
BotFileQuotaMb: 1024,
|
||||
/**
|
||||
* One file a bot writes in one call, and the most of a file a read
|
||||
* hands back at once (the rest comes with an offset).
|
||||
*/
|
||||
BotFileWriteMaxChars: 200_000,
|
||||
BotFileReadMaxChars: 40_000,
|
||||
BotFileListMaxItems: 200,
|
||||
BotFileNameMaxChars: 120,
|
||||
BotFilePathMaxChars: 400,
|
||||
/**
|
||||
* Most folders deep a path may go, so nothing buries a file.
|
||||
*/
|
||||
BotFilePathMaxDepth: 8,
|
||||
/**
|
||||
* The files modal and the bot's file list: one page of them.
|
||||
*/
|
||||
BotFilesPageSize: 50,
|
||||
/**
|
||||
* Ingesting a bot file: how much text one chunk holds, how much of the
|
||||
* previous chunk it repeats, and the largest file it reads at all.
|
||||
*/
|
||||
ChunkTargetChars: 1200,
|
||||
ChunkOverlapChars: 200,
|
||||
IngestMaxBytes: 20 * 1024 * 1024,
|
||||
/**
|
||||
* The fixed width of every vector, whatever the embedding model
|
||||
* returns: shorter vectors are padded with zeros and longer ones cut,
|
||||
* then all are normalized. Changing it needs
|
||||
* `bunx bun-sqlite schema --vector` and a full re-ingest.
|
||||
*/
|
||||
EmbeddingDimensions: 1536,
|
||||
/**
|
||||
* Texts sent to the embedding model per call, and per run of the
|
||||
* ingestion worker.
|
||||
*/
|
||||
EmbeddingBatchSize: 32,
|
||||
EmbeddingMaxInputChars: 8000,
|
||||
/**
|
||||
* How many chunks a file search returns, and how many more it asks
|
||||
* the vector index for before filtering to the run's scopes.
|
||||
*/
|
||||
RagTopChunks: 8,
|
||||
RagOverFetch: 4,
|
||||
RagMaxK: 60,
|
||||
FileIngestPollMs: 5000,
|
||||
FileIngestConcurrency: 2,
|
||||
FileIngestWorker: "ingest",
|
||||
FileIngestMaxAttempts: 2,
|
||||
/**
|
||||
* What a speech model reads when a voice is tried in the model settings.
|
||||
*/
|
||||
|
||||
@@ -31,11 +31,26 @@ You are chatting with the user. Answer their latest messages directly and briefl
|
||||
- To add a worker to the crew, use create_bot once the user has asked for it or agreed, and add_bot_to_workspace to place it. A bot exists only when create_bot made it: never describe one as if it did, and never write it into a workspace's context.
|
||||
- Never claim you did something you didn't do.
|
||||
- The user can mention a bot as [bot:ID] and a workspace as [workspace:ID]; a [Mentions: ...] line after their message says who and what those are. Write the same refs when you name them back.
|
||||
- Documents, images and reports you make are files: save them with write_file, make_pdf or generate_image, and send one to the user with it ("attach"). When you name a file, write its ref, e.g. [file:12], so the user can open it.
|
||||
|
||||
## Keep the work moving
|
||||
|
||||
Be proactive. Follow where the conversation is heading and, once you've answered, offer the next step: one concrete suggestion or a short question about what to do next, e.g. "Want me to draft the reply as well?" or "Should I check the other two accounts the same way?". Base it on what the user is trying to get done, not on generic options. Offer one step, not a menu. Skip it when you've already asked the user something in this reply, when you've just started a task (its result will suggest what's next), or when the user is clearly wrapping up.`;
|
||||
|
||||
/**
|
||||
* Added to every run, chat replies and tasks alike: where its files live,
|
||||
* that they persist, and how to search them.
|
||||
*/
|
||||
export const BotFilesNote = `# Your files
|
||||
|
||||
You have a folder of your own, kept with the app (not on a computer), and it stays between runs and conversations.
|
||||
|
||||
- list_files shows what's in it; read_file opens one (by its [file:ID] ref or path); write_file saves a text file, make_pdf a PDF, generate_image an image. Move and delete with move_file and delete_file when something is out of date, so the folder stays useful.
|
||||
- Text files are chunked and searchable as soon as they're saved. search_files finds the passages that answer a question, by meaning when an embedding model is set and by words otherwise. Search your files before saying you don't know something they may hold, and when the user asks about a document they gave you.
|
||||
- Uploaded files land in the same folder, so what the user sent you earlier is searchable later too.
|
||||
- When you name a file, write its [file:ID] ref: the user sees a link to it.
|
||||
- A file you only described is not saved. Save it first, then say it's saved.`;
|
||||
|
||||
/**
|
||||
* Added to every run, chat replies and tasks alike: check before you
|
||||
* create, and check after you act.
|
||||
|
||||
Reference in New Issue
Block a user