Open caoqinen opened 4 months ago
我也遇到了这个问题
我也遇到了这个问题
实名制,三个key的顺序 解决了就好了
实名制,三个key的顺序 解决了就好了
不行,我全都正确的,也修改了大模型的版本号,仍然报错。使用的是最新代码
实名制,三个key的顺序 解决了就好了
讯飞账号已经实名制了 “三个key的顺序“ 是什么意思
打印一下返回就知道了,两个点,1、你的聊天剩余够不够,讯飞送了一年的可以直接领,lite是全免费;2、xunfei.js里面的const httpUrl = new URL('https://spark-api.xf-yun.com')这个地址改成你有剩余token的模型右下角的api地址,项目里的默认的是Spark Max的模型
打印一下返回就知道了,两个点,1、你的聊天剩余够不够,讯飞送了一年的可以直接领,lite是全免费;2、xunfei.js里面的const httpUrl = new URL('https://spark-api.xf-yun.com')这个地址改成你有剩余token的模型右下角的api地址,项目里的默认的是Spark%E8%BF%99%E4%B8%AA%E5%9C%B0%E5%9D%80%E6%94%B9%E6%88%90%E4%BD%A0%E6%9C%89%E5%89%A9%E4%BD%99token%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%8F%B3%E4%B8%8B%E8%A7%92%E7%9A%84api%E5%9C%B0%E5%9D%80%EF%BC%8C%E9%A1%B9%E7%9B%AE%E9%87%8C%E7%9A%84%E9%BB%98%E8%AE%A4%E7%9A%84%E6%98%AFSpark) Max的模型
还有一个地方需要改,在后面的 switch (httpUrl.pathname)
里面需要加入你的模型的modelDomain,比如我使用的是Spark4.0 Ultra SDK,我就要在下面加入case '/v4.0/chat': modelDomain = '4.0Ultra' break
如下: {
case '/v1.1/chat':
modelDomain = 'general'
break
case '/v2.1/chat':
modelDomain = 'generalv2'
break
case '/v3.1/chat':
modelDomain = 'generalv3'
break
case '/v3.5/chat':
modelDomain = 'generalv3.5'
break
case '/v4.0/chat':
modelDomain = '4.0Ultra'
break
}
❌ uncaughtException 捕获到未处理的异常: TypeError: Cannot read properties of undefined (reading 'choices') at WebSocket. (file:///D:/wechat-bot-main/src/xunfei/xunfei.js:93:33)
at callListener (D:\wechat-bot-main\node_modules\ws\lib\event-target.js:290:14)
at WebSocket.onMessage (D:\wechat-bot-main\node_modules\ws\lib\event-target.js:209:9)
at WebSocket.emit (node:events:519:28)
at Receiver.receiverOnMessage (D:\wechat-bot-main\node_modules\ws\lib\websocket.js:1220:20)
at Receiver.emit (node:events:519:28)
at Receiver.dataMessage (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:596:14)
at Receiver.getData (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:496:10)
at Receiver.startLoop (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:167:16)
at Receiver._write (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:94:10)
uncaughtException TypeError: Cannot read properties of undefined (reading 'choices')
at WebSocket. (file:///D:/wechat-bot-main/src/xunfei/xunfei.js:93:33)
at callListener (D:\wechat-bot-main\node_modules\ws\lib\event-target.js:290:14)
at WebSocket.onMessage (D:\wechat-bot-main\node_modules\ws\lib\event-target.js:209:9)
at WebSocket.emit (node:events:519:28)
at Receiver.receiverOnMessage (D:\wechat-bot-main\node_modules\ws\lib\websocket.js:1220:20)
at Receiver.emit (node:events:519:28)
at Receiver.dataMessage (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:596:14)
at Receiver.getData (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:496:10)
at Receiver.startLoop (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:167:16)
at Receiver._write (D:\wechat-bot-main\node_modules\ws\lib\receiver.js:94:10)