diff --git a/frontend/src/hooks/query/use-batch-feedback.ts b/frontend/src/hooks/query/use-batch-feedback.ts index e49e2761c1..5e6c5678fe 100644 --- a/frontend/src/hooks/query/use-batch-feedback.ts +++ b/frontend/src/hooks/query/use-batch-feedback.ts @@ -4,6 +4,7 @@ import ConversationService from "#/api/conversation-service/conversation-service import { useConversationId } from "#/hooks/use-conversation-id"; import { useConfig } from "#/hooks/query/use-config"; import { useRuntimeIsReady } from "#/hooks/use-runtime-is-ready"; +import { useActiveConversation } from "#/hooks/query/use-active-conversation"; export interface BatchFeedbackData { exists: boolean; @@ -25,13 +26,20 @@ export const getFeedbackExistsQueryKey = ( export const useBatchFeedback = () => { const { conversationId } = useConversationId(); const { data: config } = useConfig(); + const { data: conversation } = useActiveConversation(); const queryClient = useQueryClient(); const runtimeIsReady = useRuntimeIsReady(); + const isV1Conversation = conversation?.conversation_version === "V1"; + const query = useQuery({ queryKey: getFeedbackQueryKey(conversationId), queryFn: () => ConversationService.getBatchFeedback(conversationId!), - enabled: runtimeIsReady && !!conversationId && config?.APP_MODE === "saas", + enabled: + runtimeIsReady && + !!conversationId && + config?.APP_MODE === "saas" && + !isV1Conversation, staleTime: 1000 * 60 * 5, // 5 minutes gcTime: 1000 * 60 * 15, // 15 minutes }); diff --git a/frontend/src/hooks/query/use-feedback-exists.ts b/frontend/src/hooks/query/use-feedback-exists.ts index 5320023f62..c1d0f274d4 100644 --- a/frontend/src/hooks/query/use-feedback-exists.ts +++ b/frontend/src/hooks/query/use-feedback-exists.ts @@ -1,6 +1,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query"; import { useConversationId } from "#/hooks/use-conversation-id"; import { useConfig } from "#/hooks/query/use-config"; +import { useActiveConversation } from "#/hooks/query/use-active-conversation"; import { BatchFeedbackData, getFeedbackQueryKey } from "./use-batch-feedback"; export type FeedbackData = BatchFeedbackData; @@ -9,6 +10,9 @@ export const useFeedbackExists = (eventId?: number) => { const queryClient = useQueryClient(); const { conversationId } = useConversationId(); const { data: config } = useConfig(); + const { data: conversation } = useActiveConversation(); + + const isV1Conversation = conversation?.conversation_version === "V1"; return useQuery({ queryKey: [...getFeedbackQueryKey(conversationId), eventId], @@ -22,7 +26,11 @@ export const useFeedbackExists = (eventId?: number) => { return batchData?.[eventId.toString()] ?? { exists: false }; }, - enabled: !!eventId && !!conversationId && config?.APP_MODE === "saas", + enabled: + !!eventId && + !!conversationId && + config?.APP_MODE === "saas" && + !isV1Conversation, staleTime: 1000 * 60 * 5, // 5 minutes gcTime: 1000 * 60 * 15, // 15 minutes });