From dbac69281a6af8772d1f993c9ba729e3eed51762 Mon Sep 17 00:00:00 2001 From: yma16 <17685043634@163.com> Date: Thu, 4 Apr 2024 00:31:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/pages/aiBot/aiBot.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/miniprogram/pages/aiBot/aiBot.js b/miniprogram/pages/aiBot/aiBot.js index 442dab4..98e2e9c 100644 --- a/miniprogram/pages/aiBot/aiBot.js +++ b/miniprogram/pages/aiBot/aiBot.js @@ -110,9 +110,13 @@ Page({ }) }, + saveStore() { + + }, + search(e) { this.scrollToBottom() - if(this.data.isLoading){ + if (this.data.isLoading) { wx.showModal({ cancelColor: 'cancelColor', title: '正在响应中,请稍等...' @@ -172,13 +176,18 @@ Page({ that.scrollToBottom() resolve(res) console.log('that.data.chatObjConfig.option', that.data.chatObjConfig.option) - + that.saveStore() }, fail: error => { + that.setData({ isLoading: false }) wx.hideLoading() + wx.showModal({ + cancelColor: 'cancelColor', + title: '网络波动失败...' + }) } }); }) @@ -212,11 +221,11 @@ Page({ } // 缓存 - const openAiOptionsConfig = wx.getStorageSync(this.data.saveKey) + const chatObjConfig = wx.getStorageSync(this.data.saveKey) - if (openAiOptionsConfig) { + if (chatObjConfig) { this.setData({ - chatObjConfig: openAiOptionsConfig, + chatObjConfig: chatObjConfig, }) } @@ -249,8 +258,8 @@ Page({ onUnload() { // 缓存 - if (this.data.openAiOptionsConfig) { - wx.setStorageSync(app.wxProgramConfig.aiBotConfig.saveKey, this.data.openAiOptionsConfig) + if (this.data.chatObjConfig) { + wx.setStorageSync(app.wxProgramConfig.aiBotConfig.saveKey, this.data.chatObjConfig) } }, -- GitLab