mirror of https://github.com/buster-so/buster.git
remove mocks
This commit is contained in:
parent
fc7f83ff43
commit
db50da5ea3
|
@ -4,7 +4,6 @@ import { useMemoizedFn } from 'ahooks';
|
||||||
import type { BusterChat } from '@/api/asset_interfaces';
|
import type { BusterChat } from '@/api/asset_interfaces';
|
||||||
import type { IBusterChat, IBusterChatMessage } from '../interfaces';
|
import type { IBusterChat, IBusterChatMessage } from '../interfaces';
|
||||||
import { updateChatToIChat } from '@/utils/chat';
|
import { updateChatToIChat } from '@/utils/chat';
|
||||||
import { MOCK_CHAT } from './MOCK_CHAT';
|
|
||||||
|
|
||||||
export const useChatSubscriptions = ({
|
export const useChatSubscriptions = ({
|
||||||
chatsRef,
|
chatsRef,
|
||||||
|
@ -41,17 +40,16 @@ export const useChatSubscriptions = ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const subscribeToChat = useMemoizedFn(({ chatId }: { chatId: string }) => {
|
const subscribeToChat = useMemoizedFn(({ chatId }: { chatId: string }) => {
|
||||||
_onGetChat(MOCK_CHAT);
|
return busterSocket.emitAndOnce({
|
||||||
// return busterSocket.emitAndOnce({
|
emitEvent: {
|
||||||
// emitEvent: {
|
route: '/chats/get',
|
||||||
// route: '/chats/get',
|
payload: { id: chatId }
|
||||||
// payload: { id: chatId }
|
},
|
||||||
// },
|
responseEvent: {
|
||||||
// responseEvent: {
|
route: '/chats/get:getChat',
|
||||||
// route: '/chats/get:getChat',
|
callback: _onGetChat
|
||||||
// callback: _onGetChat
|
}
|
||||||
// }
|
});
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import {
|
||||||
import { updateChatToIChat } from '@/utils/chat';
|
import { updateChatToIChat } from '@/utils/chat';
|
||||||
import { useAutoAppendThought } from './useAutoAppendThought';
|
import { useAutoAppendThought } from './useAutoAppendThought';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { MOCK_CHAT } from '../ChatProvider/MOCK_CHAT';
|
|
||||||
|
|
||||||
export const useChatUpdateMessage = () => {
|
export const useChatUpdateMessage = () => {
|
||||||
const busterSocket = useBusterWebSocket();
|
const busterSocket = useBusterWebSocket();
|
||||||
|
@ -131,24 +130,6 @@ export const useChatUpdateMessage = () => {
|
||||||
stopListeningForGeneratingReasoningMessage();
|
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 {
|
return {
|
||||||
completeChatCallback,
|
completeChatCallback,
|
||||||
startListeningForChatProgress,
|
startListeningForChatProgress,
|
||||||
|
|
|
@ -9,7 +9,6 @@ import { useBusterWebSocket } from '../BusterWebSocket';
|
||||||
import type { BusterMetricData } from '../Metrics';
|
import type { BusterMetricData } from '../Metrics';
|
||||||
import { MetricEvent_fetchingData } from '@/api/buster_socket/metrics/eventsInterfaces';
|
import { MetricEvent_fetchingData } from '@/api/buster_socket/metrics/eventsInterfaces';
|
||||||
import { DEFAULT_MESSAGE_DATA } from './config';
|
import { DEFAULT_MESSAGE_DATA } from './config';
|
||||||
import { createMockData } from './MOCK_DATA';
|
|
||||||
|
|
||||||
const useMetricData = () => {
|
const useMetricData = () => {
|
||||||
const busterSocket = useBusterWebSocket();
|
const busterSocket = useBusterWebSocket();
|
||||||
|
@ -100,12 +99,6 @@ const useMetricData = () => {
|
||||||
fetching: true
|
fetching: true
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
//TODO: remove mock data
|
|
||||||
// _setMetricData(metricId, { ...MOCK_DATA, fetched: true });
|
|
||||||
onSetDataForMetric(createMockData(metricId));
|
|
||||||
}, Math.random() * 5000);
|
|
||||||
|
|
||||||
return await busterSocket.emitAndOnce({
|
return await busterSocket.emitAndOnce({
|
||||||
emitEvent: {
|
emitEvent: {
|
||||||
route: '/metrics/data',
|
route: '/metrics/data',
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { useMemoizedFn } from 'ahooks';
|
import { useMemoizedFn } from 'ahooks';
|
||||||
import { useBusterAssetsContextSelector } from '../../Assets/BusterAssetsProvider';
|
import { useBusterAssetsContextSelector } from '../../Assets/BusterAssetsProvider';
|
||||||
import { IBusterMetric } from '../interfaces';
|
import { IBusterMetric } from '../interfaces';
|
||||||
import { createMockMetric } from './MOCK_METRIC';
|
|
||||||
import { useBusterWebSocket } from '../../BusterWebSocket';
|
import { useBusterWebSocket } from '../../BusterWebSocket';
|
||||||
import { BusterMetric } from '@/api/asset_interfaces';
|
import { BusterMetric } from '@/api/asset_interfaces';
|
||||||
import { RustApiError } from '@/api/buster_rest/errors';
|
import { RustApiError } from '@/api/buster_rest/errors';
|
||||||
|
@ -57,11 +56,6 @@ export const useMetricSubscribe = ({
|
||||||
|
|
||||||
_setLoadingMetric(metricId);
|
_setLoadingMetric(metricId);
|
||||||
|
|
||||||
//TODO: remove this
|
|
||||||
setTimeout(() => {
|
|
||||||
_onGetMetricState(createMockMetric(metricId));
|
|
||||||
}, 300);
|
|
||||||
|
|
||||||
return await busterSocket.emitAndOnce({
|
return await busterSocket.emitAndOnce({
|
||||||
emitEvent: {
|
emitEvent: {
|
||||||
route: '/metrics/get',
|
route: '/metrics/get',
|
||||||
|
|
Loading…
Reference in New Issue