不知道什么原因,倒腾一圈又可以用了。
openaiwidget 从1.0.6升级到1.1.8版本不能用问题[代码]//app.js[代码][代码]var[代码] [代码]plugin = requirePlugin([代码][代码]"chatbot"[代码][代码]);[代码][代码]App({[代码][代码] [代码][代码]onLaunch: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]// 展示本地存储能力[代码][代码] [代码][代码]var[代码] [代码]logs = wx.getStorageSync([代码][代码]'logs'[代码][代码]) || [][代码][代码] [代码][代码]logs.unshift(Date.now())[代码][代码] [代码][代码]wx.setStorageSync([代码][代码]'logs'[代码][代码], logs)[代码][代码] [代码] [代码] [代码][代码]//ai插件初始化[代码][代码] [代码][代码]plugin.init({[代码][代码] [代码][代码]//是在 openai.weixin.qq.com 注册的机器人账号对应的 appid 在 设置-服务接入-小程序接入[代码][代码] [代码][代码]// appid: "fNvTN5LKrRVnmWD7851yM2LDIuegc4", [代码][代码] [代码][代码]appid: [代码][代码]"fNvTN5LKrRVnmWD7851yM2LDIuegc4"[代码][代码], [代码][代码]//小程序示例账户,仅供学习和参考 [代码][代码] [代码][代码]openid: [代码][代码]""[代码][代码],[代码][代码]//用户的openid,非必填,建议传递该参数[代码][代码] [代码][代码]success: () => { }, [代码][代码]//非必填[代码][代码] [代码][代码]fail: error => { } [代码][代码]//非必填[代码][代码] [代码][代码]// guideList: ["查工作梯", '查拖机棒', '查工具箱','更换电池'],[代码][代码] [代码][代码]});[代码] [代码]"permission"[代码][代码]: {[代码][代码] [代码][代码]"scope.userLocation"[代码][代码]: {[代码][代码] [代码][代码]"desc"[代码][代码]: [代码][代码]"使用地图展示附近设备位置"[代码][代码] [代码][代码]}[代码][代码]},[代码][代码]"plugins"[代码][代码]: {[代码][代码] [代码][代码]"chatbot"[代码][代码]: {[代码][代码] [代码][代码]"version"[代码][代码]: [代码][代码]"1.1.8"[代码][代码],[代码][代码] [代码][代码]"provider"[代码][代码]: [代码][代码]"wx8c631f7e9f2465e1"[代码][代码] [代码][代码]},[代码][代码] [代码][代码]"WechatSI"[代码][代码]: {[代码][代码] [代码][代码]"version"[代码][代码]: [代码][代码]"0.3.1"[代码][代码],[代码][代码] [代码][代码]"provider"[代码][代码]: [代码][代码]"wx069ba97219f66d99"[代码][代码] [代码][代码]}[代码][代码]},[代码][代码]<[代码][代码]view[代码] [代码]style[代码][代码]=[代码][代码]"height: 100vh"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]chat[代码] [代码]bind:backHome[代码][代码]=[代码][代码]"goBackHome"[代码] [代码]bind:queryCallback[代码][代码]=[代码][代码]"getQueryCallback"[代码] [代码]/>[代码][代码]</[代码][代码]view[代码][代码]>[代码][代码]{[代码][代码] [代码][代码]"component"[代码][代码]: [代码][代码]true[代码][代码],[代码][代码] [代码][代码]"usingComponents"[代码][代码]: {[代码][代码] [代码][代码]"chat"[代码][代码]: [代码][代码]"plugin://chatbot/chat"[代码][代码] [代码][代码]}[代码][代码]}[代码][代码] [代码][代码]// goBackHome回调 返回上一级页面[代码][代码] [代码][代码]goBackHome: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]wx.navigateBack({[代码][代码] [代码][代码]delta: 1[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] [代码]// getQueryCallback回调 返回query与结果[代码][代码] [代码][代码]getQueryCallback: [代码][代码]function[代码] [代码](e) {[代码][代码] [代码][代码]/**[代码][代码] [代码][代码].....[代码][代码]*/[代码][代码]}[代码] 升级到1.1.4以上版本都报以下错 如:1.1.8 [图片] [图片] 点击“继续执行脚本” [图片]
2019-12-17