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