diff --git a/admin/inertia/components/chat/index.tsx b/admin/inertia/components/chat/index.tsx index b24e771..928db00 100644 --- a/admin/inertia/components/chat/index.tsx +++ b/admin/inertia/components/chat/index.tsx @@ -11,7 +11,6 @@ import { ChatMessage } from '../../../types/chat' import classNames from '~/lib/classNames' import { IconX } from '@tabler/icons-react' import { DEFAULT_QUERY_REWRITE_MODEL } from '../../../constants/ollama' -import { KB_COLLECTIONS } from '../../../constants/kb_collections' import { useSystemSetting } from '~/hooks/useSystemSetting' interface ChatProps { @@ -74,6 +73,12 @@ export default function Chat({ select: (data) => data || [], }) + const { data: knownCollections = [] } = useQuery({ + queryKey: ['kbCollections'], + queryFn: () => api.getKnowledgeCollections(), + select: (data) => data?.collections ?? [], + }) + const { data: chatSuggestions, isLoading: chatSuggestionsLoading } = useQuery({ queryKey: ['chatSuggestions'], queryFn: async ({ signal }) => { @@ -492,7 +497,7 @@ export default function Chat({ className="px-3 py-1.5 border border-border-default rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-desert-green focus:border-transparent bg-surface-primary" > - {KB_COLLECTIONS.map((c) => ( + {knownCollections.map((c) => ( ))}