From b73a6120b7400f4c539a685998ad7c6bee686065 Mon Sep 17 00:00:00 2001 From: yezian Date: Mon, 29 Jul 2024 14:52:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E8=BF=9B=E5=85=A5=E8=81=94=E7=B3=BB=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E9=A1=B5=E9=9D=A2=E5=8F=91=E9=80=81=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- screeens/Messages/MessageDetail/index.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/screeens/Messages/MessageDetail/index.jsx b/screeens/Messages/MessageDetail/index.jsx index 1d3212c..2f14035 100644 --- a/screeens/Messages/MessageDetail/index.jsx +++ b/screeens/Messages/MessageDetail/index.jsx @@ -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,