Skip to content

Commit 89fcc67

Browse files
authored
fix: assistant list (#563)
* fix: assistant list * fix: assistant list * fix: assistant list * fix: assistant list
1 parent 33c9ce6 commit 89fcc67

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

src/components/Assistant/Splash.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import logoImg from "@/assets/icon.svg";
1010
import { AssistantFetcher } from "./AssistantFetcher";
1111
import type { StartPage } from "@/types/chat";
1212

13-
1413
export interface Response {
1514
app_settings?: {
1615
chat?: {
@@ -27,7 +26,6 @@ interface SplashProps {
2726
const Splash = ({ assistantIDs = [], startPage }: SplashProps) => {
2827
const isTauri = useAppStore((state) => state.isTauri);
2928
const currentService = useConnectStore((state) => state.currentService);
30-
const [settings, setSettings] = useState<StartPage>();
3129
const visibleStartPage = useConnectStore((state) => state.visibleStartPage);
3230
const setVisibleStartPage = useConnectStore((state) => {
3331
return state.setVisibleStartPage;
@@ -39,16 +37,15 @@ const Splash = ({ assistantIDs = [], startPage }: SplashProps) => {
3937
return state.setCurrentAssistant;
4038
});
4139

40+
const [settings, setSettings] = useState<StartPage>();
41+
4242
const { fetchAssistant } = AssistantFetcher({
4343
assistantIDs,
4444
});
4545

46-
const fetchData = async (display_assistants: string[] = []) => {
46+
const fetchData = async () => {
4747
const data = await fetchAssistant({ current: 1, pageSize: 1000 });
48-
const list = (data.list || []).filter((item: any) => {
49-
return display_assistants?.includes(item?._source?.id);
50-
});
51-
setAssistantList(list);
48+
setAssistantList(data.list || []);
5249
};
5350

5451
const getSettings = async () => {
@@ -64,16 +61,15 @@ const Splash = ({ assistantIDs = [], startPage }: SplashProps) => {
6461
);
6562
response = response?.app_settings?.chat?.start_page;
6663
} else {
67-
response = startPage
64+
response = startPage;
6865
}
6966
setVisibleStartPage(Boolean(response?.enabled));
7067
setSettings(response);
71-
//
72-
fetchData(response?.display_assistants);
7368
};
7469

7570
useEffect(() => {
7671
getSettings();
72+
fetchData();
7773
}, [currentService?.id]);
7874

7975
const settingsAssistantList = useMemo(() => {
@@ -94,7 +90,7 @@ const Splash = ({ assistantIDs = [], startPage }: SplashProps) => {
9490

9591
return (
9692
visibleStartPage && (
97-
<div className="absolute inset-0 flex flex-col items-center px-6 pt-6 text-[#333] dark:text-white select-none overflow-y-auto custom-scrollbar">
93+
<div className="absolute top-12 inset-0 flex flex-col items-center px-6 pt-6 text-[#333] dark:text-white select-none overflow-y-auto custom-scrollbar">
9894
<CircleX
9995
className="absolute top-3 right-3 size-4 text-[#999] cursor-pointer"
10096
onClick={() => {

0 commit comments

Comments
 (0)