pcm-agents 0.3.0 → 0.3.2
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/LICENSE +21 -21
- package/dist/cjs/index-BFPEnLbS.js +195 -0
- package/dist/cjs/index-BFPEnLbS.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/my-component.cjs.entry.js +2 -2
- package/dist/cjs/my-component.cjs.entry.js.map +1 -1
- package/dist/cjs/my-component.entry.cjs.js.map +1 -1
- package/dist/cjs/pcm-agents.cjs.js +1 -1
- package/dist/cjs/pcm-app-chat-modal.pcm-chat-message.pcm-hr-chat-modal.pcm-jlpx-modal.pcm-mnms-modal.pcm-video-chat-modal.pcm-zygh-modal.entry.cjs.js.map +1 -0
- package/dist/cjs/pcm-app-chat-modal_7.cjs.entry.js +6560 -0
- package/dist/cjs/pcm-app-chat-modal_7.cjs.entry.js.map +1 -0
- package/dist/cjs/pcm-chat-modal.cjs.entry.js +17 -32
- package/dist/cjs/pcm-chat-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/pcm-chat-modal.entry.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/my-component/my-component.css +3 -3
- package/dist/collection/components/my-component/my-component.js +1 -1
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.css +2 -1
- package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js +137 -159
- package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-chat-message/pcm-chat-message.css +66 -12
- package/dist/collection/components/pcm-chat-message/pcm-chat-message.js +106 -13
- package/dist/collection/components/pcm-chat-message/pcm-chat-message.js.map +1 -1
- package/dist/collection/components/pcm-chat-modal/pcm-chat-modal.js +39 -34
- package/dist/collection/components/pcm-chat-modal/pcm-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-hr-chat-modal/pcm-hr-chat-modal.js +76 -105
- package/dist/collection/components/pcm-hr-chat-modal/pcm-hr-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-jlpx-modal/pcm-jlpx-modal.css +162 -0
- package/dist/collection/components/pcm-jlpx-modal/pcm-jlpx-modal.js +616 -0
- package/dist/collection/components/pcm-jlpx-modal/pcm-jlpx-modal.js.map +1 -0
- package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.css +0 -79
- package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js +133 -81
- package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js.map +1 -1
- package/dist/collection/components/pcm-video-chat-modal/pcm-video-chat-modal.js +77 -101
- package/dist/collection/components/pcm-video-chat-modal/pcm-video-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.css +273 -0
- package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js +613 -0
- package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js.map +1 -0
- package/dist/collection/global/global.css +324 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/interfaces/chat.js.map +1 -1
- package/dist/collection/utils/utils.js +54 -113
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/index.js +1298 -11280
- package/dist/components/index.js.map +1 -1
- package/dist/components/my-component.js +2 -3
- package/dist/components/my-component.js.map +1 -1
- package/dist/components/{p-C4l_DOnx.js → p-BctfuDvG.js} +106 -147
- package/dist/components/p-BctfuDvG.js.map +1 -0
- package/dist/components/{p-D0s1Q-3O.js → p-LkDC0SN2.js} +343 -16
- package/dist/components/p-LkDC0SN2.js.map +1 -0
- package/dist/components/pcm-app-chat-modal.js +1 -1
- package/dist/components/pcm-chat-message.js +1 -1
- package/dist/components/pcm-chat-modal.js +19 -34
- package/dist/components/pcm-chat-modal.js.map +1 -1
- package/dist/components/pcm-hr-chat-modal.js +70 -100
- package/dist/components/pcm-hr-chat-modal.js.map +1 -1
- package/dist/components/pcm-jlpx-modal.d.ts +11 -0
- package/dist/components/pcm-jlpx-modal.js +339 -0
- package/dist/components/pcm-jlpx-modal.js.map +1 -0
- package/dist/components/pcm-mnms-modal.js +109 -57
- package/dist/components/pcm-mnms-modal.js.map +1 -1
- package/dist/components/pcm-video-chat-modal.js +74 -99
- package/dist/components/pcm-video-chat-modal.js.map +1 -1
- package/dist/components/pcm-zygh-modal.d.ts +11 -0
- package/dist/components/pcm-zygh-modal.js +330 -0
- package/dist/components/pcm-zygh-modal.js.map +1 -0
- package/dist/esm/index-nVjZGfA8.js +189 -0
- package/dist/esm/index-nVjZGfA8.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/my-component.entry.js +2 -2
- package/dist/esm/my-component.entry.js.map +1 -1
- package/dist/esm/pcm-agents.js +1 -1
- package/dist/esm/pcm-app-chat-modal.pcm-chat-message.pcm-hr-chat-modal.pcm-jlpx-modal.pcm-mnms-modal.pcm-video-chat-modal.pcm-zygh-modal.entry.js.map +1 -0
- package/dist/esm/pcm-app-chat-modal_7.entry.js +6552 -0
- package/dist/esm/pcm-app-chat-modal_7.entry.js.map +1 -0
- package/dist/esm/pcm-chat-modal.entry.js +17 -32
- package/dist/esm/pcm-chat-modal.entry.js.map +1 -1
- package/dist/pcm-agents/index.esm.js +1 -1
- package/dist/pcm-agents/my-component.entry.esm.js.map +1 -1
- package/dist/pcm-agents/p-55417392.entry.js +2 -0
- package/dist/pcm-agents/p-55417392.entry.js.map +1 -0
- package/dist/pcm-agents/p-a698b59f.entry.js +2 -0
- package/dist/pcm-agents/p-a698b59f.entry.js.map +1 -0
- package/dist/pcm-agents/p-f3ca99b4.entry.js +2 -0
- package/dist/pcm-agents/p-f3ca99b4.entry.js.map +1 -0
- package/dist/pcm-agents/p-nVjZGfA8.js +2 -0
- package/dist/pcm-agents/p-nVjZGfA8.js.map +1 -0
- package/dist/pcm-agents/pcm-agents.esm.js +1 -1
- package/dist/pcm-agents/pcm-app-chat-modal.pcm-chat-message.pcm-hr-chat-modal.pcm-jlpx-modal.pcm-mnms-modal.pcm-video-chat-modal.pcm-zygh-modal.entry.esm.js.map +1 -0
- package/dist/pcm-agents/pcm-chat-modal.entry.esm.js.map +1 -1
- package/dist/types/components/pcm-app-chat-modal/pcm-app-chat-modal.d.ts +13 -8
- package/dist/types/components/pcm-chat-message/pcm-chat-message.d.ts +5 -0
- package/dist/types/components/pcm-chat-modal/pcm-chat-modal.d.ts +8 -8
- package/dist/types/components/pcm-hr-chat-modal/pcm-hr-chat-modal.d.ts +6 -12
- package/dist/types/components/pcm-jlpx-modal/pcm-jlpx-modal.d.ts +113 -0
- package/dist/types/components/pcm-mnms-modal/pcm-mnms-modal.d.ts +19 -20
- package/dist/types/components/pcm-video-chat-modal/pcm-video-chat-modal.d.ts +4 -4
- package/dist/types/components/pcm-zygh-modal/pcm-zygh-modal.d.ts +117 -0
- package/dist/types/components.d.ts +429 -80
- package/dist/types/interfaces/chat.d.ts +0 -4
- package/dist/types/utils/utils.d.ts +29 -83
- package/package.json +61 -60
- package/readme.md +307 -307
- package/dist/cjs/index-DfIUl99H.js +0 -11413
- package/dist/cjs/index-DfIUl99H.js.map +0 -1
- package/dist/cjs/pcm-app-chat-modal.pcm-chat-message.pcm-mnms-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/pcm-app-chat-modal_3.cjs.entry.js +0 -3734
- package/dist/cjs/pcm-app-chat-modal_3.cjs.entry.js.map +0 -1
- package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js +0 -1078
- package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js.map +0 -1
- package/dist/cjs/pcm-hr-chat-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/pcm-video-chat-modal.cjs.entry.js +0 -927
- package/dist/cjs/pcm-video-chat-modal.cjs.entry.js.map +0 -1
- package/dist/cjs/pcm-video-chat-modal.entry.cjs.js.map +0 -1
- package/dist/components/p-C4l_DOnx.js.map +0 -1
- package/dist/components/p-CgDy4pJp.js +0 -1244
- package/dist/components/p-CgDy4pJp.js.map +0 -1
- package/dist/components/p-D0s1Q-3O.js.map +0 -1
- package/dist/esm/index-B2EtEi7v.js +0 -11409
- package/dist/esm/index-B2EtEi7v.js.map +0 -1
- package/dist/esm/pcm-app-chat-modal.pcm-chat-message.pcm-mnms-modal.entry.js.map +0 -1
- package/dist/esm/pcm-app-chat-modal_3.entry.js +0 -3730
- package/dist/esm/pcm-app-chat-modal_3.entry.js.map +0 -1
- package/dist/esm/pcm-hr-chat-modal.entry.js +0 -1076
- package/dist/esm/pcm-hr-chat-modal.entry.js.map +0 -1
- package/dist/esm/pcm-video-chat-modal.entry.js +0 -925
- package/dist/esm/pcm-video-chat-modal.entry.js.map +0 -1
- package/dist/pcm-agents/p-0ddd5c47.entry.js +0 -2
- package/dist/pcm-agents/p-0ddd5c47.entry.js.map +0 -1
- package/dist/pcm-agents/p-5f624943.entry.js +0 -2
- package/dist/pcm-agents/p-5f624943.entry.js.map +0 -1
- package/dist/pcm-agents/p-6c07f155.entry.js +0 -2
- package/dist/pcm-agents/p-6c07f155.entry.js.map +0 -1
- package/dist/pcm-agents/p-9a1fb6ca.entry.js +0 -2
- package/dist/pcm-agents/p-9a1fb6ca.entry.js.map +0 -1
- package/dist/pcm-agents/p-B2EtEi7v.js +0 -146
- package/dist/pcm-agents/p-B2EtEi7v.js.map +0 -1
- package/dist/pcm-agents/p-e21bc169.entry.js +0 -2
- package/dist/pcm-agents/p-e21bc169.entry.js.map +0 -1
- package/dist/pcm-agents/pcm-app-chat-modal.pcm-chat-message.pcm-mnms-modal.entry.esm.js.map +0 -1
- package/dist/pcm-agents/pcm-hr-chat-modal.entry.esm.js.map +0 -1
- package/dist/pcm-agents/pcm-video-chat-modal.entry.esm.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { convertWorkflowStreamNodeToMessageRound, sendSSERequest, sendHttpRequest } from "../../utils/utils";
|
|
2
|
+
import { convertWorkflowStreamNodeToMessageRound, sendSSERequest, sendHttpRequest, uploadFileToBackend, API_DOMAIN } from "../../utils/utils";
|
|
3
3
|
export class VideoChatModal {
|
|
4
4
|
/**
|
|
5
5
|
* 模态框标题
|
|
@@ -8,7 +8,7 @@ export class VideoChatModal {
|
|
|
8
8
|
/**
|
|
9
9
|
* API鉴权密钥
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
token = '';
|
|
12
12
|
/**
|
|
13
13
|
* 是否显示聊天模态框
|
|
14
14
|
*/
|
|
@@ -38,7 +38,7 @@ export class VideoChatModal {
|
|
|
38
38
|
*/
|
|
39
39
|
isNeedClose = true;
|
|
40
40
|
/**
|
|
41
|
-
* 会话ID
|
|
41
|
+
* 会话ID,传入继续对话,否则创建新会话
|
|
42
42
|
*/
|
|
43
43
|
conversationId;
|
|
44
44
|
/**
|
|
@@ -61,7 +61,7 @@ export class VideoChatModal {
|
|
|
61
61
|
// 添加新的 Event
|
|
62
62
|
streamComplete;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* 首次对话提问文本
|
|
65
65
|
*/
|
|
66
66
|
defaultQuery = '';
|
|
67
67
|
// 添加新的状态
|
|
@@ -109,7 +109,7 @@ export class VideoChatModal {
|
|
|
109
109
|
countdownWarningTime = 30;
|
|
110
110
|
showCountdownWarning = false;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* 是否以全屏模式打开,移动端建议设置为true
|
|
113
113
|
*/
|
|
114
114
|
fullscreen = false;
|
|
115
115
|
// 添加新的状态来跟踪视频上传
|
|
@@ -190,6 +190,7 @@ export class VideoChatModal {
|
|
|
190
190
|
response_mode: 'streaming',
|
|
191
191
|
conversation_id: this.conversationId,
|
|
192
192
|
query: queryText,
|
|
193
|
+
bot_id: "3022316191018903",
|
|
193
194
|
inputs: {
|
|
194
195
|
id: this.resumeId
|
|
195
196
|
}
|
|
@@ -199,10 +200,10 @@ export class VideoChatModal {
|
|
|
199
200
|
requestData.inputs.video_url = videoUrl;
|
|
200
201
|
}
|
|
201
202
|
await sendSSERequest({
|
|
202
|
-
url:
|
|
203
|
+
url: `/sdk/v1/chat/chat-messages`,
|
|
203
204
|
method: 'POST',
|
|
204
205
|
headers: {
|
|
205
|
-
'authorization': 'Bearer ' + this.
|
|
206
|
+
'authorization': 'Bearer ' + this.token
|
|
206
207
|
},
|
|
207
208
|
data: requestData,
|
|
208
209
|
onMessage: (data) => {
|
|
@@ -328,57 +329,45 @@ export class VideoChatModal {
|
|
|
328
329
|
this.isLoadingHistory = true;
|
|
329
330
|
console.log('加载历史消息...');
|
|
330
331
|
try {
|
|
331
|
-
await sendHttpRequest({
|
|
332
|
-
url:
|
|
332
|
+
const result = await sendHttpRequest({
|
|
333
|
+
url: '/sdk/v1/chat/messages',
|
|
333
334
|
method: 'GET',
|
|
334
335
|
headers: {
|
|
335
|
-
'authorization': 'Bearer ' + this.
|
|
336
|
+
'authorization': 'Bearer ' + this.token
|
|
336
337
|
},
|
|
337
338
|
data: {
|
|
338
339
|
conversation_id: this.conversationId,
|
|
340
|
+
bot_id: "3022316191018903",
|
|
339
341
|
limit: 20
|
|
340
|
-
},
|
|
341
|
-
onMessage: (data) => {
|
|
342
|
-
if (data.data) {
|
|
343
|
-
const historyData = data.data || [];
|
|
344
|
-
const formattedMessages = historyData.map(msg => {
|
|
345
|
-
const time = new Date(msg.created_at * 1000);
|
|
346
|
-
const hours = time.getHours().toString().padStart(2, '0');
|
|
347
|
-
const minutes = time.getMinutes().toString().padStart(2, '0');
|
|
348
|
-
const timeStr = `${hours}:${minutes}`;
|
|
349
|
-
// 创建新的消息对象,不包含 inputs 字段
|
|
350
|
-
const { inputs, ...msgWithoutInputs } = msg;
|
|
351
|
-
return {
|
|
352
|
-
...msgWithoutInputs,
|
|
353
|
-
time: timeStr,
|
|
354
|
-
isStreaming: false,
|
|
355
|
-
status: msg.status === 'error' ? 'error' : 'normal'
|
|
356
|
-
};
|
|
357
|
-
});
|
|
358
|
-
this.messages = formattedMessages;
|
|
359
|
-
this.isLoadingHistory = false;
|
|
360
|
-
requestAnimationFrame(() => {
|
|
361
|
-
this.shouldAutoScroll = true;
|
|
362
|
-
this.scrollToBottom();
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
this.isLoadingHistory = false;
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
onError: (error) => {
|
|
370
|
-
console.error('加载历史消息失败:', error);
|
|
371
|
-
alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');
|
|
372
|
-
this.isLoadingHistory = false;
|
|
373
|
-
},
|
|
374
|
-
onComplete: () => {
|
|
375
|
-
this.isLoadingHistory = false;
|
|
376
342
|
}
|
|
377
343
|
});
|
|
344
|
+
if (result.success && result.data) {
|
|
345
|
+
const historyData = result.data.data;
|
|
346
|
+
const formattedMessages = historyData.map(msg => {
|
|
347
|
+
const time = new Date(msg.created_at * 1000);
|
|
348
|
+
const hours = time.getHours().toString().padStart(2, '0');
|
|
349
|
+
const minutes = time.getMinutes().toString().padStart(2, '0');
|
|
350
|
+
const timeStr = `${hours}:${minutes}`;
|
|
351
|
+
const { inputs, ...msgWithoutInputs } = msg;
|
|
352
|
+
return {
|
|
353
|
+
...msgWithoutInputs,
|
|
354
|
+
time: timeStr,
|
|
355
|
+
isStreaming: false,
|
|
356
|
+
status: msg.status === 'error' ? 'error' : 'normal'
|
|
357
|
+
};
|
|
358
|
+
});
|
|
359
|
+
this.messages = formattedMessages;
|
|
360
|
+
requestAnimationFrame(() => {
|
|
361
|
+
this.shouldAutoScroll = true;
|
|
362
|
+
this.scrollToBottom();
|
|
363
|
+
});
|
|
364
|
+
}
|
|
378
365
|
}
|
|
379
366
|
catch (error) {
|
|
380
367
|
console.error('加载历史消息失败:', error);
|
|
381
368
|
alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');
|
|
369
|
+
}
|
|
370
|
+
finally {
|
|
382
371
|
this.isLoadingHistory = false;
|
|
383
372
|
}
|
|
384
373
|
}
|
|
@@ -649,32 +638,29 @@ export class VideoChatModal {
|
|
|
649
638
|
this.videoRef = null;
|
|
650
639
|
}
|
|
651
640
|
}
|
|
652
|
-
//
|
|
641
|
+
// 修改上传录制的视频方法
|
|
653
642
|
async uploadRecordedVideo() {
|
|
654
643
|
if (!this.recordedBlob)
|
|
655
644
|
return;
|
|
656
645
|
try {
|
|
657
|
-
this.isUploadingVideo = true;
|
|
658
|
-
this.showRecordingUI = false;
|
|
646
|
+
this.isUploadingVideo = true;
|
|
647
|
+
this.showRecordingUI = false;
|
|
659
648
|
// 根据Blob类型确定文件扩展名
|
|
660
649
|
const fileExtension = this.recordedBlob.type.includes('webm') ? 'webm' : 'mp4';
|
|
661
650
|
const fileName = `answer.${fileExtension}`;
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
'authorization': 'Bearer ' + this.apiKey
|
|
668
|
-
},
|
|
669
|
-
body: formData
|
|
651
|
+
// 创建File对象
|
|
652
|
+
const file = new File([this.recordedBlob], fileName, { type: this.recordedBlob.type });
|
|
653
|
+
// 使用uploadFileToBackend上传文件
|
|
654
|
+
const uploadResult = await uploadFileToBackend(file, {
|
|
655
|
+
'authorization': 'Bearer ' + this.token
|
|
670
656
|
});
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
if (
|
|
657
|
+
console.log('视频上传结果:', uploadResult);
|
|
658
|
+
// 使用 cos_key 作为视频标识符
|
|
659
|
+
if (uploadResult.cos_key) {
|
|
674
660
|
// 调用音频转文字API
|
|
675
|
-
const transcriptionText = await this.convertAudioToText(
|
|
661
|
+
const transcriptionText = await this.convertAudioToText(uploadResult.cos_key);
|
|
676
662
|
// 发送转换后的文本和视频URL到下一个请求
|
|
677
|
-
await this.sendMessageToAPI(transcriptionText || "下一题",
|
|
663
|
+
await this.sendMessageToAPI(transcriptionText || "下一题", uploadResult.cos_key);
|
|
678
664
|
}
|
|
679
665
|
else {
|
|
680
666
|
throw new Error('视频上传失败');
|
|
@@ -689,43 +675,32 @@ export class VideoChatModal {
|
|
|
689
675
|
});
|
|
690
676
|
}
|
|
691
677
|
finally {
|
|
692
|
-
this.isUploadingVideo = false;
|
|
678
|
+
this.isUploadingVideo = false;
|
|
693
679
|
this.showRecordingUI = false;
|
|
694
680
|
this.recordedBlob = null;
|
|
695
681
|
}
|
|
696
682
|
}
|
|
697
|
-
//
|
|
683
|
+
// 修改音频转文字方法,使用 cos_key
|
|
698
684
|
async convertAudioToText(cosKey) {
|
|
699
685
|
try {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
data: {
|
|
710
|
-
cos_key: cosKey
|
|
711
|
-
},
|
|
712
|
-
onMessage: (data) => {
|
|
713
|
-
// 检查返回结果中是否包含转换后的文本
|
|
714
|
-
if (data && data.text) {
|
|
715
|
-
console.log('转换后的文本:', data.text);
|
|
716
|
-
resolve(data.text);
|
|
717
|
-
}
|
|
718
|
-
else {
|
|
719
|
-
console.warn('音频转文字返回结果格式不正确');
|
|
720
|
-
resolve(null);
|
|
721
|
-
}
|
|
722
|
-
},
|
|
723
|
-
onError: (error) => {
|
|
724
|
-
console.error('音频转文字请求失败:', error);
|
|
725
|
-
reject(error);
|
|
726
|
-
}
|
|
727
|
-
});
|
|
686
|
+
const result = await sendHttpRequest({
|
|
687
|
+
url: '/sdk/v1/tts/audio_to_text',
|
|
688
|
+
method: 'POST',
|
|
689
|
+
headers: {
|
|
690
|
+
'authorization': 'Bearer ' + this.token
|
|
691
|
+
},
|
|
692
|
+
data: {
|
|
693
|
+
cos_key: cosKey
|
|
694
|
+
}
|
|
728
695
|
});
|
|
696
|
+
if (result.success && result.data?.text) {
|
|
697
|
+
console.log('转换后的文本:', result.data.text);
|
|
698
|
+
return result.data.text;
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
console.warn('音频转文字返回结果格式不正确');
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
729
704
|
}
|
|
730
705
|
catch (error) {
|
|
731
706
|
console.error('音频转文字错误:', error);
|
|
@@ -742,6 +717,7 @@ export class VideoChatModal {
|
|
|
742
717
|
response_mode: 'streaming',
|
|
743
718
|
conversation_id: this.conversationId,
|
|
744
719
|
query: queryText,
|
|
720
|
+
bot_id: "3022316191018903",
|
|
745
721
|
inputs: {
|
|
746
722
|
id: this.resumeId
|
|
747
723
|
}
|
|
@@ -752,10 +728,10 @@ export class VideoChatModal {
|
|
|
752
728
|
}
|
|
753
729
|
// 不使用 await,直接发送请求
|
|
754
730
|
sendSSERequest({
|
|
755
|
-
url:
|
|
731
|
+
url: `/sdk/v1/chat/chat-messages`,
|
|
756
732
|
method: 'POST',
|
|
757
733
|
headers: {
|
|
758
|
-
'authorization': 'Bearer ' + this.
|
|
734
|
+
'authorization': 'Bearer ' + this.token
|
|
759
735
|
},
|
|
760
736
|
data: requestData,
|
|
761
737
|
}).catch(error => {
|
|
@@ -765,11 +741,11 @@ export class VideoChatModal {
|
|
|
765
741
|
// 添加TTS合成音频的方法
|
|
766
742
|
async synthesizeAudio(text) {
|
|
767
743
|
try {
|
|
768
|
-
const response = await fetch(
|
|
744
|
+
const response = await fetch(`${API_DOMAIN}/sdk/v1/tts/synthesize_audio`, {
|
|
769
745
|
method: 'POST',
|
|
770
746
|
headers: {
|
|
771
747
|
'Content-Type': 'application/json',
|
|
772
|
-
'authorization': 'Bearer ' + this.
|
|
748
|
+
'authorization': 'Bearer ' + this.token
|
|
773
749
|
},
|
|
774
750
|
body: JSON.stringify({ text })
|
|
775
751
|
});
|
|
@@ -939,7 +915,7 @@ export class VideoChatModal {
|
|
|
939
915
|
"reflect": false,
|
|
940
916
|
"defaultValue": "'\u5728\u7EBF\u5BA2\u670D'"
|
|
941
917
|
},
|
|
942
|
-
"
|
|
918
|
+
"token": {
|
|
943
919
|
"type": "string",
|
|
944
920
|
"mutable": false,
|
|
945
921
|
"complexType": {
|
|
@@ -955,7 +931,7 @@ export class VideoChatModal {
|
|
|
955
931
|
},
|
|
956
932
|
"getter": false,
|
|
957
933
|
"setter": false,
|
|
958
|
-
"attribute": "
|
|
934
|
+
"attribute": "token",
|
|
959
935
|
"reflect": false,
|
|
960
936
|
"defaultValue": "''"
|
|
961
937
|
},
|
|
@@ -1070,7 +1046,7 @@ export class VideoChatModal {
|
|
|
1070
1046
|
"optional": true,
|
|
1071
1047
|
"docs": {
|
|
1072
1048
|
"tags": [],
|
|
1073
|
-
"text": "\u4F1A\u8BDDID"
|
|
1049
|
+
"text": "\u4F1A\u8BDDID\uFF0C\u4F20\u5165\u7EE7\u7EED\u5BF9\u8BDD\uFF0C\u5426\u5219\u521B\u5EFA\u65B0\u4F1A\u8BDD"
|
|
1074
1050
|
},
|
|
1075
1051
|
"getter": false,
|
|
1076
1052
|
"setter": false,
|
|
@@ -1089,7 +1065,7 @@ export class VideoChatModal {
|
|
|
1089
1065
|
"optional": false,
|
|
1090
1066
|
"docs": {
|
|
1091
1067
|
"tags": [],
|
|
1092
|
-
"text": "\
|
|
1068
|
+
"text": "\u9996\u6B21\u5BF9\u8BDD\u63D0\u95EE\u6587\u672C"
|
|
1093
1069
|
},
|
|
1094
1070
|
"getter": false,
|
|
1095
1071
|
"setter": false,
|
|
@@ -1169,7 +1145,7 @@ export class VideoChatModal {
|
|
|
1169
1145
|
"optional": false,
|
|
1170
1146
|
"docs": {
|
|
1171
1147
|
"tags": [],
|
|
1172
|
-
"text": "\u662F\u5426\u4EE5\u5168\u5C4F\u6A21\u5F0F\u6253\u5F00"
|
|
1148
|
+
"text": "\u662F\u5426\u4EE5\u5168\u5C4F\u6A21\u5F0F\u6253\u5F00\uFF0C\u79FB\u52A8\u7AEF\u5EFA\u8BAE\u8BBE\u7F6E\u4E3Atrue"
|
|
1173
1149
|
},
|
|
1174
1150
|
"getter": false,
|
|
1175
1151
|
"setter": false,
|