修复新用户首次进入联系客服页面发送信息报错问题

This commit is contained in:
yezian 2024-07-29 14:52:58 +08:00
parent e4ac08b77e
commit b73a6120b7
1 changed files with 4 additions and 2 deletions

View File

@ -210,6 +210,7 @@ export default function MessageDetail({ navigation, route }) {
return;
}
setSessionId(createData.data.session_id);
return createData.data.session_id;
} catch (error) {
console.error(error);
}
@ -392,7 +393,8 @@ export default function MessageDetail({ navigation, route }) {
}
//session
if (!sessionId) await createSession();
let _sessionId;
if (!sessionId) _sessionId = await createSession();
//
setOffset((prev) => prev + 1);
@ -414,7 +416,7 @@ export default function MessageDetail({ navigation, route }) {
"Content-Type": "application/json",
},
body: JSON.stringify({
session_id: sessionId,
session_id: sessionId ? sessionId : _sessionId,
predicate: 0,
message: messages[0].text,
...base,