Files
cobble/src/pages/admin/bots/[bot_id]/(partials)/composer-tool-row.tsx
T
tbenandClaude Opus 5.5 e7b23b7454 Add knowledgebases
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]>
2026-10-26 16:41:01 +01:00

71 lines
2.5 KiB
TypeScript

import Button from "@moduletrace/twui/layout/Button";
import Row from "@moduletrace/twui/layout/Row";
import Span from "@moduletrace/twui/layout/Span";
import Stack from "@moduletrace/twui/layout/Stack";
import { X } from "lucide-react";
import extensionIcon from "@/src/components/general/extension-icon";
import type { BotExtension } from "@/src/types";
import extensionStateNote from "@/src/utils/extension-state-note";
type Props = {
item: BotExtension;
busy?: boolean;
/**
* Takes it from the bot; not given for a workspace's own or when the
* user can't.
*/
onRemove?: () => void;
};
/**
* One MCP server, tool, skill or knowledgebase the bot can use here, in
* the composer's modals. One that isn't working says so
* (`extensionStateNote`), one that's off is struck out.
*/
export default function ComposerToolRow({ item, busy, onRemove }: Props) {
const Icon = extensionIcon({ kind: item.kind });
const notes = [
item.detail,
item.source == "workspace" ? "From this workspace" : "",
extensionStateNote({ item }),
].filter(Boolean);
return (
<Row className="w-full gap-2.5! flex-nowrap items-center px-3 py-2 border-0 border-b border-solid border-hairline last:border-b-0">
<Icon
size={14}
aria-hidden
className="shrink-0 text-ink-secondary"
/>
<Stack className="grow min-w-0 gap-0!">
<Span
title={item.description}
className={`text-sm leading-5 truncate w-full ${item.enabled ? "text-ink" : "text-ink-secondary line-through"}`}
>
{item.name}
</Span>
{notes.length ? (
<Span className="text-xs leading-4 text-ink-secondary truncate w-full">
{notes.join(" · ")}
</Span>
) : null}
</Stack>
{onRemove ? (
<Button
title={`Remove ${item.name}`}
aria-label={`Remove ${item.name}`}
type="button"
variant="ghost"
color="gray"
size="small"
disabled={busy}
onClick={onRemove}
className="shrink-0 p-1!"
>
<X size={14} aria-hidden />
</Button>
) : null}
</Row>
);
}