mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 09:16:22 +02:00
refactor: migrate ChatInputGroup to jotai + tanstack query pattern
- Replace useLLMConfigs hook with llmConfigsAtom - Map properties correctly (data, isFetching, isError) - Fix TypeScript issue with is_global property check - Keep useGlobalLLMConfigs and useLLMPreferences unchanged - Maintain backward compatibility with existing functionality
This commit is contained in:
parent
85f00bd364
commit
c3dd3de6f6
1 changed files with 6 additions and 4 deletions
|
|
@ -27,9 +27,11 @@ import {
|
|||
} from "@/components/ui/select";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
|
||||
import type { Document } from "@/contracts/types/document.types";
|
||||
import { useGlobalLLMConfigs, useLLMConfigs, useLLMPreferences } from "@/hooks/use-llm-configs";
|
||||
import { Document } from "@/contracts/types/document.types";
|
||||
import { useGlobalLLMConfigs, useLLMPreferences } from "@/hooks/use-llm-configs";
|
||||
import { useSearchSourceConnectors } from "@/hooks/use-search-source-connectors";
|
||||
import { useAtomValue } from "jotai";
|
||||
import { llmConfigsAtom } from "@/atoms/llm-config/llm-config-query.atoms";
|
||||
|
||||
const DocumentSelector = React.memo(
|
||||
({
|
||||
|
|
@ -539,7 +541,7 @@ const LLMSelector = React.memo(() => {
|
|||
const { search_space_id } = useParams();
|
||||
const searchSpaceId = Number(search_space_id);
|
||||
|
||||
const { llmConfigs, loading: llmLoading, error } = useLLMConfigs(searchSpaceId);
|
||||
const { data: llmConfigs = [], isFetching: llmLoading, isError: error } = useAtomValue(llmConfigsAtom);
|
||||
const {
|
||||
globalConfigs,
|
||||
loading: globalConfigsLoading,
|
||||
|
|
@ -574,7 +576,7 @@ const LLMSelector = React.memo(() => {
|
|||
<span className="hidden sm:inline text-muted-foreground text-xs truncate max-w-[60px]">
|
||||
{selectedConfig.name}
|
||||
</span>
|
||||
{selectedConfig.is_global && <span className="text-xs">🌐</span>}
|
||||
{"is_global" in selectedConfig && selectedConfig.is_global && <span className="text-xs">🌐</span>}
|
||||
</div>
|
||||
);
|
||||
}, [selectedConfig]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue