zydx-plus 1.35.565 → 1.35.566
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 +1 -1
- package/src/components/chat/src/chat.vue +28 -2
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -333,8 +333,34 @@ export default {
|
|
|
333
333
|
sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
|
|
334
334
|
numChannels: 1, // 声道,支持 1 或 2, 默认是1
|
|
335
335
|
})
|
|
336
|
-
const
|
|
337
|
-
|
|
336
|
+
const ais = this.getCookie('aiToken');
|
|
337
|
+
if(ais) {
|
|
338
|
+
this.token = ais
|
|
339
|
+
}else {
|
|
340
|
+
const token = await this.getAccessToken('ai')
|
|
341
|
+
this.setCookie('aiToken', token.data.data, 60)
|
|
342
|
+
this.token = token.data.data
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
setCookie(name, value, minutes) {
|
|
346
|
+
let now = new Date();
|
|
347
|
+
now.setMinutes(now.getMinutes() + minutes);
|
|
348
|
+
document.cookie = name + '=' + value + ';expires=' + now.toUTCString();
|
|
349
|
+
},
|
|
350
|
+
getCookie(cname) {
|
|
351
|
+
let name = cname + "=";
|
|
352
|
+
let decodedCookie = decodeURIComponent(document.cookie);
|
|
353
|
+
let ca = decodedCookie.split(';');
|
|
354
|
+
for(let i = 0; i < ca.length; i++) {
|
|
355
|
+
let c = ca[i];
|
|
356
|
+
while (c.charAt(0) === ' ') {
|
|
357
|
+
c = c.substring(1);
|
|
358
|
+
}
|
|
359
|
+
if (c.indexOf(name) === 0) {
|
|
360
|
+
return c.substring(name.length, c.length);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return "";
|
|
338
364
|
},
|
|
339
365
|
async getAccessToken(v) {
|
|
340
366
|
return axios({
|