xia
This commit is contained in:
parent
35a6f8eacb
commit
780fc293e4
@ -3,7 +3,6 @@ import Chat from "@/components/ask/chat";
|
||||
import AskHello from "@/components/ask/hello";
|
||||
import SendMessage from "@/components/ask/send";
|
||||
import { ThemedText } from "@/components/ThemedText";
|
||||
import { fetchApi } from "@/lib/server-api-util";
|
||||
import { WEBSOCKET_ENDPOINT } from "@/lib/websocket-util";
|
||||
import { Message } from "@/types/ask";
|
||||
import { useFocusEffect, useLocalSearchParams, useRouter } from "expo-router";
|
||||
@ -175,32 +174,32 @@ export default function AskScreen() {
|
||||
// fadeAnimChat.value = withTiming(isHello ? 0 : 1, { duration: 300 });
|
||||
// }, [isHello]);
|
||||
|
||||
useEffect(() => {
|
||||
if (sessionId && isMountedRef.current) {
|
||||
setConversationId(sessionId);
|
||||
setIsHello(false);
|
||||
// useEffect(() => {
|
||||
// if (sessionId && isMountedRef.current) {
|
||||
// setConversationId(sessionId);
|
||||
// setIsHello(false);
|
||||
|
||||
// 创建新的AbortController
|
||||
abortControllerRef.current = new AbortController();
|
||||
// // 创建新的AbortController
|
||||
// abortControllerRef.current = new AbortController();
|
||||
|
||||
fetchApi<Message[]>(`/chats/${sessionId}/message-history`, {
|
||||
signal: abortControllerRef.current.signal
|
||||
}).then((res) => {
|
||||
if (isMountedRef.current) {
|
||||
console.log("isMountedRef.current", isMountedRef.current)
|
||||
setUserMessages(res);
|
||||
}
|
||||
}).catch((error) => {
|
||||
if (error.name !== 'AbortError') {
|
||||
console.error('获取消息历史失败:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (newSession && isMountedRef.current) {
|
||||
setIsHello(true);
|
||||
setConversationId(null);
|
||||
}
|
||||
}, [sessionId, newSession]);
|
||||
// fetchApi<Message[]>(`/chats/${sessionId}/message-history`, {
|
||||
// signal: abortControllerRef.current.signal
|
||||
// }).then((res) => {
|
||||
// if (isMountedRef.current) {
|
||||
// console.log("isMountedRef.current", isMountedRef.current)
|
||||
// setUserMessages(res);
|
||||
// }
|
||||
// }).catch((error) => {
|
||||
// if (error.name !== 'AbortError') {
|
||||
// console.error('获取消息历史失败:', error);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// if (newSession && isMountedRef.current) {
|
||||
// setIsHello(true);
|
||||
// setConversationId(null);
|
||||
// }
|
||||
// }, [sessionId, newSession]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isHello && isMountedRef.current) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user