From db50da5ea3ededb67d089bdf19f8059a0c5f1a77 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Tue, 11 Feb 2025 10:46:24 -0700 Subject: [PATCH] remove mocks --- .../ChatProvider/useChatSubscriptions.ts | 22 +++++++++---------- .../NewChatProvider/useChatUpdateMessage.ts | 19 ---------------- .../MetricData/BusterMetricDataProvider.tsx | 7 ------ .../useMetricSubscribe.ts | 6 ----- 4 files changed, 10 insertions(+), 44 deletions(-) diff --git a/web/src/context/Chats/ChatProvider/useChatSubscriptions.ts b/web/src/context/Chats/ChatProvider/useChatSubscriptions.ts index 99a0fe741..05cc09d8c 100644 --- a/web/src/context/Chats/ChatProvider/useChatSubscriptions.ts +++ b/web/src/context/Chats/ChatProvider/useChatSubscriptions.ts @@ -4,7 +4,6 @@ import { useMemoizedFn } from 'ahooks'; import type { BusterChat } from '@/api/asset_interfaces'; import type { IBusterChat, IBusterChatMessage } from '../interfaces'; import { updateChatToIChat } from '@/utils/chat'; -import { MOCK_CHAT } from './MOCK_CHAT'; export const useChatSubscriptions = ({ chatsRef, @@ -41,17 +40,16 @@ export const useChatSubscriptions = ({ }); const subscribeToChat = useMemoizedFn(({ chatId }: { chatId: string }) => { - _onGetChat(MOCK_CHAT); - // return busterSocket.emitAndOnce({ - // emitEvent: { - // route: '/chats/get', - // payload: { id: chatId } - // }, - // responseEvent: { - // route: '/chats/get:getChat', - // callback: _onGetChat - // } - // }); + return busterSocket.emitAndOnce({ + emitEvent: { + route: '/chats/get', + payload: { id: chatId } + }, + responseEvent: { + route: '/chats/get:getChat', + callback: _onGetChat + } + }); }); return { diff --git a/web/src/context/Chats/NewChatProvider/useChatUpdateMessage.ts b/web/src/context/Chats/NewChatProvider/useChatUpdateMessage.ts index 033977359..544e93ed0 100644 --- a/web/src/context/Chats/NewChatProvider/useChatUpdateMessage.ts +++ b/web/src/context/Chats/NewChatProvider/useChatUpdateMessage.ts @@ -10,7 +10,6 @@ import { import { updateChatToIChat } from '@/utils/chat'; import { useAutoAppendThought } from './useAutoAppendThought'; import { useHotkeys } from 'react-hotkeys-hook'; -import { MOCK_CHAT } from '../ChatProvider/MOCK_CHAT'; export const useChatUpdateMessage = () => { const busterSocket = useBusterWebSocket(); @@ -131,24 +130,6 @@ export const useChatUpdateMessage = () => { stopListeningForGeneratingReasoningMessage(); }); - useHotkeys('x', () => { - const mock_generatingResponseMessageCallback: ChatEvent_GeneratingReasoningMessage = { - chat_id: MOCK_CHAT.id, - message_id: MOCK_CHAT.messages[0].id, - progress: 'completed', - reasoning: { - id: MOCK_CHAT.messages[0].id, - type: 'file', - file_type: 'metric', - file_name: 'metric.json', - version_id: '1', - version_number: 1, - status: 'completed' - } - }; - _generatingReasoningMessageCallback(mock_generatingResponseMessageCallback); - }); - return { completeChatCallback, startListeningForChatProgress, diff --git a/web/src/context/MetricData/BusterMetricDataProvider.tsx b/web/src/context/MetricData/BusterMetricDataProvider.tsx index 0dcee635c..f8ac1f478 100644 --- a/web/src/context/MetricData/BusterMetricDataProvider.tsx +++ b/web/src/context/MetricData/BusterMetricDataProvider.tsx @@ -9,7 +9,6 @@ import { useBusterWebSocket } from '../BusterWebSocket'; import type { BusterMetricData } from '../Metrics'; import { MetricEvent_fetchingData } from '@/api/buster_socket/metrics/eventsInterfaces'; import { DEFAULT_MESSAGE_DATA } from './config'; -import { createMockData } from './MOCK_DATA'; const useMetricData = () => { const busterSocket = useBusterWebSocket(); @@ -100,12 +99,6 @@ const useMetricData = () => { fetching: true }); - setTimeout(() => { - //TODO: remove mock data - // _setMetricData(metricId, { ...MOCK_DATA, fetched: true }); - onSetDataForMetric(createMockData(metricId)); - }, Math.random() * 5000); - return await busterSocket.emitAndOnce({ emitEvent: { route: '/metrics/data', diff --git a/web/src/context/Metrics/BusterMetricsIndividualProvider/useMetricSubscribe.ts b/web/src/context/Metrics/BusterMetricsIndividualProvider/useMetricSubscribe.ts index f19ee856e..cc1d23960 100644 --- a/web/src/context/Metrics/BusterMetricsIndividualProvider/useMetricSubscribe.ts +++ b/web/src/context/Metrics/BusterMetricsIndividualProvider/useMetricSubscribe.ts @@ -1,7 +1,6 @@ import { useMemoizedFn } from 'ahooks'; import { useBusterAssetsContextSelector } from '../../Assets/BusterAssetsProvider'; import { IBusterMetric } from '../interfaces'; -import { createMockMetric } from './MOCK_METRIC'; import { useBusterWebSocket } from '../../BusterWebSocket'; import { BusterMetric } from '@/api/asset_interfaces'; import { RustApiError } from '@/api/buster_rest/errors'; @@ -57,11 +56,6 @@ export const useMetricSubscribe = ({ _setLoadingMetric(metricId); - //TODO: remove this - setTimeout(() => { - _onGetMetricState(createMockMetric(metricId)); - }, 300); - return await busterSocket.emitAndOnce({ emitEvent: { route: '/metrics/get',