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
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import knowledgebaseIndexState from "./knowledgebase-index-state";
|
|
|
|
const base = { total: 3, indexing: 0, failed: 0, stale: 0, embedding_model: "model" };
|
|
|
|
describe("knowledgebaseIndexState", () => {
|
|
test("is indexed when every document is read by the current model", () => {
|
|
expect(knowledgebaseIndexState(base)).toBe("indexed");
|
|
});
|
|
|
|
test("puts being read before a failure, and a failure before the model", () => {
|
|
expect(knowledgebaseIndexState({ ...base, indexing: 1, failed: 1 })).toBe("indexing");
|
|
expect(knowledgebaseIndexState({ ...base, failed: 1, embedding_model: null })).toBe("failed");
|
|
});
|
|
|
|
test("is words only without a model, stale with another one", () => {
|
|
expect(knowledgebaseIndexState({ ...base, stale: 3, embedding_model: null })).toBe("words");
|
|
expect(knowledgebaseIndexState({ ...base, stale: 1 })).toBe("stale");
|
|
});
|
|
|
|
test("is empty with no documents", () => {
|
|
expect(knowledgebaseIndexState({ ...base, total: 0, indexing: 1 })).toBe("empty");
|
|
});
|
|
});
|