feat: edit qdrant workspace collections
This commit is contained in:
@@ -16,11 +16,11 @@ const EMPTY_COMMIT = "0".repeat(40);
|
||||
|
||||
function newWorkspace(): CanonicalWorkspace {
|
||||
return {
|
||||
workspace: { schema_version: 2, id: "new-workspace", name: "New workspace", language: "en" },
|
||||
workspace: { schema_version: 3, id: "new-workspace", name: "New workspace", language: "en" },
|
||||
dwh: { engine: "postgres", database: "database", schema: "public", supported_transports: ["postgres_direct"] },
|
||||
semantic_index: {
|
||||
vector_store: { engine: "pgvector", database: "vectors", schema: "public", collection: "documents", dimensions: 768, distance: "cosine", supported_transports: ["pgvector_direct"] },
|
||||
embedding: { provider: "ollama_compatible", model: "nomic-embed-text", dimensions: 768 },
|
||||
vector_store: { engine: "qdrant", collection: "documents", dimensions: 1024, distance: "cosine" },
|
||||
embedding: { provider: "ollama_internal", model: "qwen3-embedding:0.6b", dimensions: 1024 },
|
||||
},
|
||||
llm_policy: { allowed: ["zai/glm-5.2"] },
|
||||
};
|
||||
@@ -61,13 +61,15 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
const [transferring, setTransferring] = useState(false);
|
||||
const statusQuery = useQuery({ queryKey: ["workspace-registry-status"], queryFn: getWorkspaceRegistryStatus, enabled: open });
|
||||
const workspacesQuery = useQuery({ queryKey: ["workspaces"], queryFn: listWorkspaces, enabled: open });
|
||||
const workspaces = workspacesQuery.data ?? [];
|
||||
const selectedSummary = useMemo(() => workspaces.find((workspace) => workspace.id === selectedId), [selectedId, workspaces]);
|
||||
const selectedIsLegacy = selectedSummary?.revision.state === "migration_required";
|
||||
const detailQuery = useQuery({
|
||||
queryKey: ["workspace", selectedId],
|
||||
queryFn: () => getWorkspace(selectedId!),
|
||||
enabled: Boolean(open && selectedId && !localDraft),
|
||||
enabled: Boolean(open && selectedId && !localDraft && !selectedIsLegacy),
|
||||
});
|
||||
const status = statusQuery.data;
|
||||
const workspaces = workspacesQuery.data ?? [];
|
||||
const record = detailQuery.data;
|
||||
|
||||
const savedDraft = selectedId && !localDraft ? workspaceDrafts.load(selectedId) : undefined;
|
||||
@@ -75,7 +77,6 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
const currentDraft = localDraft ?? savedDraft ?? (record ? draftFromRecord(record) : undefined);
|
||||
const activeDeletionDraft = deletionDraft ?? savedDeletionDraft;
|
||||
const canTest = Boolean(record && currentDraft?.workspaceId === record.workspace.workspace.id);
|
||||
const selectedSummary = useMemo(() => workspaces.find((workspace) => workspace.id === selectedId), [selectedId, workspaces]);
|
||||
|
||||
function selectWorkspace(id: string) {
|
||||
setSelectedId(id);
|
||||
@@ -310,8 +311,13 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
</nav>
|
||||
|
||||
<div className="min-w-0 overflow-y-auto px-5 py-5">
|
||||
{detailQuery.isError && selectedId && !localDraft ? <QueryError name="Workspace details failed" message="Could not load workspace details." retryLabel="Retry workspace details" onRetry={() => { void detailQuery.refetch(); }} /> : !currentDraft && !detailQuery.isLoading && <div className="grid min-h-64 place-items-center text-center"><div><h3 className="font-heading font-semibold">Select a workspace</h3><p className="mt-1 text-sm text-muted-foreground">Review an existing definition or start a browser-only draft.</p></div></div>}
|
||||
{!detailQuery.isError && (currentDraft || detailQuery.isLoading) && (
|
||||
{selectedIsLegacy ? (
|
||||
<div className="rounded-md border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm">
|
||||
<p className="font-semibold">Migration required</p>
|
||||
<p className="mt-1">This workspace uses a legacy descriptor and must be migrated to schema v3 before new sessions or publication.</p>
|
||||
</div>
|
||||
) : detailQuery.isError && selectedId && !localDraft ? <QueryError name="Workspace details failed" message="Could not load workspace details." retryLabel="Retry workspace details" onRetry={() => { void detailQuery.refetch(); }} /> : !currentDraft && !detailQuery.isLoading && <div className="grid min-h-64 place-items-center text-center"><div><h3 className="font-heading font-semibold">Select a workspace</h3><p className="mt-1 text-sm text-muted-foreground">Review an existing definition or start a browser-only draft.</p></div></div>}
|
||||
{!selectedIsLegacy && !detailQuery.isError && (currentDraft || detailQuery.isLoading) && (
|
||||
<>
|
||||
{detailQuery.isLoading && !currentDraft ? <p className="text-sm text-muted-foreground">Loading workspace definition…</p> : currentDraft && <>
|
||||
<div className="mb-5 flex flex-wrap items-start justify-between gap-3 border-b border-border/70 pb-4">
|
||||
|
||||
Reference in New Issue
Block a user