Knowledgebases give bots RAG over documents, scoped like extensions: to particular bots, to a workspace, or to every bot, with their own button beside Tools in the composer. Documents are chunked and embedded by the file-ingest worker with the install's embedding model, which is now an install-wide setting rather than a per-bot one. - Word search runs on an FTS5 index ranked by BM25, with a scored LIKE fallback for scripts written without spaces. - Changing the embedding model re-indexes documents automatically. - Ingest jobs wait without spending attempts while every embedding model rests, fail at once on errors retrying can't fix, and keep passages searchable by words when the model refuses. - Settings > Knowledgebases shows each knowledgebase's and document's index state: spinner, warning, grey check (words only) or green check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
25 lines
744 B
TypeScript
25 lines
744 B
TypeScript
type Params = {
|
|
/**
|
|
* Where the passage is from, e.g. "Product handbook / pricing.md".
|
|
*/
|
|
source: string;
|
|
document_id: number;
|
|
/**
|
|
* Where in the document, e.g. "passage 3".
|
|
*/
|
|
at: string;
|
|
text: string;
|
|
};
|
|
|
|
/**
|
|
* One knowledgebase passage for a bot to read, fenced so nothing inside it
|
|
* reads as the app's own words.
|
|
*/
|
|
export default function knowledgebasePassageBlock({ source, document_id, at, text }: Params) {
|
|
const body = text.trim();
|
|
const longest_run = Math.max(0, ...(body.match(/`+/g) || []).map((run) => run.length));
|
|
const fence = "`".repeat(Math.max(3, longest_run + 1));
|
|
|
|
return [`From ${source} (document ${document_id}, ${at}):`, fence, body, fence].join("\n");
|
|
}
|