修复新用户首次进入联系客服页面发送信息报错问题
This commit is contained in:
parent
e4ac08b77e
commit
b73a6120b7
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue