Skip to content

Commit 82b8f21

Browse files
vid277cdxker
authored andcommitted
fix: dataset warning for chat
1 parent 04a7775 commit 82b8f21

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

frontends/chat/src/pages/chat.tsx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { Show, createEffect, createSignal, useContext } from "solid-js";
1+
import {
2+
Show,
3+
createEffect,
4+
createMemo,
5+
createSignal,
6+
useContext,
7+
} from "solid-js";
28
import MainLayout from "../components/Layouts/MainLayout";
39
import { Navbar } from "../components/Navbar/Navbar";
410
import { Sidebar } from "../components/Navbar/Sidebar";
@@ -63,6 +69,21 @@ export const Chat = () => {
6369
}
6470
});
6571

72+
const getOrganizationDatasetLength = createMemo(() => {
73+
const datasetListOrEmpty = userContext.datasetsAndUsages?.() ?? [];
74+
const currentOrgId = userContext.currentOrganization?.()?.id;
75+
76+
const length = datasetListOrEmpty.filter(
77+
(item) => item.dataset.organization_id === currentOrgId,
78+
).length;
79+
80+
return length;
81+
});
82+
83+
const checkDatasetPresent = createMemo(() => {
84+
return getOrganizationDatasetLength() > 0;
85+
});
86+
6687
return (
6788
<div class="relative flex h-screen flex-row bg-zinc-100 dark:bg-zinc-900">
6889
<div class="hidden w-1/4 overflow-x-hidden lg:block">
@@ -113,10 +134,7 @@ export const Chat = () => {
113134
orgId={userContext?.currentOrganization?.()?.id}
114135
/>
115136
}
116-
when={
117-
userContext?.datasetsAndUsages?.length &&
118-
userContext?.datasetsAndUsages?.length <= 0
119-
}
137+
when={checkDatasetPresent()}
120138
>
121139
<MainLayout
122140
setTopics={setTopics}

0 commit comments

Comments
 (0)