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 ChatHRModal {
|
|
4
4
|
/**
|
|
5
5
|
* 模态框标题
|
|
@@ -8,7 +8,7 @@ export class ChatHRModal {
|
|
|
8
8
|
/**
|
|
9
9
|
* API鉴权密钥
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
token = '';
|
|
12
12
|
/**
|
|
13
13
|
* 是否显示聊天模态框
|
|
14
14
|
*/
|
|
@@ -38,7 +38,7 @@ export class ChatHRModal {
|
|
|
38
38
|
*/
|
|
39
39
|
isNeedClose = true;
|
|
40
40
|
/**
|
|
41
|
-
* 会话ID
|
|
41
|
+
* 会话ID,传入继续对话,否则创建新会话
|
|
42
42
|
*/
|
|
43
43
|
conversationId;
|
|
44
44
|
/**
|
|
@@ -133,7 +133,7 @@ export class ChatHRModal {
|
|
|
133
133
|
*/
|
|
134
134
|
toEmail = '';
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* 是否以全屏模式打开,移动端建议设置为true
|
|
137
137
|
*/
|
|
138
138
|
fullscreen = false;
|
|
139
139
|
// 添加新的状态来跟踪视频上传
|
|
@@ -160,10 +160,8 @@ export class ChatHRModal {
|
|
|
160
160
|
enableVoice = true;
|
|
161
161
|
/**
|
|
162
162
|
* 是否显示题干内容
|
|
163
|
-
* 1: 显示题干内容
|
|
164
|
-
* 0: 不显示题干内容
|
|
165
163
|
*/
|
|
166
|
-
displayContentStatus =
|
|
164
|
+
displayContentStatus = true;
|
|
167
165
|
/**
|
|
168
166
|
* 用户ID
|
|
169
167
|
*/
|
|
@@ -183,25 +181,16 @@ export class ChatHRModal {
|
|
|
183
181
|
return;
|
|
184
182
|
this.isUploading = true;
|
|
185
183
|
try {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
const response = await fetch('https://pcm_api.ylzhaopin.com/external/v1/files/upload', {
|
|
189
|
-
method: 'POST',
|
|
190
|
-
headers: {
|
|
191
|
-
'authorization': 'Bearer ' + this.apiKey
|
|
192
|
-
},
|
|
193
|
-
body: formData
|
|
184
|
+
const result = await uploadFileToBackend(this.selectedFile, {
|
|
185
|
+
'authorization': 'Bearer ' + this.token
|
|
194
186
|
});
|
|
195
|
-
const result = await response.json();
|
|
196
|
-
if (!response.ok) {
|
|
197
|
-
throw new Error(result.message || '文件上传失败');
|
|
198
|
-
}
|
|
199
187
|
if (result) {
|
|
200
188
|
this.uploadedFileInfo = [{
|
|
201
189
|
cos_key: result.cos_key,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
presigned_url: result.presigned_url
|
|
190
|
+
file_name: result.file_name,
|
|
191
|
+
file_size: result.file_size,
|
|
192
|
+
presigned_url: result.presigned_url,
|
|
193
|
+
ext: result.ext
|
|
205
194
|
}];
|
|
206
195
|
}
|
|
207
196
|
}
|
|
@@ -279,13 +268,14 @@ export class ChatHRModal {
|
|
|
279
268
|
response_mode: 'streaming',
|
|
280
269
|
conversation_id: this.conversationId,
|
|
281
270
|
query: queryText,
|
|
282
|
-
user: this.userId // 使用传入的 userId
|
|
271
|
+
user: this.userId, // 使用传入的 userId
|
|
272
|
+
bot_id: "3022316191018880"
|
|
283
273
|
};
|
|
284
274
|
requestData.inputs = {
|
|
285
275
|
job_info: this.selectedJobCategory,
|
|
286
276
|
dimensional_info: this.selectedDimensions.join(','),
|
|
287
277
|
email: this.toEmail,
|
|
288
|
-
display_content_status: this.displayContentStatus
|
|
278
|
+
display_content_status: this.displayContentStatus ? "1" : "0"
|
|
289
279
|
};
|
|
290
280
|
// 如果有上传的文件,添加到inputs参数
|
|
291
281
|
if (this.uploadedFileInfo.length > 0) {
|
|
@@ -293,10 +283,10 @@ export class ChatHRModal {
|
|
|
293
283
|
requestData.inputs.file_urls = fileUrls;
|
|
294
284
|
}
|
|
295
285
|
await sendSSERequest({
|
|
296
|
-
url:
|
|
286
|
+
url: '/sdk/v1/chat/chat-messages',
|
|
297
287
|
method: 'POST',
|
|
298
288
|
headers: {
|
|
299
|
-
'authorization': 'Bearer ' + this.
|
|
289
|
+
'authorization': 'Bearer ' + this.token
|
|
300
290
|
},
|
|
301
291
|
data: requestData,
|
|
302
292
|
onMessage: (data) => {
|
|
@@ -383,18 +373,18 @@ export class ChatHRModal {
|
|
|
383
373
|
}
|
|
384
374
|
});
|
|
385
375
|
}
|
|
386
|
-
//
|
|
376
|
+
// 修改保存答案的方法
|
|
387
377
|
async saveAnswer(conversationId, question, answer) {
|
|
388
378
|
try {
|
|
389
379
|
await sendHttpRequest({
|
|
390
|
-
url: '
|
|
380
|
+
url: '/sdk/v1/hr_competition/answer',
|
|
391
381
|
method: 'POST',
|
|
392
382
|
headers: {
|
|
393
|
-
'authorization': 'Bearer ' + this.
|
|
383
|
+
'authorization': 'Bearer ' + this.token
|
|
394
384
|
},
|
|
395
385
|
data: {
|
|
396
386
|
conversation_id: conversationId,
|
|
397
|
-
user: this.userId,
|
|
387
|
+
user: this.userId,
|
|
398
388
|
question: question,
|
|
399
389
|
answer: answer
|
|
400
390
|
},
|
|
@@ -440,65 +430,53 @@ export class ChatHRModal {
|
|
|
440
430
|
window.history.replaceState({}, '', newUrl);
|
|
441
431
|
}
|
|
442
432
|
}
|
|
443
|
-
//
|
|
433
|
+
// 修改加载历史消息的方法
|
|
444
434
|
async loadHistoryMessages() {
|
|
445
435
|
if (!this.conversationId)
|
|
446
436
|
return;
|
|
447
437
|
this.isLoadingHistory = true;
|
|
448
438
|
console.log('加载历史消息...');
|
|
449
439
|
try {
|
|
450
|
-
await sendHttpRequest({
|
|
451
|
-
url:
|
|
440
|
+
const response = await sendHttpRequest({
|
|
441
|
+
url: '/sdk/v1/chat/messages',
|
|
452
442
|
method: 'GET',
|
|
453
443
|
headers: {
|
|
454
|
-
'authorization': 'Bearer ' + this.
|
|
444
|
+
'authorization': 'Bearer ' + this.token
|
|
455
445
|
},
|
|
456
446
|
data: {
|
|
457
447
|
conversation_id: this.conversationId,
|
|
448
|
+
bot_id: "3022316191018880",
|
|
458
449
|
limit: 20
|
|
459
|
-
},
|
|
460
|
-
onMessage: (data) => {
|
|
461
|
-
if (data.data) {
|
|
462
|
-
const historyData = data.data || [];
|
|
463
|
-
const formattedMessages = historyData.map(msg => {
|
|
464
|
-
const time = new Date(msg.created_at * 1000);
|
|
465
|
-
const hours = time.getHours().toString().padStart(2, '0');
|
|
466
|
-
const minutes = time.getMinutes().toString().padStart(2, '0');
|
|
467
|
-
const timeStr = `${hours}:${minutes}`;
|
|
468
|
-
// 创建新的消息对象,不包含 inputs 字段
|
|
469
|
-
const { inputs, ...msgWithoutInputs } = msg;
|
|
470
|
-
return {
|
|
471
|
-
...msgWithoutInputs,
|
|
472
|
-
time: timeStr,
|
|
473
|
-
isStreaming: false,
|
|
474
|
-
status: msg.status === 'error' ? 'error' : 'normal'
|
|
475
|
-
};
|
|
476
|
-
});
|
|
477
|
-
this.messages = formattedMessages;
|
|
478
|
-
this.isLoadingHistory = false;
|
|
479
|
-
requestAnimationFrame(() => {
|
|
480
|
-
this.shouldAutoScroll = true;
|
|
481
|
-
this.scrollToBottom();
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
this.isLoadingHistory = false;
|
|
486
|
-
}
|
|
487
|
-
},
|
|
488
|
-
onError: (error) => {
|
|
489
|
-
console.error('加载历史消息失败:', error);
|
|
490
|
-
alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');
|
|
491
|
-
this.isLoadingHistory = false;
|
|
492
|
-
},
|
|
493
|
-
onComplete: () => {
|
|
494
|
-
this.isLoadingHistory = false;
|
|
495
450
|
}
|
|
496
451
|
});
|
|
452
|
+
if (response.success && response.data) {
|
|
453
|
+
const historyData = response.data.data || [];
|
|
454
|
+
const formattedMessages = historyData.map(msg => {
|
|
455
|
+
const time = new Date(msg.created_at * 1000);
|
|
456
|
+
const hours = time.getHours().toString().padStart(2, '0');
|
|
457
|
+
const minutes = time.getMinutes().toString().padStart(2, '0');
|
|
458
|
+
const timeStr = `${hours}:${minutes}`;
|
|
459
|
+
const { inputs, ...msgWithoutInputs } = msg;
|
|
460
|
+
return {
|
|
461
|
+
...msgWithoutInputs,
|
|
462
|
+
time: timeStr,
|
|
463
|
+
isStreaming: false,
|
|
464
|
+
status: msg.status === 'error' ? 'error' : 'normal'
|
|
465
|
+
};
|
|
466
|
+
});
|
|
467
|
+
this.messages = formattedMessages;
|
|
468
|
+
}
|
|
497
469
|
}
|
|
498
470
|
catch (error) {
|
|
499
471
|
console.error('加载历史消息失败:', error);
|
|
500
472
|
alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');
|
|
473
|
+
}
|
|
474
|
+
finally {
|
|
501
475
|
this.isLoadingHistory = false;
|
|
476
|
+
requestAnimationFrame(() => {
|
|
477
|
+
this.shouldAutoScroll = true;
|
|
478
|
+
this.scrollToBottom();
|
|
479
|
+
});
|
|
502
480
|
}
|
|
503
481
|
}
|
|
504
482
|
// 修改 isOpen 的 watch 方法
|
|
@@ -806,31 +784,25 @@ export class ChatHRModal {
|
|
|
806
784
|
this.videoRef = null;
|
|
807
785
|
}
|
|
808
786
|
}
|
|
809
|
-
//
|
|
787
|
+
// 修改上传录制的视频的方法
|
|
810
788
|
async uploadRecordedVideo() {
|
|
811
789
|
if (!this.recordedBlob)
|
|
812
790
|
return;
|
|
813
791
|
try {
|
|
814
|
-
this.isUploadingVideo = true;
|
|
815
|
-
this.showRecordingUI = false;
|
|
792
|
+
this.isUploadingVideo = true;
|
|
793
|
+
this.showRecordingUI = false;
|
|
816
794
|
// 根据Blob类型确定文件扩展名
|
|
817
795
|
const fileExtension = this.recordedBlob.type.includes('webm') ? 'webm' : 'mp4';
|
|
818
796
|
const fileName = `answer.${fileExtension}`;
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
'authorization': 'Bearer ' + this.apiKey
|
|
825
|
-
},
|
|
826
|
-
body: formData
|
|
797
|
+
// 创建File对象
|
|
798
|
+
const videoFile = new File([this.recordedBlob], fileName, { type: this.recordedBlob.type });
|
|
799
|
+
// 使用uploadFileToBackend上传视频
|
|
800
|
+
const result = await uploadFileToBackend(videoFile, {
|
|
801
|
+
'authorization': 'Bearer ' + this.token
|
|
827
802
|
});
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
if (result && result.cos_key) {
|
|
831
|
-
// 保存视频答案
|
|
803
|
+
if (result) {
|
|
804
|
+
// 使用 FileUploadResponse 类型的字段
|
|
832
805
|
await this.saveVideoAnswer(result.cos_key);
|
|
833
|
-
// 发送"下一题"请求
|
|
834
806
|
this.sendNextQuestion();
|
|
835
807
|
}
|
|
836
808
|
else {
|
|
@@ -839,7 +811,6 @@ export class ChatHRModal {
|
|
|
839
811
|
}
|
|
840
812
|
catch (error) {
|
|
841
813
|
console.error('视频上传错误:', error);
|
|
842
|
-
// 通知父组件视频上传失败
|
|
843
814
|
this.recordingError.emit({
|
|
844
815
|
type: 'upload_failed',
|
|
845
816
|
message: '视频上传失败',
|
|
@@ -847,12 +818,12 @@ export class ChatHRModal {
|
|
|
847
818
|
});
|
|
848
819
|
}
|
|
849
820
|
finally {
|
|
850
|
-
this.isUploadingVideo = false;
|
|
821
|
+
this.isUploadingVideo = false;
|
|
851
822
|
this.showRecordingUI = false;
|
|
852
823
|
this.recordedBlob = null;
|
|
853
824
|
}
|
|
854
825
|
}
|
|
855
|
-
//
|
|
826
|
+
// 修改保存视频答案的方法
|
|
856
827
|
async saveVideoAnswer(cosKey) {
|
|
857
828
|
if (!this.conversationId)
|
|
858
829
|
return;
|
|
@@ -861,14 +832,14 @@ export class ChatHRModal {
|
|
|
861
832
|
if (!lastAIMessage)
|
|
862
833
|
return;
|
|
863
834
|
await sendHttpRequest({
|
|
864
|
-
url: '
|
|
835
|
+
url: '/sdk/v1/hr_competition/answer',
|
|
865
836
|
method: 'POST',
|
|
866
837
|
headers: {
|
|
867
|
-
'authorization': 'Bearer ' + this.
|
|
838
|
+
'authorization': 'Bearer ' + this.token
|
|
868
839
|
},
|
|
869
840
|
data: {
|
|
870
841
|
conversation_id: this.conversationId,
|
|
871
|
-
user: this.userId,
|
|
842
|
+
user: this.userId,
|
|
872
843
|
question: lastAIMessage.answer,
|
|
873
844
|
file_url: cosKey
|
|
874
845
|
},
|
|
@@ -890,10 +861,10 @@ export class ChatHRModal {
|
|
|
890
861
|
return;
|
|
891
862
|
try {
|
|
892
863
|
await sendHttpRequest({
|
|
893
|
-
url:
|
|
864
|
+
url: `/sdk/v1/hr_competition/${this.conversationId}/end`,
|
|
894
865
|
method: 'POST',
|
|
895
866
|
headers: {
|
|
896
|
-
'authorization': 'Bearer ' + this.
|
|
867
|
+
'authorization': 'Bearer ' + this.token
|
|
897
868
|
},
|
|
898
869
|
});
|
|
899
870
|
}
|
|
@@ -904,11 +875,11 @@ export class ChatHRModal {
|
|
|
904
875
|
// 添加TTS合成音频的方法
|
|
905
876
|
async synthesizeAudio(text) {
|
|
906
877
|
try {
|
|
907
|
-
const response = await fetch(
|
|
878
|
+
const response = await fetch(`${API_DOMAIN}/sdk/v1/tts/synthesize_audio`, {
|
|
908
879
|
method: 'POST',
|
|
909
880
|
headers: {
|
|
910
881
|
'Content-Type': 'application/json',
|
|
911
|
-
'authorization': 'Bearer ' + this.
|
|
882
|
+
'authorization': 'Bearer ' + this.token
|
|
912
883
|
},
|
|
913
884
|
body: JSON.stringify({ text })
|
|
914
885
|
});
|
|
@@ -1090,7 +1061,7 @@ export class ChatHRModal {
|
|
|
1090
1061
|
"reflect": false,
|
|
1091
1062
|
"defaultValue": "'\u5728\u7EBF\u5BA2\u670D'"
|
|
1092
1063
|
},
|
|
1093
|
-
"
|
|
1064
|
+
"token": {
|
|
1094
1065
|
"type": "string",
|
|
1095
1066
|
"mutable": false,
|
|
1096
1067
|
"complexType": {
|
|
@@ -1106,7 +1077,7 @@ export class ChatHRModal {
|
|
|
1106
1077
|
},
|
|
1107
1078
|
"getter": false,
|
|
1108
1079
|
"setter": false,
|
|
1109
|
-
"attribute": "
|
|
1080
|
+
"attribute": "token",
|
|
1110
1081
|
"reflect": false,
|
|
1111
1082
|
"defaultValue": "''"
|
|
1112
1083
|
},
|
|
@@ -1221,7 +1192,7 @@ export class ChatHRModal {
|
|
|
1221
1192
|
"optional": true,
|
|
1222
1193
|
"docs": {
|
|
1223
1194
|
"tags": [],
|
|
1224
|
-
"text": "\u4F1A\u8BDDID"
|
|
1195
|
+
"text": "\u4F1A\u8BDDID\uFF0C\u4F20\u5165\u7EE7\u7EED\u5BF9\u8BDD\uFF0C\u5426\u5219\u521B\u5EFA\u65B0\u4F1A\u8BDD"
|
|
1225
1196
|
},
|
|
1226
1197
|
"getter": false,
|
|
1227
1198
|
"setter": false,
|
|
@@ -1340,7 +1311,7 @@ export class ChatHRModal {
|
|
|
1340
1311
|
"optional": false,
|
|
1341
1312
|
"docs": {
|
|
1342
1313
|
"tags": [],
|
|
1343
|
-
"text": "\u662F\u5426\u4EE5\u5168\u5C4F\u6A21\u5F0F\u6253\u5F00"
|
|
1314
|
+
"text": "\u662F\u5426\u4EE5\u5168\u5C4F\u6A21\u5F0F\u6253\u5F00\uFF0C\u79FB\u52A8\u7AEF\u5EFA\u8BAE\u8BBE\u7F6E\u4E3Atrue"
|
|
1344
1315
|
},
|
|
1345
1316
|
"getter": false,
|
|
1346
1317
|
"setter": false,
|
|
@@ -1389,24 +1360,24 @@ export class ChatHRModal {
|
|
|
1389
1360
|
"defaultValue": "true"
|
|
1390
1361
|
},
|
|
1391
1362
|
"displayContentStatus": {
|
|
1392
|
-
"type": "
|
|
1363
|
+
"type": "boolean",
|
|
1393
1364
|
"mutable": false,
|
|
1394
1365
|
"complexType": {
|
|
1395
|
-
"original": "
|
|
1396
|
-
"resolved": "
|
|
1366
|
+
"original": "boolean",
|
|
1367
|
+
"resolved": "boolean",
|
|
1397
1368
|
"references": {}
|
|
1398
1369
|
},
|
|
1399
1370
|
"required": false,
|
|
1400
1371
|
"optional": false,
|
|
1401
1372
|
"docs": {
|
|
1402
1373
|
"tags": [],
|
|
1403
|
-
"text": "\u662F\u5426\u663E\u793A\u9898\u5E72\u5185\u5BB9
|
|
1374
|
+
"text": "\u662F\u5426\u663E\u793A\u9898\u5E72\u5185\u5BB9"
|
|
1404
1375
|
},
|
|
1405
1376
|
"getter": false,
|
|
1406
1377
|
"setter": false,
|
|
1407
1378
|
"attribute": "display-content-status",
|
|
1408
1379
|
"reflect": false,
|
|
1409
|
-
"defaultValue": "
|
|
1380
|
+
"defaultValue": "true"
|
|
1410
1381
|
},
|
|
1411
1382
|
"userId": {
|
|
1412
1383
|
"type": "string",
|