wechaty-web-panel 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -157,13 +157,17 @@ function getFormatReply(answer, options = [], userInfo, puppetType) {
157
157
 
158
158
  async function getTencentOpenReply({ msg, id, userInfo }) {
159
159
  const config = await allConfig()
160
+ if (!config.tencentAESKey || !config.tencentToken) {
161
+ console.log('请到智能微秘书平台配置AESKey 和token 参数方可使用')
162
+ return [{ type: 1, content: '请到平台配置AESKey 和token 参数方可使用' }]
163
+ }
160
164
  try {
161
165
  const signature = await getSignature(id, config.tencentAESKey)
162
166
  const data = {
163
167
  signature,
164
168
  query: msg,
165
169
  }
166
- const res = await axios.post(`https://openai.weixin.qq.com/openapi/aibot/eTZV8kYIvKnmvQJgXsy7e7f3WDWeGf`, data, {})
170
+ const res = await axios.post(`https://openai.weixin.qq.com/openapi/aibot/${config.tencentToken}`, data, {})
167
171
  const resData = res.data
168
172
  if (!resData.errcode) {
169
173
  let answer = resData.answer // 存放回答
@@ -211,6 +215,8 @@ async function getTencentOpenReply({ msg, id, userInfo }) {
211
215
  ]
212
216
  }
213
217
  }
218
+ } else {
219
+ console.log('微信开放对话平台报错:', resData.errcode + resData.errmsg)
214
220
  }
215
221
  } catch (e) {
216
222
  console.log('error', e)