fix
This commit is contained in:
parent
136346e189
commit
05263afc89
@ -7,7 +7,7 @@ import { Colors } from '@/constants/Colors';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
import { prefetchChats } from '@/lib/prefetch';
|
||||
import { fetchApi } from '@/lib/server-api-util';
|
||||
import { webSocketManager, WebSocketStatus } from '@/lib/websocket-util';
|
||||
import { getWebSocketManager, WebSocketStatus } from '@/lib/websocket-util';
|
||||
import { TransitionPresets } from '@react-navigation/bottom-tabs';
|
||||
import * as Notifications from 'expo-notifications';
|
||||
import { Tabs } from 'expo-router';
|
||||
@ -73,6 +73,7 @@ export default function TabLayout() {
|
||||
const handleStatusChange = (status: WebSocketStatus) => {
|
||||
setWsStatus(status);
|
||||
};
|
||||
const webSocketManager = getWebSocketManager();
|
||||
webSocketManager.subscribeStatus(handleStatusChange);
|
||||
return () => {
|
||||
webSocketManager.unsubscribeStatus(handleStatusChange);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import IP from "@/assets/icons/svg/ip.svg";
|
||||
import { ThemedText } from "@/components/ThemedText";
|
||||
import { webSocketManager } from "@/lib/websocket-util";
|
||||
import { getWebSocketManager } from "@/lib/websocket-util";
|
||||
import { Message } from "@/types/ask";
|
||||
import { Dispatch, SetStateAction } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@ -12,6 +12,7 @@ interface AskHelloProps {
|
||||
setConversationId: Dispatch<SetStateAction<string | null>>;
|
||||
setIsHello: Dispatch<SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
export default function AskHello({ setUserMessages, setConversationId, setIsHello }: AskHelloProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@ -35,6 +36,7 @@ export default function AskHello({ setUserMessages, setConversationId, setIsHell
|
||||
const sessionId = await createNewConversation(text);
|
||||
if (sessionId) {
|
||||
setConversationId(sessionId);
|
||||
const webSocketManager = getWebSocketManager();
|
||||
webSocketManager.send({
|
||||
type: 'Chat',
|
||||
session_id: sessionId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user