f
This commit is contained in:
parent
2ff82495ac
commit
797414e78b
@ -1,9 +1,8 @@
|
|||||||
import { ThemedText } from "@/components/ThemedText";
|
import { ThemedText } from "@/components/ThemedText";
|
||||||
import { webSocketManager } from "@/lib/websocket-util";
|
|
||||||
import { Message } from "@/types/ask";
|
import { Message } from "@/types/ask";
|
||||||
import { Dispatch, SetStateAction, useCallback, useRef } from "react";
|
import { Dispatch, SetStateAction, useCallback, useRef } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { StyleSheet, TouchableOpacity, useWindowDimensions, View } from 'react-native';
|
import { Image, StyleSheet, TouchableOpacity, useWindowDimensions, View } from 'react-native';
|
||||||
import { createNewConversation } from "./utils";
|
import { createNewConversation } from "./utils";
|
||||||
|
|
||||||
interface AskHelloProps {
|
interface AskHelloProps {
|
||||||
@ -48,21 +47,21 @@ export default function AskHello({ setUserMessages, setConversationId, setIsHell
|
|||||||
}
|
}
|
||||||
|
|
||||||
setConversationId(sessionId);
|
setConversationId(sessionId);
|
||||||
try {
|
// try {
|
||||||
if (webSocketManager && typeof (webSocketManager as any).send === 'function') {
|
// if (webSocketManager && typeof (webSocketManager as any).send === 'function') {
|
||||||
(webSocketManager as any).send({
|
// (webSocketManager as any).send({
|
||||||
type: 'Chat',
|
// type: 'Chat',
|
||||||
session_id: sessionId,
|
// session_id: sessionId,
|
||||||
message: text
|
// message: text
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
throw new Error('WebSocket manager is not ready');
|
// throw new Error('WebSocket manager is not ready');
|
||||||
}
|
// }
|
||||||
} catch (wsErr) {
|
// } catch (wsErr) {
|
||||||
console.error('WebSocket send failed:', wsErr);
|
// console.error('WebSocket send failed:', wsErr);
|
||||||
//
|
// //
|
||||||
setUserMessages(prev => prev.filter(item => item.content !== 'keepSearchIng'));
|
// setUserMessages(prev => prev.filter(item => item.content !== 'keepSearchIng'));
|
||||||
}
|
// }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('handleCase failed:', err);
|
console.error('handleCase failed:', err);
|
||||||
//
|
//
|
||||||
@ -89,9 +88,9 @@ export default function AskHello({ setUserMessages, setConversationId, setIsHell
|
|||||||
{"\n"}
|
{"\n"}
|
||||||
{t('ask.iAmMemo', { ns: 'ask' })}
|
{t('ask.iAmMemo', { ns: 'ask' })}
|
||||||
</ThemedText>
|
</ThemedText>
|
||||||
{/* <View>
|
<View>
|
||||||
<Image source={require('@/assets/images/png/icon/ip.png')} style={{ width: width * 0.5, height: height * 0.3 }} />
|
<Image source={require('@/assets/images/png/icon/ip.png')} style={{ width: width * 0.5, height: height * 0.3 }} />
|
||||||
</View> */}
|
</View>
|
||||||
<ThemedText className="!text-textPrimary text-center -mt-10" style={{ fontSize: 16 }}>
|
<ThemedText className="!text-textPrimary text-center -mt-10" style={{ fontSize: 16 }}>
|
||||||
{t('ask.ready', { ns: 'ask' })}
|
{t('ask.ready', { ns: 'ask' })}
|
||||||
{"\n"}
|
{"\n"}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user