diff --git a/apps/app/src/features/mastra/client/components/Sidebar/AiAssistantSubstance.tsx b/apps/app/src/features/mastra/client/components/Sidebar/AiAssistantSubstance.tsx
index f91d1f8a711..dd07a861b91 100644
--- a/apps/app/src/features/mastra/client/components/Sidebar/AiAssistantSubstance.tsx
+++ b/apps/app/src/features/mastra/client/components/Sidebar/AiAssistantSubstance.tsx
@@ -6,7 +6,7 @@ import {
useAiAssistantSidebar,
useSWRxAiAssistants,
} from '../../../../openai/client/stores/ai-assistant';
-import { useSWRINFxRecentThreads } from '../../../../openai/client/stores/thread';
+import { useSWRINFxRecentThreads } from '../../stores/thread';
import { AiAssistantList } from './AiAssistantList';
import { ThreadList } from './ThreadList';
diff --git a/apps/app/src/features/mastra/client/components/Sidebar/ThreadList.tsx b/apps/app/src/features/mastra/client/components/Sidebar/ThreadList.tsx
index 3e4f16ed4be..0eca34cab70 100644
--- a/apps/app/src/features/mastra/client/components/Sidebar/ThreadList.tsx
+++ b/apps/app/src/features/mastra/client/components/Sidebar/ThreadList.tsx
@@ -5,21 +5,19 @@ import { useTranslation } from 'react-i18next';
import InfiniteScroll from '~/client/components/InfiniteScroll';
import { toastError, toastSuccess } from '~/client/util/toastr';
-import {
- useSWRINFxRecentThreads,
- useSWRMUTxThreads,
-} from '~/features/openai/client/stores/thread';
+import { useSWRMUTxThreads } from '~/features/openai/client/stores/thread';
import loggerFactory from '~/utils/logger';
import { deleteThread } from '../../../../openai/client/services/thread';
import { useAiAssistantSidebar } from '../../../../openai/client/stores/ai-assistant';
+import { useSWRINFxRecentThreads } from '../../stores/thread';
const logger = loggerFactory('growi:openai:client:components:ThreadList');
export const ThreadList: React.FC = () => {
- const swrInifiniteThreads = useSWRINFxRecentThreads();
+ const swrInfiniteThreads = useSWRINFxRecentThreads();
const { t } = useTranslation();
- const { data, mutate: mutateRecentThreads } = swrInifiniteThreads;
+ const { data, mutate: mutateRecentThreads } = swrInfiniteThreads;
const {
openChat,
data: aiAssistantSidebarData,
@@ -29,11 +27,9 @@ export const ThreadList: React.FC = () => {
aiAssistantSidebarData?.aiAssistantData?._id,
);
- const isEmpty = data?.[0]?.paginateResult.totalDocs === 0;
+ const isEmpty = data?.[0]?.total === 0;
const isReachingEnd =
- isEmpty ||
- (data != null &&
- data[data.length - 1].paginateResult.hasNextPage === false);
+ isEmpty || (data != null && data[data.length - 1]?.hasMore === false);
const deleteThreadHandler = useCallback(
async (aiAssistantId: string, threadRelationId: string) => {
@@ -70,20 +66,20 @@ export const ThreadList: React.FC = () => {
return (
{data
- ?.flatMap((thread) => thread.paginateResult.docs)
+ ?.flatMap((threadData) => threadData.threads)
.map((thread) => (
- -
+
-