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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pcm-video-chat-modal.entry.js","sources":["src/components/pcm-video-chat-modal/pcm-video-chat-modal.css?tag=pcm-video-chat-modal&encapsulation=shadow","src/components/pcm-video-chat-modal/pcm-video-chat-modal.tsx"],"sourcesContent":[":host {\r\n display: block;\r\n }\r\n \r\n .modal-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n overflow-y: auto;\r\n padding: 20px;\r\n z-index: 1000;\r\n }\r\n \r\n /* 全屏模式下取消 padding */\r\n .fullscreen-overlay {\r\n padding: 0;\r\n }\r\n \r\n .modal-container {\r\n background: white;\r\n border-radius: 8px;\r\n width: 100%;\r\n max-width: 800px;\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n margin: auto;\r\n }\r\n \r\n /* 全屏模式样式 */\r\n .modal-container.fullscreen {\r\n width: 100vw;\r\n max-width: none;\r\n height: 100%;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n height: 100vh;\r\n max-height: 100vh;\r\n }\r\n \r\n /* 确保内容区域也使用 flex 布局并占满剩余空间 */\r\n .modal-container.fullscreen > div:not(.modal-header):not(.initial-upload) {\r\n display: flex;\r\n flex-direction: column;\r\n flex: 1;\r\n overflow: hidden; /* 防止内容溢出 */\r\n height: 100%;\r\n }\r\n \r\n /* PC端布局 */\r\n .pc-layout {\r\n width: 80%;\r\n max-width: 800px;\r\n /* height: 80vh; */\r\n /* max-height: 700px; */\r\n min-width: 320px;\r\n min-height: 400px;\r\n }\r\n \r\n /* 移动端布局 */\r\n .mobile-layout {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 0;\r\n }\r\n \r\n /* 响应式布局 */\r\n @media screen and (max-width: 768px) {\r\n .pc-layout {\r\n width: 95%;\r\n /* height: 90vh; */\r\n }\r\n \r\n .modal-overlay {\r\n padding: 0;\r\n }\r\n \r\n .modal-container.fullscreen {\r\n /* 支持 iOS Safari */\r\n height: -webkit-fill-available;\r\n max-height: -webkit-fill-available;\r\n /* 确保内容不会被顶部状态栏和底部工具栏遮挡 */\r\n padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);\r\n }\r\n \r\n \r\n .modal-container.mobile-layout {\r\n width: 100%;\r\n height: 100vh;\r\n max-height: 100vh;\r\n min-height: 100vh;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n \r\n }\r\n .video-preview.placeholder {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n background: #EAEAEA;\r\n }\r\n \r\n .placeholder-status {\r\n color: #00000066;\r\n }\r\n \r\n .waiting-message p {\r\n margin: 0;\r\n font-size: 16px;\r\n color: white;\r\n font-weight: 500;\r\n }\r\n \r\n .recording-container {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n }\r\n \r\n \r\n \r\n .video-area {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n }\r\n \r\n .stop-recording-button {\r\n width: 100%;\r\n height: 100%;\r\n font-size: 16px;\r\n background: #f44336;\r\n border-radius: 6px;\r\n color: white;\r\n border: none;\r\n cursor: pointer;\r\n }\r\n \r\n .stop-recording-button:hover {\r\n background: #d32f2f;\r\n }\r\n \r\n .play-audio-container {\r\n width: 100%;\r\n height: 100%;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n \r\n .modal-header {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n padding: 4px 16px;\r\n height: 50px;\r\n border-bottom: 1px solid #e8e8e8;\r\n flex-shrink: 0; /* 防止头部被压缩 */\r\n }\r\n \r\n .header-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n }\r\n \r\n .header-icon {\r\n width: 24px;\r\n height: 24px;\r\n }\r\n \r\n .close-button {\r\n background: transparent;\r\n border: none;\r\n cursor: pointer;\r\n padding: 8px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 32px;\r\n height: 32px;\r\n border-radius: 4px;\r\n }\r\n \r\n .close-button:hover {\r\n background-color: rgba(0, 0, 0, 0.04);\r\n }\r\n \r\n .close-button span {\r\n font-size: 24px;\r\n line-height: 1;\r\n color: #999;\r\n }\r\n \r\n .close-button:hover span {\r\n color: #666;\r\n }\r\n \r\n .chat-history {\r\n position: relative;\r\n flex: 1;\r\n overflow-y: auto;\r\n padding: 20px;\r\n scroll-behavior: smooth;\r\n min-height: 200px;\r\n background: url(https://pcm-resource-1312611446.cos.ap-guangzhou.myqcloud.com/web/sdk/chat_bg.png);\r\n background-size: 100%;\r\n }\r\n \r\n /* 添加全屏模式下的样式 */\r\n .fullscreen .chat-history {\r\n height: auto;\r\n flex: 1 1 auto;\r\n }\r\n \r\n \r\n .message-input {\r\n padding: 16px;\r\n border-top: 1px solid #eee;\r\n display: flex;\r\n gap: 8px;\r\n align-items: center;\r\n }\r\n \r\n .message-input input {\r\n flex: 1;\r\n padding: 8px 12px;\r\n border: 1px solid #ddd;\r\n border-radius: 4px;\r\n outline: none;\r\n transition: border-color 0.2s ease;\r\n }\r\n \r\n .message-input input:focus {\r\n border-color: #bbb;\r\n }\r\n \r\n /* 消息样式 */\r\n .message {\r\n margin-bottom: 16px;\r\n opacity: 1;\r\n transition: opacity 0.3s ease;\r\n }\r\n \r\n .message-content {\r\n max-width: 70%;\r\n padding: 8px 12px;\r\n border-radius: 8px;\r\n word-break: break-word;\r\n }\r\n \r\n .message-content p {\r\n margin: 0;\r\n word-break: break-word;\r\n }\r\n \r\n .user-message {\r\n display: flex;\r\n justify-content: flex-end;\r\n }\r\n \r\n .agent-message {\r\n display: flex;\r\n justify-content: flex-start;\r\n }\r\n \r\n .user-message .message-content {\r\n background-color: #007bff;\r\n color: white;\r\n }\r\n \r\n .agent-message .message-content {\r\n background-color: #f1f1f1;\r\n }\r\n \r\n .message-time {\r\n font-size: 12px;\r\n color: #999;\r\n margin-top: 4px;\r\n display: block;\r\n }\r\n \r\n .send-button {\r\n background-color: #1890ff;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 8px 16px;\r\n cursor: pointer;\r\n font-weight: 500;\r\n }\r\n \r\n .send-button:disabled {\r\n background-color: #ccc;\r\n cursor: not-allowed;\r\n }\r\n \r\n .empty-state {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n height: 100%;\r\n color: #999;\r\n text-align: center;\r\n }\r\n \r\n .loading-container {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: center;\r\n align-items: center;\r\n background-color: rgba(255, 255, 255, 0.98);\r\n z-index: 1;\r\n opacity: 1;\r\n transition: opacity 0.3s ease;\r\n }\r\n \r\n .loading-container p {\r\n margin-top: 16px;\r\n color: #666;\r\n font-size: 14px;\r\n }\r\n \r\n .loading-spinner {\r\n width: 40px;\r\n height: 40px;\r\n border: 3px solid #f3f3f3;\r\n border-top: 3px solid #1890ff;\r\n border-radius: 50%;\r\n animation: spin 1s linear infinite;\r\n }\r\n \r\n @keyframes spin {\r\n 0% {\r\n transform: rotate(0deg);\r\n }\r\n \r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n }\r\n \r\n /* 修改 messages-wrapper 的样式 */\r\n .messages-wrapper {\r\n width: 100%;\r\n min-height: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n /* 当内容少时,将内容放在底部 */\r\n justify-content: flex-end;\r\n }\r\n \r\n /* 当有很多消息时,取消固定在底部 */\r\n .messages-wrapper.has-overflow {\r\n justify-content: flex-start;\r\n }\r\n \r\n .suggested-questions {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 8px;\r\n padding: 16px;\r\n }\r\n \r\n .suggested-question {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n padding: 8px 12px;\r\n background-color: #f3f4f6;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n color: #374151;\r\n transition: background-color 0.2s;\r\n }\r\n \r\n .suggested-question:hover {\r\n background-color: #e5e7eb;\r\n }\r\n \r\n .arrow-right {\r\n margin-left: 8px;\r\n }\r\n \r\n .loading-suggestions {\r\n display: flex;\r\n justify-content: center;\r\n padding: 16px;\r\n }\r\n \r\n .loading-spinner-small {\r\n width: 20px;\r\n height: 20px;\r\n border: 2px solid #e5e7eb;\r\n border-top-color: #6b7280;\r\n border-radius: 50%;\r\n animation: spin 1s linear infinite;\r\n }\r\n \r\n /* 添加上传按钮样式 */\r\n .upload-button {\r\n background: transparent;\r\n border: none;\r\n cursor: pointer;\r\n padding: 8px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n color: #666;\r\n border-radius: 4px;\r\n transition: background-color 0.2s;\r\n }\r\n \r\n .upload-button:hover {\r\n background-color: rgba(0, 0, 0, 0.04);\r\n }\r\n \r\n .upload-button svg {\r\n width: 20px;\r\n height: 20px;\r\n }\r\n \r\n /* 添加文件名显示区域样式 */\r\n .selected-file {\r\n font-size: 12px;\r\n color: #666;\r\n margin-left: 8px;\r\n max-width: 150px;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n }\r\n \r\n .input-wrapper {\r\n flex: 1;\r\n display: flex;\r\n align-items: center;\r\n border: 1px solid #ddd;\r\n border-radius: 4px;\r\n padding: 0 4px;\r\n background: white;\r\n }\r\n \r\n .input-wrapper input {\r\n border: none;\r\n flex: 1;\r\n padding: 8px;\r\n outline: none;\r\n }\r\n \r\n .input-wrapper:focus-within {\r\n border-color: #bbb;\r\n }\r\n \r\n /* 文件预览区域样式 */\r\n .file-preview {\r\n padding: 8px 16px;\r\n border-top: 1px solid #eee;\r\n background-color: #f9f9f9;\r\n }\r\n \r\n .function-select {\r\n margin-top: 2rem;\r\n }\r\n \r\n .function-options {\r\n display: flex;\r\n flex-wrap: wrap;\r\n gap: 1rem;\r\n justify-content: center;\r\n margin-top: 1rem;\r\n }\r\n \r\n .function-button {\r\n padding: 0.5rem 1rem;\r\n border: 1px solid #ddd;\r\n border-radius: 4px;\r\n background: white;\r\n cursor: pointer;\r\n transition: all 0.3s ease;\r\n }\r\n \r\n .function-button:hover {\r\n border-color: #1890ff;\r\n color: #1890ff;\r\n }\r\n \r\n .function-button.selected {\r\n background: #1890ff;\r\n color: white;\r\n border-color: #1890ff;\r\n }\r\n \r\n .recording-section {\r\n border-top: 1px solid #eee;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n padding: 20px;\r\n border-radius: 14px 14px 0 0;\r\n flex: 0 0 auto;\r\n }\r\n \r\n .recording-section .video-preview {\r\n width: 100%;\r\n height: 200px;\r\n max-width: 400px;\r\n position: relative;\r\n margin-bottom: 10px;\r\n border: 1px solid #ddd;\r\n border-radius: 12px;\r\n overflow: hidden;\r\n }\r\n \r\n .recording-section video {\r\n width: 100%;\r\n height: 100%;\r\n object-fit: cover;\r\n }\r\n \r\n /* 修改 recording-status 样式 */\r\n .recording-status {\r\n position: absolute;\r\n top: 10px;\r\n left: 10px;\r\n background-color: rgba(0, 0, 0, 0.6);\r\n color: white;\r\n padding: 4px 8px;\r\n border-radius: 4px;\r\n display: flex;\r\n align-items: center;\r\n gap: 5px;\r\n font-size: 0.8rem;\r\n z-index: 2;\r\n }\r\n \r\n .recording-status .recording-dot {\r\n display: inline-block;\r\n width: 10px;\r\n height: 10px;\r\n background-color: red;\r\n border-radius: 50%;\r\n margin-right: 5px;\r\n animation: blink 1s infinite;\r\n }\r\n \r\n .recording-status.warning {\r\n color: #ff4d4f;\r\n animation: blink 1s infinite;\r\n }\r\n \r\n @keyframes blink {\r\n 0% {\r\n opacity: 1;\r\n }\r\n \r\n 50% {\r\n opacity: 0.5;\r\n }\r\n \r\n 100% {\r\n opacity: 1;\r\n }\r\n }\r\n \r\n .recording-section .stop-recording-button {\r\n background-color: #f44336;\r\n color: white;\r\n border: none;\r\n cursor: pointer;\r\n font-weight: bold;\r\n }\r\n \r\n .recording-section .stop-recording-button:hover {\r\n background-color: #d32f2f;\r\n }\r\n \r\n .fullscreen {\r\n width: 100vw;\r\n border-radius: 0;\r\n height: 100vh;\r\n display: flex;\r\n flex-direction: column;\r\n overflow-y: auto;\r\n }\r\n \r\n .recording-controls {\r\n margin-top: 10px;\r\n height: 53px;\r\n width: 100%;\r\n max-width: 400px;\r\n display: flex;\r\n justify-content: center;\r\n }\r\n \r\n .recording-controls .waiting-message {\r\n text-align: center;\r\n color: white;\r\n font-size: 1rem;\r\n background-image: linear-gradient(100deg, #4A9FFF 0%, #1058FF 100%);\r\n border-radius: 6px;\r\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\r\n width: 95%;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n cursor: pointer;\r\n }\r\n \r\n .recording-controls .waiting-message.loading {\r\n background: #faad14;\r\n }\r\n \r\n .recording-controls .waiting-message p {\r\n margin: 0;\r\n font-size: 16px;\r\n color: white;\r\n font-weight: 500;\r\n }\r\n \r\n .recording-controls .stop-recording-button {\r\n background-color: #dc3545;\r\n color: white;\r\n border: none;\r\n cursor: pointer;\r\n font-size: 1rem;\r\n }\r\n \r\n .recording-controls .stop-recording-button:hover {\r\n background-color: #c82333;\r\n }\r\n \r\n /* 添加禁用状态的样式 */\r\n .recording-controls .stop-recording-button.disabled {\r\n background: #ccc;\r\n cursor: not-allowed;\r\n }\r\n \r\n .recording-controls .stop-recording-button.disabled:hover {\r\n background: #ccc;\r\n }\r\n \r\n /* 添加进度条和数字进度的样式 */\r\n .progress-container {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n width: 100%;\r\n max-width: 400px;\r\n margin-top: 10px;\r\n padding: 0 5px;\r\n }\r\n \r\n .progress-bar-container {\r\n height: 4px;\r\n background-color: #E5E5E5;\r\n border-radius: 2px;\r\n overflow: hidden;\r\n margin-right: 10px;\r\n width: 75px;\r\n }\r\n \r\n .progress-bar {\r\n height: 100%;\r\n background-image: linear-gradient(111deg, #4A9FFF 0%, #1058FF 100%);\r\n border-radius: 2px;\r\n transition: width 0.3s ease;\r\n }\r\n \r\n .progress-text {\r\n font-size: 14px;\r\n color: #666;\r\n white-space: nowrap;\r\n }","import { Component, Prop, h, State, Event, EventEmitter, Element, Watch } from '@stencil/core';\r\nimport { convertWorkflowStreamNodeToMessageRound, UserInputMessageType, sendSSERequest, sendHttpRequest } from '../../utils/utils';\r\nimport { ChatMessage } from '../../interfaces/chat';\r\n\r\n@Component({\r\n tag: 'pcm-video-chat-modal',\r\n styleUrl: 'pcm-video-chat-modal.css',\r\n shadow: true,\r\n})\r\nexport class VideoChatModal {\r\n /**\r\n * 模态框标题\r\n */\r\n @Prop() modalTitle: string = '在线客服';\r\n\r\n /**\r\n * API鉴权密钥\r\n */\r\n @Prop({ attribute: 'api-key' }) apiKey: string = '';\r\n\r\n /**\r\n * 是否显示聊天模态框\r\n */\r\n @Prop({ mutable: true }) isOpen: boolean = false;\r\n\r\n /**\r\n * 聊天消息历史\r\n */\r\n @State() messages: ChatMessage[] = [];\r\n\r\n\r\n /**\r\n * 当点击模态框关闭时触发\r\n */\r\n @Event() modalClosed: EventEmitter<void>;\r\n\r\n /**\r\n * 应用图标URL\r\n */\r\n @Prop() icon?: string;\r\n\r\n /**\r\n * 聊天框的页面层级\r\n */\r\n @Prop() zIndex?: number = 1000;\r\n\r\n /**\r\n * 是否展示顶部标题栏\r\n */\r\n @Prop() isShowHeader: boolean = true;\r\n\r\n /**\r\n * 是否展示右上角的关闭按钮\r\n */\r\n @Prop() isNeedClose: boolean = true;\r\n\r\n\r\n /**\r\n * 会话ID\r\n */\r\n @Prop({ mutable: true }) conversationId?: string;\r\n\r\n /**\r\n * 当前助手回复的消息\r\n */\r\n @State() currentAssistantMessage: string = '';\r\n\r\n /**\r\n * 是否正在加载回复\r\n */\r\n @State() isLoading: boolean = false;\r\n\r\n /**\r\n * 当前正在流式输出的消息\r\n */\r\n @State() currentStreamingMessage: ChatMessage | null = null;\r\n\r\n // 添加新的状态控制\r\n @State() shouldAutoScroll: boolean = true;\r\n\r\n @State() isLoadingHistory: boolean = false;\r\n\r\n // 使用 @Element 装饰器获取组件的 host 元素\r\n @Element() hostElement: HTMLElement;\r\n\r\n // 添加新的 Event\r\n @Event() streamComplete: EventEmitter<{\r\n conversation_id: string;\r\n event: string;\r\n message_id: string;\r\n id: string;\r\n }>;\r\n\r\n /**\r\n * 默认查询文本\r\n */\r\n @Prop() defaultQuery: string = '';\r\n\r\n // 添加新的状态\r\n @State() showInitialUpload: boolean = true;\r\n\r\n // 添加视频录制相关状态\r\n @State() isRecording: boolean = false;\r\n @State() recordingStream: MediaStream | null = null;\r\n @State() recordedBlob: Blob | null = null;\r\n @State() mediaRecorder: MediaRecorder | null = null;\r\n @State() recordingTimeLeft: number = 0;\r\n @State() showRecordingUI: boolean = false;\r\n @State() recordingTimer: any = null;\r\n @State() recordingStartTime: number = 0;\r\n @State() recordingMaxTime: number = 120; // 最大录制时间(秒)\r\n @State() waitingToRecord: boolean = false;\r\n @State() waitingTimer: any = null;\r\n @State() waitingTimeLeft: number = 10; // 等待时间(秒)\r\n\r\n // 添加一个新的私有属性来存储视频元素的引用\r\n private videoRef: HTMLVideoElement | null = null;\r\n\r\n /**\r\n * 总题目数量\r\n */\r\n @Prop() totalQuestions: number = 2;\r\n\r\n /**\r\n * 当前题目序号\r\n */\r\n @State() currentQuestionNumber: number = 0;\r\n\r\n /**\r\n * 面试是否已完成\r\n */\r\n @State() isInterviewComplete: boolean = false;\r\n\r\n /**\r\n * 当面试完成时触发\r\n */\r\n @Event() interviewComplete: EventEmitter<{\r\n conversation_id: string;\r\n total_questions: number;\r\n }>;\r\n\r\n private readonly SCROLL_THRESHOLD = 30;\r\n\r\n /**\r\n * 视频录制最大时长(秒)\r\n */\r\n @Prop() maxRecordingTime: number = 120;\r\n\r\n /**\r\n * 录制倒计时提醒时间(秒)\r\n * 当剩余时间小于此值时,显示倒计时警告\r\n */\r\n @Prop() countdownWarningTime: number = 30;\r\n\r\n @State() showCountdownWarning: boolean = false;\r\n\r\n\r\n /**\r\n * 是否以全屏模式打开\r\n */\r\n @Prop() fullscreen: boolean = false;\r\n\r\n // 添加新的状态来跟踪视频上传\r\n @State() isUploadingVideo: boolean = false;\r\n\r\n // 添加新的状态和属性\r\n @State() isPlayingAudio: boolean = false;\r\n @State() audioUrl: string | null = null;\r\n private audioElement: HTMLAudioElement | null = null;\r\n\r\n /**\r\n * 录制错误事件\r\n */\r\n @Event() recordingError: EventEmitter<{\r\n type: string;\r\n message: string;\r\n details?: any;\r\n }>;\r\n\r\n /**\r\n * 录制状态变化事件\r\n */\r\n @Event() recordingStatusChange: EventEmitter<{\r\n status: 'started' | 'stopped' | 'paused' | 'resumed' | 'failed';\r\n details?: any;\r\n }>;\r\n\r\n /**\r\n * 是否自动播放语音问题\r\n */\r\n @Prop() enableVoice: boolean = true;\r\n\r\n /**\r\n * 是否显示题干内容\r\n * 1: 显示题干内容\r\n * 0: 不显示题干内容\r\n */\r\n @Prop() displayContentStatus: string = \"1\";\r\n\r\n\r\n /**\r\n * 父组件传入的 简历id\r\n */\r\n @Prop() resumeId?: string;\r\n\r\n private handleClose = () => {\r\n this.stopRecording();\r\n this.modalClosed.emit();\r\n };\r\n\r\n private async sendMessageToAPI(message: string, videoUrl?: string) {\r\n this.isLoading = true;\r\n let answer = '';\r\n let llmText = '';\r\n\r\n const now = new Date();\r\n const time = `${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`;\r\n\r\n // 如果消息为空但有文件,使用默认文本\r\n const queryText = message.trim();\r\n\r\n // 检查是否是最后一题的\"下一题\"请求\r\n const isLastQuestion = this.currentQuestionNumber >= this.totalQuestions;\r\n\r\n // 创建新的消息对象\r\n const newMessage: ChatMessage = {\r\n id: `temp-${Date.now()}`,\r\n time: time,\r\n query: queryText,\r\n answer: '',\r\n isStreaming: true,\r\n conversation_id: this.conversationId,\r\n inputs: {},\r\n status: \"normal\",\r\n error: null\r\n };\r\n\r\n // 设置当前流式消息\r\n this.currentStreamingMessage = newMessage;\r\n\r\n this.shouldAutoScroll = true;\r\n // 滚动到底部\r\n this.scrollToBottom();\r\n\r\n // 如果是最后一题,直接显示结束消息并完成面试\r\n if (isLastQuestion) {\r\n this.messages = [...this.messages, newMessage];\r\n this.currentStreamingMessage = null;\r\n this.isLoading = false;\r\n this.isInterviewComplete = true;\r\n await this.completeInterview(queryText, videoUrl);\r\n this.interviewComplete.emit({\r\n conversation_id: this.conversationId,\r\n total_questions: this.totalQuestions\r\n });\r\n this.currentQuestionNumber++;\r\n return;\r\n }\r\n\r\n // 准备请求数据\r\n const requestData: any = {\r\n response_mode: 'streaming',\r\n conversation_id: this.conversationId,\r\n query: queryText,\r\n inputs: {\r\n id: this.resumeId\r\n }\r\n };\r\n\r\n // 如果有视频URL,添加到inputs中\r\n if (videoUrl) {\r\n requestData.inputs.video_url = videoUrl;\r\n }\r\n\r\n await sendSSERequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/chat/chat-messages`,\r\n method: 'POST',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: requestData,\r\n onMessage: (data) => {\r\n console.log('收到Stream数据:', data);\r\n\r\n if (data.conversation_id && !this.conversationId) {\r\n this.conversationId = data.conversation_id;\r\n this.updateUrlWithConversationId(data.conversation_id);\r\n }\r\n\r\n // 检查是否有 node_finished 事件和 LLMText\r\n if (data.event === 'node_finished' && data.data.inputs && data.data.inputs.LLMText) {\r\n llmText = data.data.inputs.LLMText;\r\n console.log('获取到 LLMText:', llmText);\r\n }\r\n\r\n if (data.event === 'message') {\r\n const inputMessage: UserInputMessageType = { message: message };\r\n convertWorkflowStreamNodeToMessageRound('message', inputMessage, data);\r\n\r\n if (data.event === 'agent_message' || data.event === 'message') {\r\n if (data.answer) {\r\n answer += data.answer;\r\n const updatedMessage: ChatMessage = {\r\n ...this.currentStreamingMessage,\r\n answer,\r\n isStreaming: true\r\n };\r\n this.currentStreamingMessage = updatedMessage;\r\n this.scrollToBottom();\r\n }\r\n }\r\n }\r\n if (data.event === \"message_end\") {\r\n this.streamComplete.emit({\r\n conversation_id: data.conversation_id || '',\r\n event: data.event,\r\n message_id: data.message_id,\r\n id: data.id,\r\n });\r\n }\r\n },\r\n onError: (error) => {\r\n console.error('发生错误:', error);\r\n alert(error instanceof Error ? error.message : '消息发送失败,请稍后再试');\r\n this.messages = [...this.messages, {\r\n ...newMessage,\r\n answer: '抱歉,发生了错误,请稍后再试。',\r\n error: error,\r\n isStreaming: false\r\n }];\r\n this.currentStreamingMessage = null;\r\n this.isLoading = false;\r\n },\r\n onComplete: async () => {\r\n console.log('请求完成');\r\n this.isLoading = false;\r\n\r\n // 获取最新的AI回复内容\r\n const latestAIMessage = this.currentStreamingMessage;\r\n\r\n // 更新消息列表\r\n this.messages = [...this.messages, this.currentStreamingMessage];\r\n this.currentStreamingMessage = null;\r\n\r\n // 增加题目计数\r\n this.currentQuestionNumber++;\r\n\r\n if (latestAIMessage && latestAIMessage.answer) {\r\n // 优先使用 LLMText,如果没有则使用 answer\r\n const textForSynthesis = llmText || latestAIMessage.answer;\r\n\r\n if (textForSynthesis) {\r\n // 合成语音\r\n const audioUrl = await this.synthesizeAudio(textForSynthesis);\r\n\r\n if (this.enableVoice) {\r\n // 自动播放语音\r\n await this.playAudio(audioUrl);\r\n // 自动播放模式下,播放完成后立即开始等待录制\r\n this.startWaitingToRecord();\r\n } else {\r\n // 只保存音频URL,不自动播放\r\n this.audioUrl = audioUrl;\r\n // 非自动播放模式下,不立即开始等待录制\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n // 监听滚动事件,用于控制聊天历史记录的自动滚动行为。\r\n private handleScroll = () => {\r\n const chatHistory = this.hostElement.shadowRoot?.querySelector('.chat-history');\r\n if (!chatHistory) return;\r\n\r\n const { scrollTop, scrollHeight, clientHeight } = chatHistory;\r\n const distanceFromBottom = scrollHeight - scrollTop - clientHeight;\r\n\r\n // 更新是否应该自动滚动的状态\r\n this.shouldAutoScroll = distanceFromBottom <= this.SCROLL_THRESHOLD;\r\n };\r\n\r\n private scrollToBottom() {\r\n if (!this.shouldAutoScroll) return;\r\n const chatHistory = this.hostElement.shadowRoot?.querySelector('.chat-history');\r\n if (chatHistory && this.isOpen) {\r\n // 强制浏览器重新计算布局\r\n chatHistory.scrollTop = chatHistory.scrollHeight;\r\n }\r\n }\r\n\r\n // 添加 componentDidRender 生命周期方法,用于在组件渲染后滚动到底部\r\n componentDidRender() {\r\n if (this.isLoadingHistory || (this.shouldAutoScroll && this.isOpen)) {\r\n const chatHistory = this.hostElement.shadowRoot?.querySelector('.chat-history');\r\n if (chatHistory) {\r\n chatHistory.scrollTop = chatHistory.scrollHeight;\r\n }\r\n }\r\n }\r\n\r\n private updateUrlWithConversationId(conversationId: string) {\r\n const urlParams = new URLSearchParams(window.location.search);\r\n if (!urlParams.get('conversation_id')) {\r\n const newUrl = new URL(window.location.href);\r\n newUrl.searchParams.set('conversation_id', conversationId);\r\n window.history.replaceState({}, '', newUrl);\r\n }\r\n }\r\n\r\n // 修改 loadHistoryMessages 方法\r\n private async loadHistoryMessages() {\r\n if (!this.conversationId) return;\r\n\r\n this.isLoadingHistory = true;\r\n console.log('加载历史消息...');\r\n\r\n try {\r\n await sendHttpRequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/chat/messages`,\r\n method: 'GET',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: {\r\n conversation_id: this.conversationId,\r\n limit: 20\r\n },\r\n onMessage: (data) => {\r\n if (data.data) {\r\n const historyData = data.data || [];\r\n const formattedMessages: ChatMessage[] = historyData.map(msg => {\r\n const time = new Date(msg.created_at * 1000);\r\n const hours = time.getHours().toString().padStart(2, '0');\r\n const minutes = time.getMinutes().toString().padStart(2, '0');\r\n const timeStr = `${hours}:${minutes}`;\r\n\r\n // 创建新的消息对象,不包含 inputs 字段\r\n const { inputs, ...msgWithoutInputs } = msg;\r\n\r\n return {\r\n ...msgWithoutInputs,\r\n time: timeStr,\r\n isStreaming: false,\r\n status: msg.status === 'error' ? 'error' : 'normal' as const\r\n };\r\n });\r\n\r\n this.messages = formattedMessages;\r\n this.isLoadingHistory = false;\r\n\r\n requestAnimationFrame(() => {\r\n this.shouldAutoScroll = true;\r\n this.scrollToBottom();\r\n });\r\n } else {\r\n this.isLoadingHistory = false;\r\n }\r\n },\r\n onError: (error) => {\r\n console.error('加载历史消息失败:', error);\r\n alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');\r\n this.isLoadingHistory = false;\r\n },\r\n onComplete: () => {\r\n this.isLoadingHistory = false;\r\n }\r\n });\r\n } catch (error) {\r\n console.error('加载历史消息失败:', error);\r\n alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');\r\n this.isLoadingHistory = false;\r\n }\r\n }\r\n\r\n // 修改 isOpen 的 watch 方法\r\n @Watch('isOpen')\r\n async handleIsOpenChange(newValue: boolean) {\r\n if (newValue) {\r\n if (this.conversationId) {\r\n await this.loadHistoryMessages();\r\n } else {\r\n // 直接开始对话\r\n this.sendMessageToAPI('请您开始提问');\r\n }\r\n }\r\n }\r\n\r\n // 开始等待录制\r\n private startWaitingToRecord() {\r\n // 清除可能存在的计时器\r\n if (this.waitingTimer) {\r\n clearInterval(this.waitingTimer);\r\n }\r\n if (this.recordingTimer) {\r\n clearInterval(this.recordingTimer);\r\n }\r\n\r\n this.waitingToRecord = true;\r\n this.waitingTimeLeft = 10;\r\n\r\n this.waitingTimer = setInterval(() => {\r\n this.waitingTimeLeft--;\r\n if (this.waitingTimeLeft <= 0) {\r\n clearInterval(this.waitingTimer);\r\n this.waitingTimer = null;\r\n this.waitingToRecord = false;\r\n this.startRecording();\r\n }\r\n }, 1000);\r\n }\r\n\r\n // 开始录制视频\r\n private async startRecording() {\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n audio: true,\r\n video: {\r\n width: { ideal: 1280 },\r\n height: { ideal: 720 },\r\n frameRate: { ideal: 30 }\r\n }\r\n });\r\n\r\n this.recordingStream = stream;\r\n this.showRecordingUI = true;\r\n this.showCountdownWarning = false;\r\n\r\n // 重置视频引用\r\n this.videoRef = null;\r\n\r\n // 确保视频元素获取到流\r\n this.setupVideoPreview(stream);\r\n\r\n // 检测浏览器支持的MIME类型\r\n const mimeType = this.getSupportedMimeType();\r\n\r\n // 创建MediaRecorder实例\r\n let mediaRecorder;\r\n try {\r\n mediaRecorder = new MediaRecorder(stream, {\r\n mimeType: mimeType\r\n });\r\n } catch (e) {\r\n // 如果指定MIME类型失败,尝试使用默认设置\r\n console.warn('指定的MIME类型不受支持,使用默认设置:', e);\r\n try {\r\n mediaRecorder = new MediaRecorder(stream);\r\n } catch (recorderError) {\r\n // 通知父组件录制器创建失败\r\n this.recordingError.emit({\r\n type: 'recorder_creation_failed',\r\n message: '无法创建媒体录制器,您的浏览器可能不支持此功能',\r\n details: recorderError\r\n });\r\n this.showRecordingUI = false;\r\n return;\r\n }\r\n }\r\n\r\n this.mediaRecorder = mediaRecorder;\r\n\r\n const chunks: BlobPart[] = [];\r\n\r\n mediaRecorder.ondataavailable = (event) => {\r\n if (event.data.size > 0) {\r\n chunks.push(event.data);\r\n }\r\n };\r\n\r\n mediaRecorder.onerror = (event) => {\r\n // 通知父组件录制过程中发生错误\r\n this.recordingError.emit({\r\n type: 'recording_error',\r\n message: '录制过程中发生错误',\r\n details: event\r\n });\r\n this.stopRecording();\r\n };\r\n\r\n mediaRecorder.onstop = () => {\r\n try {\r\n // 根据实际使用的MIME类型创建Blob\r\n const blobType = mimeType || 'video/mp4';\r\n const blob = new Blob(chunks, { type: blobType });\r\n\r\n if (blob.size === 0) {\r\n // 通知父组件录制的视频为空\r\n this.recordingError.emit({\r\n type: 'empty_recording',\r\n message: '录制的视频为空'\r\n });\r\n this.showRecordingUI = false;\r\n return;\r\n }\r\n\r\n this.recordedBlob = blob;\r\n\r\n // 通知父组件录制已完成\r\n this.recordingStatusChange.emit({\r\n status: 'stopped',\r\n details: {\r\n duration: Math.floor((Date.now() - this.recordingStartTime) / 1000),\r\n size: blob.size,\r\n type: blob.type\r\n }\r\n });\r\n\r\n this.uploadRecordedVideo();\r\n } catch (error) {\r\n // 通知父组件处理录制视频时出错\r\n this.recordingError.emit({\r\n type: 'processing_error',\r\n message: '处理录制视频时出错',\r\n details: error\r\n });\r\n this.showRecordingUI = false;\r\n }\r\n };\r\n\r\n // 开始录制\r\n try {\r\n mediaRecorder.start();\r\n this.isRecording = true;\r\n this.recordingStartTime = Date.now();\r\n this.recordingTimeLeft = this.maxRecordingTime;\r\n\r\n // 通知父组件录制已开始\r\n this.recordingStatusChange.emit({\r\n status: 'started',\r\n details: {\r\n maxDuration: this.maxRecordingTime,\r\n mimeType: mediaRecorder.mimeType\r\n }\r\n });\r\n } catch (startError) {\r\n // 通知父组件开始录制失败\r\n this.recordingError.emit({\r\n type: 'start_failed',\r\n message: '开始录制失败,请检查您的设备权限',\r\n details: startError\r\n });\r\n this.showRecordingUI = false;\r\n return;\r\n }\r\n\r\n // 设置录制计时器\r\n this.recordingTimer = setInterval(() => {\r\n const elapsedTime = Math.floor((Date.now() - this.recordingStartTime) / 1000);\r\n this.recordingTimeLeft = Math.max(0, this.maxRecordingTime - elapsedTime);\r\n\r\n // 检查是否需要显示倒计时警告\r\n if (this.recordingTimeLeft <= this.countdownWarningTime && !this.showCountdownWarning) {\r\n this.showCountdownWarning = true;\r\n }\r\n\r\n // 时间到自动停止录制\r\n if (this.recordingTimeLeft <= 0) {\r\n this.stopRecording();\r\n }\r\n }, 1000);\r\n\r\n } catch (error) {\r\n console.error('无法访问摄像头或麦克风:', error);\r\n // 通知父组件无法访问媒体设备\r\n this.recordingError.emit({\r\n type: 'media_access_failed',\r\n message: '无法访问摄像头或麦克风,请确保已授予权限',\r\n details: error\r\n });\r\n this.showRecordingUI = false;\r\n }\r\n }\r\n\r\n // 添加新方法来设置视频预览\r\n private setupVideoPreview(stream: MediaStream) {\r\n // 延迟执行以确保DOM已更新\r\n setTimeout(() => {\r\n const videoElement = this.hostElement.shadowRoot?.querySelector('video') as HTMLVideoElement;\r\n if (videoElement && stream) {\r\n // 先尝试使用标准方法\r\n try {\r\n videoElement.srcObject = stream;\r\n videoElement.play().catch(err => {\r\n console.error('视频播放失败:', err);\r\n });\r\n } catch (e) {\r\n console.warn('设置srcObject失败,尝试替代方法:', e);\r\n\r\n // 对于不支持srcObject的旧浏览器,使用URL.createObjectURL\r\n try {\r\n // 使用类型断言解决TypeScript错误\r\n const objectUrl = URL.createObjectURL(stream as unknown as MediaSource);\r\n videoElement.src = objectUrl;\r\n\r\n // 确保在视频元素不再使用时释放URL\r\n videoElement.onended = () => {\r\n URL.revokeObjectURL(objectUrl);\r\n };\r\n } catch (urlError) {\r\n console.error('创建对象URL失败:', urlError);\r\n }\r\n }\r\n } else {\r\n console.warn('未找到视频元素或媒体流无效');\r\n }\r\n }, 100);\r\n }\r\n\r\n // 添加一个新方法来检测浏览器支持的MIME类型\r\n private getSupportedMimeType(): string {\r\n // 按优先级排列的MIME类型列表\r\n const mimeTypes = [\r\n 'video/webm;codecs=vp8,opus',\r\n 'video/webm;codecs=vp9,opus',\r\n 'video/webm',\r\n 'video/mp4',\r\n 'video/mp4;codecs=h264,aac',\r\n '' // 空字符串表示使用浏览器默认值\r\n ];\r\n\r\n // 检查MediaRecorder是否可用\r\n if (!window.MediaRecorder) {\r\n console.warn('MediaRecorder API不可用');\r\n return '';\r\n }\r\n\r\n // 检查每种MIME类型是否受支持\r\n for (const type of mimeTypes) {\r\n if (!type) return ''; // 如果是空字符串,直接返回\r\n\r\n try {\r\n if (MediaRecorder.isTypeSupported(type)) {\r\n console.log('使用支持的MIME类型:', type);\r\n return type;\r\n }\r\n } catch (e) {\r\n console.warn(`检查MIME类型支持时出错 ${type}:`, e);\r\n }\r\n }\r\n\r\n // 如果没有找到支持的类型,返回空字符串\r\n console.warn('没有找到支持的MIME类型,将使用浏览器默认值');\r\n return '';\r\n }\r\n\r\n // 停止录制\r\n private stopRecording() {\r\n if (this.mediaRecorder && this.isRecording) {\r\n this.mediaRecorder.stop();\r\n this.isRecording = false;\r\n\r\n // 清理计时器\r\n if (this.recordingTimer) {\r\n clearInterval(this.recordingTimer);\r\n this.recordingTimer = null;\r\n }\r\n\r\n // 停止并释放媒体流\r\n if (this.recordingStream) {\r\n this.recordingStream.getTracks().forEach(track => track.stop());\r\n this.recordingStream = null;\r\n }\r\n\r\n // 清理视频引用\r\n this.videoRef = null;\r\n }\r\n }\r\n\r\n // 上传录制的视频\r\n private async uploadRecordedVideo() {\r\n if (!this.recordedBlob) return;\r\n\r\n try {\r\n this.isUploadingVideo = true; // 开始上传时设置状态\r\n this.showRecordingUI = false; // 隐藏视频预览\r\n\r\n // 根据Blob类型确定文件扩展名\r\n const fileExtension = this.recordedBlob.type.includes('webm') ? 'webm' : 'mp4';\r\n const fileName = `answer.${fileExtension}`;\r\n\r\n const formData = new FormData();\r\n formData.append('file', this.recordedBlob, fileName);\r\n\r\n const response = await fetch('https://pcm_api.ylzhaopin.com/external/v1/files/upload', {\r\n method: 'POST',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n body: formData\r\n });\r\n\r\n const result = await response.json();\r\n console.log('视频上传结果:', result);\r\n\r\n if (result && result.cos_key) {\r\n // 调用音频转文字API\r\n const transcriptionText = await this.convertAudioToText(result.cos_key);\r\n \r\n // 发送转换后的文本和视频URL到下一个请求\r\n await this.sendMessageToAPI(transcriptionText || \"下一题\", result.cos_key);\r\n } else {\r\n throw new Error('视频上传失败');\r\n }\r\n } catch (error) {\r\n console.error('视频上传或处理错误:', error);\r\n this.recordingError.emit({\r\n type: 'upload_failed',\r\n message: '视频上传或处理失败',\r\n details: error\r\n });\r\n } finally {\r\n this.isUploadingVideo = false; // 上传完成后重置状态\r\n this.showRecordingUI = false;\r\n this.recordedBlob = null;\r\n }\r\n }\r\n\r\n // 修改音频转文字方法\r\n private async convertAudioToText(cosKey: string): Promise<string | null> {\r\n try {\r\n // 创建一个Promise来处理响应\r\n return new Promise((resolve, reject) => {\r\n sendHttpRequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/tts/audio_to_text`,\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: {\r\n cos_key: cosKey\r\n },\r\n onMessage: (data) => {\r\n \r\n // 检查返回结果中是否包含转换后的文本\r\n if (data && data.text) {\r\n console.log('转换后的文本:', data.text);\r\n resolve(data.text);\r\n } else {\r\n console.warn('音频转文字返回结果格式不正确');\r\n resolve(null);\r\n }\r\n },\r\n onError: (error) => {\r\n console.error('音频转文字请求失败:', error);\r\n reject(error);\r\n }\r\n });\r\n });\r\n } catch (error) {\r\n console.error('音频转文字错误:', error);\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * 发送面试完成请求\r\n */\r\n private async completeInterview(queryText: string, videoUrl: string) {\r\n if (!this.conversationId) return;\r\n const requestData: any = {\r\n response_mode: 'streaming',\r\n conversation_id: this.conversationId,\r\n query: queryText,\r\n inputs: {\r\n id: this.resumeId\r\n }\r\n };\r\n\r\n // 如果有视频URL,添加到inputs中\r\n if (videoUrl) {\r\n requestData.inputs.video_url = videoUrl;\r\n }\r\n\r\n // 不使用 await,直接发送请求\r\n sendSSERequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/chat/chat-messages`,\r\n method: 'POST',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: requestData,\r\n }).catch(error => {\r\n console.error('发送面试完成请求失败:', error);\r\n });\r\n }\r\n\r\n // 添加TTS合成音频的方法\r\n private async synthesizeAudio(text: string): Promise<string> {\r\n try {\r\n const response = await fetch('https://pcm_api.ylzhaopin.com/external/v1/tts/synthesize_audio', {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n body: JSON.stringify({ text })\r\n });\r\n\r\n if (!response.ok) {\r\n throw new Error('语音合成失败');\r\n }\r\n\r\n // 获取音频数据并创建Blob URL\r\n const audioBlob = await response.blob();\r\n return URL.createObjectURL(audioBlob);\r\n } catch (error) {\r\n console.error('语音合成错误:', error);\r\n throw error;\r\n }\r\n }\r\n\r\n // 播放音频的方法\r\n private playAudio(audioUrl: string): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.isPlayingAudio = true;\r\n this.audioUrl = audioUrl;\r\n\r\n // 创建音频元素\r\n if (!this.audioElement) {\r\n this.audioElement = new Audio();\r\n }\r\n\r\n this.audioElement.src = audioUrl;\r\n this.audioElement.onended = () => {\r\n this.isPlayingAudio = false;\r\n this.audioUrl = null;\r\n resolve();\r\n };\r\n\r\n this.audioElement.onerror = () => {\r\n console.error('音频播放错误');\r\n this.isPlayingAudio = false;\r\n this.audioUrl = null;\r\n resolve();\r\n };\r\n\r\n this.audioElement.play().catch(error => {\r\n console.error('音频播放失败:', error);\r\n this.isPlayingAudio = false;\r\n this.audioUrl = null;\r\n resolve();\r\n });\r\n });\r\n }\r\n\r\n // 修改 componentDidLoad 生命周期方法,确保组件卸载时释放资源\r\n disconnectedCallback() {\r\n // 释放音频资源\r\n if (this.audioElement) {\r\n this.audioElement.pause();\r\n this.audioElement.src = '';\r\n this.audioElement = null;\r\n }\r\n\r\n // 释放 Blob URL\r\n if (this.audioUrl) {\r\n URL.revokeObjectURL(this.audioUrl);\r\n this.audioUrl = null;\r\n }\r\n\r\n // 清理其他计时器\r\n if (this.waitingTimer) {\r\n clearInterval(this.waitingTimer);\r\n this.waitingTimer = null;\r\n }\r\n\r\n if (this.recordingTimer) {\r\n clearInterval(this.recordingTimer);\r\n this.recordingTimer = null;\r\n }\r\n\r\n // 停止录制\r\n this.stopRecording();\r\n }\r\n\r\n // 修改手动播放音频的方法\r\n private handlePlayAudio = async () => {\r\n if (this.audioUrl) {\r\n await this.playAudio(this.audioUrl);\r\n // 手动播放完成后开始等待录制\r\n this.startWaitingToRecord();\r\n }\r\n };\r\n\r\n render() {\r\n if (!this.isOpen) return null;\r\n\r\n const modalStyle = {\r\n zIndex: String(this.zIndex)\r\n };\r\n\r\n const containerClass = {\r\n 'modal-container': true,\r\n 'fullscreen': this.fullscreen\r\n };\r\n\r\n const overlayClass = {\r\n 'modal-overlay': true,\r\n 'fullscreen-overlay': this.fullscreen\r\n };\r\n\r\n const renderVideoPreview = () => (\r\n <div class=\"video-preview\">\r\n <video\r\n autoPlay\r\n playsInline\r\n muted\r\n style={{ transform: 'scaleX(-1)' }}\r\n ref={(el) => {\r\n if (el && this.recordingStream && !this.videoRef) {\r\n this.videoRef = el;\r\n // 不在这里设置srcObject,而是使用setupVideoPreview方法\r\n }\r\n }}\r\n ></video>\r\n <div class={{\r\n 'recording-status': true,\r\n 'warning': this.showCountdownWarning\r\n }}>\r\n <span class=\"recording-dot\"></span>\r\n <span>\r\n 录制中 {Math.floor(this.recordingTimeLeft / 60)}:{(this.recordingTimeLeft % 60).toString().padStart(2, '0')}\r\n {this.showCountdownWarning && ` (即将自动完成)`}\r\n </span>\r\n </div>\r\n </div>\r\n );\r\n\r\n // 渲染占位符状态信息\r\n const renderPlaceholderStatus = () => {\r\n // 正在播放音频\r\n if (this.isPlayingAudio) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>正在播放问题,请听完后准备回答...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 正在上传视频\r\n if (this.isUploadingVideo) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>正在上传视频,请稍候...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 正在加载或等待AI回复\r\n if (this.isLoading || this.currentStreamingMessage) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>请等待题目...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 等待开始录制\r\n if (this.waitingToRecord) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>请准备好,{this.waitingTimeLeft}秒后将开始录制您的回答...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 添加默认状态\r\n return (\r\n <div class=\"placeholder-status default-status\">\r\n <p>准备中...</p>\r\n </div>\r\n );\r\n };\r\n\r\n return (\r\n <div class={overlayClass} style={modalStyle}>\r\n <div class={containerClass}>\r\n {this.isShowHeader && (\r\n <div class=\"modal-header\">\r\n <div class=\"header-left\">\r\n {this.icon && <img src={this.icon} class=\"header-icon\" alt=\"应用图标\" />}\r\n <div>{this.modalTitle}</div>\r\n </div>\r\n {this.isNeedClose && (\r\n <button class=\"close-button\" onClick={this.handleClose}>\r\n <span>×</span>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n\r\n <div style={{ height: '100%' }}>\r\n <div class=\"chat-history\" onScroll={this.handleScroll}>\r\n {this.isLoadingHistory ? (\r\n <div class=\"loading-container\">\r\n <div class=\"loading-spinner\"></div>\r\n <p>加载历史消息中...</p>\r\n </div>\r\n ) : (\r\n <div>\r\n {this.messages.map((message) => (\r\n <div id={`message_${message.id}`} key={message.id}>\r\n <pcm-chat-message\r\n message={message}\r\n onMessageChange={(event) => {\r\n const updatedMessages = this.messages.map(msg =>\r\n msg.id === message.id ? { ...msg, ...event.detail } : msg\r\n );\r\n this.messages = updatedMessages;\r\n }}\r\n ></pcm-chat-message>\r\n </div>\r\n ))}\r\n {this.currentStreamingMessage && (\r\n <div id={`message_${this.currentStreamingMessage.id}`}>\r\n <pcm-chat-message\r\n message={this.currentStreamingMessage}\r\n ></pcm-chat-message>\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n\r\n <div class=\"recording-section\">\r\n <div class=\"recording-container\">\r\n <div class=\"video-area\">\r\n {this.showRecordingUI ? (\r\n renderVideoPreview()\r\n ) : (\r\n <div class=\"video-preview placeholder\">\r\n {renderPlaceholderStatus()}\r\n </div>\r\n )}\r\n </div>\r\n {/* 添加进度条和数字进度 */}\r\n <div class=\"progress-container\">\r\n <div class=\"progress-bar-container\">\r\n <div\r\n class=\"progress-bar\"\r\n style={{\r\n width: `${Math.max(0, this.currentQuestionNumber - 1) / this.totalQuestions * 100}%`\r\n }}\r\n ></div>\r\n </div>\r\n <div class=\"progress-text\">\r\n 已完成{Math.max(0, this.currentQuestionNumber - 1)}/{this.totalQuestions}\r\n </div>\r\n </div>\r\n <div class=\"recording-controls\">\r\n {this.showRecordingUI ? (\r\n <button\r\n class=\"stop-recording-button\"\r\n onClick={() => this.stopRecording()}\r\n >\r\n 完成本题回答\r\n </button>\r\n ) : (\r\n <div class=\"waiting-message\">\r\n {(() => {\r\n // 显示播放按钮(当不自动播放且有音频URL时)\r\n if (!this.enableVoice && this.audioUrl && !this.isPlayingAudio) {\r\n return (\r\n <div class=\"play-audio-container\" onClick={this.handlePlayAudio}>\r\n <p>\r\n <svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\" style={{ verticalAlign: 'middle', marginRight: '8px' }}>\r\n <path d=\"M8 5v14l11-7z\" />\r\n </svg>\r\n <span style={{ verticalAlign: 'middle' }}>播放题目</span>\r\n </p>\r\n </div>\r\n );\r\n }\r\n\r\n // 其他状态下显示禁用的\"完成回答\"按钮\r\n return (\r\n <button class=\"stop-recording-button disabled\" disabled>\r\n 完成回答\r\n </button>\r\n );\r\n })()}\r\n </div>\r\n )}\r\n </div>\r\n\r\n\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n }\r\n}"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG,0iRAA0iR;;MCS1jR,cAAc,GAAA,MAAA;;;;;;;;;AACzB;;AAEG;IACK,UAAU,GAAW,MAAM;AAEnC;;AAEG;IAC6B,MAAM,GAAW,EAAE;AAEnD;;AAEG;IACsB,MAAM,GAAY,KAAK;AAEhD;;AAEG;IACM,QAAQ,GAAkB,EAAE;AAGrC;;AAEG;AACM,IAAA,WAAW;AAEpB;;AAEG;AACK,IAAA,IAAI;AAEZ;;AAEG;IACK,MAAM,GAAY,IAAI;AAE9B;;AAEG;IACK,YAAY,GAAY,IAAI;AAEpC;;AAEG;IACK,WAAW,GAAY,IAAI;AAGnC;;AAEG;AACsB,I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QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,EAAA,EACxH,CAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,eAAe,EAAA,CAAG,CACtB,EACN,CAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAa,EAAA,0BAAA,CAAA,CACnD,CACA;;;AAKV,YAAA,QACE,cAAQ,KAAK,EAAC,gCAAgC,EAAC,QAAQ,EAE9C,IAAA,EAAA,EAAA,0BAAA,CAAA;SAEZ,GAAG,CACA,CACP,CACG,CAGF,CACF,CACF,CACF,CACF;;;;;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s}from"./p-DaMwkrv5.js";import{f as r}from"./p-B2EtEi7v.js";const e=":host{display:block}";const o=class{constructor(s){t(this,s)}first;middle;last;getText(){return r(this.first,this.middle,this.last)}render(){return s("div",{key:"70654fc83039b5f659efe99cc990e9b86d20dbe0"},"Hello, World! I'm ",this.getText())}};o.style=e;export{o as my_component};
|
|
2
|
-
//# sourceMappingURL=p-0ddd5c47.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["myComponentCss","MyComponent","first","middle","last","getText","format","this","render","h","key"],"sources":["src/components/my-component/my-component.css?tag=my-component&encapsulation=shadow","src/components/my-component/my-component.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport { format } from '../../utils/utils';\n\n@Component({\n tag: 'my-component',\n styleUrl: 'my-component.css',\n shadow: true,\n})\nexport class MyComponent {\n /**\n * The first name\n */\n @Prop() first: string;\n\n /**\n * The middle name\n */\n @Prop() middle: string;\n\n /**\n * The last name\n */\n @Prop() last: string;\n\n private getText(): string {\n return format(this.first, this.middle, this.last);\n }\n\n render() {\n return <div>Hello, World! I'm {this.getText()}</div>;\n }\n}\n"],"mappings":"+EAAA,MAAMA,EAAiB,uB,MCQVC,EAAW,M,yBAIdC,MAKAC,OAKAC,KAEA,OAAAC,GACN,OAAOC,EAAOC,KAAKL,MAAOK,KAAKJ,OAAQI,KAAKH,K,CAG9C,MAAAI,GACE,OAAOC,EAAA,OAAAC,IAAA,iEAAwBH,KAAKF,U","ignoreList":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,g as i,h as s}from"./p-DaMwkrv5.js";import{a as o,s as r}from"./p-B2EtEi7v.js";const n=":host{display:block}.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;overflow-y:auto;padding:20px;z-index:1000}.fullscreen-overlay{padding:0}.modal-container{background:white;border-radius:8px;width:100%;max-width:800px;display:flex;flex-direction:column;position:relative;margin:auto}.modal-container.fullscreen{width:100vw;max-width:none;height:100%;border-radius:0;margin:0;display:flex;flex-direction:column;height:100vh;max-height:100vh}.modal-container.fullscreen>div:not(.modal-header):not(.initial-upload){display:flex;flex-direction:column;flex:1;overflow:hidden;height:100%}.pc-layout{width:80%;max-width:800px;min-width:320px;min-height:400px}.mobile-layout{width:100%;height:100%;border-radius:0}@media screen and (max-width: 768px){.pc-layout{width:95%;}.modal-overlay{padding:0}.modal-container.fullscreen{height:-webkit-fill-available;max-height:-webkit-fill-available;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}.modal-container.mobile-layout{width:100%;height:100vh;max-height:100vh;min-height:100vh;border-radius:0;margin:0;display:flex;flex-direction:column}}.video-preview.placeholder{display:flex;justify-content:center;align-items:center;background:#EAEAEA}.placeholder-status{color:#00000066}.waiting-message p{margin:0;font-size:16px;color:white;font-weight:500}.recording-container{width:100%;display:flex;flex-direction:column;align-items:center}.video-area{width:100%;display:flex;flex-direction:column;align-items:center}.stop-recording-button{width:100%;height:100%;font-size:16px;background:#f44336;border-radius:6px;color:white;border:none;cursor:pointer}.stop-recording-button:hover{background:#d32f2f}.play-audio-container{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:4px 16px;height:50px;border-bottom:1px solid #e8e8e8;flex-shrink:0;}.header-left{display:flex;align-items:center;gap:8px}.header-icon{width:24px;height:24px}.close-button{background:transparent;border:none;cursor:pointer;padding:8px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:4px}.close-button:hover{background-color:rgba(0, 0, 0, 0.04)}.close-button span{font-size:24px;line-height:1;color:#999}.close-button:hover span{color:#666}.chat-history{position:relative;flex:1;overflow-y:auto;padding:20px;scroll-behavior:smooth;min-height:200px;background:url(https://pcm-resource-1312611446.cos.ap-guangzhou.myqcloud.com/web/sdk/chat_bg.png);background-size:100%}.fullscreen .chat-history{height:auto;flex:1 1 auto}.message-input{padding:16px;border-top:1px solid #eee;display:flex;gap:8px;align-items:center}.message-input input{flex:1;padding:8px 12px;border:1px solid #ddd;border-radius:4px;outline:none;transition:border-color 0.2s ease}.message-input input:focus{border-color:#bbb}.message{margin-bottom:16px;opacity:1;transition:opacity 0.3s ease}.message-content{max-width:70%;padding:8px 12px;border-radius:8px;word-break:break-word}.message-content p{margin:0;word-break:break-word}.user-message{display:flex;justify-content:flex-end}.agent-message{display:flex;justify-content:flex-start}.user-message .message-content{background-color:#007bff;color:white}.agent-message .message-content{background-color:#f1f1f1}.message-time{font-size:12px;color:#999;margin-top:4px;display:block}.send-button{background-color:#1890ff;color:white;border:none;border-radius:4px;padding:8px 16px;cursor:pointer;font-weight:500}.send-button:disabled{background-color:#ccc;cursor:not-allowed}.empty-state{display:flex;justify-content:center;align-items:center;height:100%;color:#999;text-align:center}.loading-container{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:rgba(255, 255, 255, 0.98);z-index:1;opacity:1;transition:opacity 0.3s ease}.loading-container p{margin-top:16px;color:#666;font-size:14px}.loading-spinner{width:40px;height:40px;border:3px solid #f3f3f3;border-top:3px solid #1890ff;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.messages-wrapper{width:100%;min-height:100%;display:flex;flex-direction:column;justify-content:flex-end}.messages-wrapper.has-overflow{justify-content:flex-start}.suggested-questions{display:flex;flex-direction:column;gap:8px;padding:16px}.suggested-question{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background-color:#f3f4f6;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;transition:background-color 0.2s}.suggested-question:hover{background-color:#e5e7eb}.arrow-right{margin-left:8px}.loading-suggestions{display:flex;justify-content:center;padding:16px}.loading-spinner-small{width:20px;height:20px;border:2px solid #e5e7eb;border-top-color:#6b7280;border-radius:50%;animation:spin 1s linear infinite}.upload-button{background:transparent;border:none;cursor:pointer;padding:8px;display:flex;align-items:center;justify-content:center;color:#666;border-radius:4px;transition:background-color 0.2s}.upload-button:hover{background-color:rgba(0, 0, 0, 0.04)}.upload-button svg{width:20px;height:20px}.selected-file{font-size:12px;color:#666;margin-left:8px;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.input-wrapper{flex:1;display:flex;align-items:center;border:1px solid #ddd;border-radius:4px;padding:0 4px;background:white}.input-wrapper input{border:none;flex:1;padding:8px;outline:none}.input-wrapper:focus-within{border-color:#bbb}.file-preview{padding:8px 16px;border-top:1px solid #eee;background-color:#f9f9f9}.function-select{margin-top:2rem}.function-options{display:flex;flex-wrap:wrap;gap:1rem;justify-content:center;margin-top:1rem}.function-button{padding:0.5rem 1rem;border:1px solid #ddd;border-radius:4px;background:white;cursor:pointer;transition:all 0.3s ease}.function-button:hover{border-color:#1890ff;color:#1890ff}.function-button.selected{background:#1890ff;color:white;border-color:#1890ff}.recording-section{border-top:1px solid #eee;display:flex;flex-direction:column;align-items:center;padding:20px;border-radius:14px 14px 0 0;flex:0 0 auto}.recording-section .video-preview{width:100%;height:200px;max-width:400px;position:relative;margin-bottom:10px;border:1px solid #ddd;border-radius:12px;overflow:hidden}.recording-section video{width:100%;height:100%;object-fit:cover}.recording-status{position:absolute;top:10px;left:10px;background-color:rgba(0, 0, 0, 0.6);color:white;padding:4px 8px;border-radius:4px;display:flex;align-items:center;gap:5px;font-size:0.8rem;z-index:2}.recording-status .recording-dot{display:inline-block;width:10px;height:10px;background-color:red;border-radius:50%;margin-right:5px;animation:blink 1s infinite}.recording-status.warning{color:#ff4d4f;animation:blink 1s infinite}@keyframes blink{0%{opacity:1}50%{opacity:0.5}100%{opacity:1}}.recording-section .stop-recording-button{background-color:#f44336;color:white;border:none;cursor:pointer;font-weight:bold}.recording-section .stop-recording-button:hover{background-color:#d32f2f}.fullscreen{width:100vw;border-radius:0;height:100vh;display:flex;flex-direction:column;overflow-y:auto}.recording-controls{margin-top:10px;height:53px;width:100%;max-width:400px;display:flex;justify-content:center}.recording-controls .waiting-message{text-align:center;color:white;font-size:1rem;background-image:linear-gradient(100deg, #4A9FFF 0%, #1058FF 100%);border-radius:6px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.15);width:95%;display:flex;justify-content:center;align-items:center;cursor:pointer}.recording-controls .waiting-message.loading{background:#faad14}.recording-controls .waiting-message p{margin:0;font-size:16px;color:white;font-weight:500}.recording-controls .stop-recording-button{background-color:#dc3545;color:white;border:none;cursor:pointer;font-size:1rem}.recording-controls .stop-recording-button:hover{background-color:#c82333}.recording-controls .stop-recording-button.disabled{background:#ccc;cursor:not-allowed}.recording-controls .stop-recording-button.disabled:hover{background:#ccc}.progress-container{display:flex;justify-content:space-between;align-items:center;width:100%;max-width:400px;margin-top:10px;padding:0 5px}.progress-bar-container{height:4px;background-color:#E5E5E5;border-radius:2px;overflow:hidden;margin-right:10px;width:75px}.progress-bar{height:100%;background-image:linear-gradient(111deg, #4A9FFF 0%, #1058FF 100%);border-radius:2px;transition:width 0.3s ease}.progress-text{font-size:14px;color:#666;white-space:nowrap}";const a=class{constructor(i){e(this,i);this.modalClosed=t(this,"modalClosed");this.streamComplete=t(this,"streamComplete");this.interviewComplete=t(this,"interviewComplete");this.recordingError=t(this,"recordingError");this.recordingStatusChange=t(this,"recordingStatusChange")}modalTitle="在线客服";apiKey="";isOpen=false;messages=[];modalClosed;icon;zIndex=1e3;isShowHeader=true;isNeedClose=true;conversationId;currentAssistantMessage="";isLoading=false;currentStreamingMessage=null;shouldAutoScroll=true;isLoadingHistory=false;get hostElement(){return i(this)}streamComplete;defaultQuery="";showInitialUpload=true;isRecording=false;recordingStream=null;recordedBlob=null;mediaRecorder=null;recordingTimeLeft=0;showRecordingUI=false;recordingTimer=null;recordingStartTime=0;recordingMaxTime=120;waitingToRecord=false;waitingTimer=null;waitingTimeLeft=10;videoRef=null;totalQuestions=2;currentQuestionNumber=0;isInterviewComplete=false;interviewComplete;SCROLL_THRESHOLD=30;maxRecordingTime=120;countdownWarningTime=30;showCountdownWarning=false;fullscreen=false;isUploadingVideo=false;isPlayingAudio=false;audioUrl=null;audioElement=null;recordingError;recordingStatusChange;enableVoice=true;displayContentStatus="1";resumeId;handleClose=()=>{this.stopRecording();this.modalClosed.emit()};async sendMessageToAPI(e,t){this.isLoading=true;let i="";let s="";const r=new Date;const n=`${r.getHours()}:${r.getMinutes().toString().padStart(2,"0")}`;const a=e.trim();const l=this.currentQuestionNumber>=this.totalQuestions;const d={id:`temp-${Date.now()}`,time:n,query:a,answer:"",isStreaming:true,conversation_id:this.conversationId,inputs:{},status:"normal",error:null};this.currentStreamingMessage=d;this.shouldAutoScroll=true;this.scrollToBottom();if(l){this.messages=[...this.messages,d];this.currentStreamingMessage=null;this.isLoading=false;this.isInterviewComplete=true;await this.completeInterview(a,t);this.interviewComplete.emit({conversation_id:this.conversationId,total_questions:this.totalQuestions});this.currentQuestionNumber++;return}const c={response_mode:"streaming",conversation_id:this.conversationId,query:a,inputs:{id:this.resumeId}};if(t){c.inputs.video_url=t}await o({url:`https://pcm_api.ylzhaopin.com/external/v1/chat/chat-messages`,method:"POST",headers:{authorization:"Bearer "+this.apiKey},data:c,onMessage:e=>{console.log("收到Stream数据:",e);if(e.conversation_id&&!this.conversationId){this.conversationId=e.conversation_id;this.updateUrlWithConversationId(e.conversation_id)}if(e.event==="node_finished"&&e.data.inputs&&e.data.inputs.LLMText){s=e.data.inputs.LLMText;console.log("获取到 LLMText:",s)}if(e.event==="message"){if(e.event==="agent_message"||e.event==="message"){if(e.answer){i+=e.answer;const t={...this.currentStreamingMessage,answer:i,isStreaming:true};this.currentStreamingMessage=t;this.scrollToBottom()}}}if(e.event==="message_end"){this.streamComplete.emit({conversation_id:e.conversation_id||"",event:e.event,message_id:e.message_id,id:e.id})}},onError:e=>{console.error("发生错误:",e);alert(e instanceof Error?e.message:"消息发送失败,请稍后再试");this.messages=[...this.messages,{...d,answer:"抱歉,发生了错误,请稍后再试。",error:e,isStreaming:false}];this.currentStreamingMessage=null;this.isLoading=false},onComplete:async()=>{console.log("请求完成");this.isLoading=false;const e=this.currentStreamingMessage;this.messages=[...this.messages,this.currentStreamingMessage];this.currentStreamingMessage=null;this.currentQuestionNumber++;if(e&&e.answer){const t=s||e.answer;if(t){const e=await this.synthesizeAudio(t);if(this.enableVoice){await this.playAudio(e);this.startWaitingToRecord()}else{this.audioUrl=e}}}}})}handleScroll=()=>{const e=this.hostElement.shadowRoot?.querySelector(".chat-history");if(!e)return;const{scrollTop:t,scrollHeight:i,clientHeight:s}=e;const o=i-t-s;this.shouldAutoScroll=o<=this.SCROLL_THRESHOLD};scrollToBottom(){if(!this.shouldAutoScroll)return;const e=this.hostElement.shadowRoot?.querySelector(".chat-history");if(e&&this.isOpen){e.scrollTop=e.scrollHeight}}componentDidRender(){if(this.isLoadingHistory||this.shouldAutoScroll&&this.isOpen){const e=this.hostElement.shadowRoot?.querySelector(".chat-history");if(e){e.scrollTop=e.scrollHeight}}}updateUrlWithConversationId(e){const t=new URLSearchParams(window.location.search);if(!t.get("conversation_id")){const t=new URL(window.location.href);t.searchParams.set("conversation_id",e);window.history.replaceState({},"",t)}}async loadHistoryMessages(){if(!this.conversationId)return;this.isLoadingHistory=true;console.log("加载历史消息...");try{await r({url:`https://pcm_api.ylzhaopin.com/external/v1/chat/messages`,method:"GET",headers:{authorization:"Bearer "+this.apiKey},data:{conversation_id:this.conversationId,limit:20},onMessage:e=>{if(e.data){const t=e.data||[];const i=t.map((e=>{const t=new Date(e.created_at*1e3);const i=t.getHours().toString().padStart(2,"0");const s=t.getMinutes().toString().padStart(2,"0");const o=`${i}:${s}`;const{inputs:r,...n}=e;return{...n,time:o,isStreaming:false,status:e.status==="error"?"error":"normal"}}));this.messages=i;this.isLoadingHistory=false;requestAnimationFrame((()=>{this.shouldAutoScroll=true;this.scrollToBottom()}))}else{this.isLoadingHistory=false}},onError:e=>{console.error("加载历史消息失败:",e);alert(e instanceof Error?e.message:"加载历史消息失败,请刷新重试");this.isLoadingHistory=false},onComplete:()=>{this.isLoadingHistory=false}})}catch(e){console.error("加载历史消息失败:",e);alert(e instanceof Error?e.message:"加载历史消息失败,请刷新重试");this.isLoadingHistory=false}}async handleIsOpenChange(e){if(e){if(this.conversationId){await this.loadHistoryMessages()}else{this.sendMessageToAPI("请您开始提问")}}}startWaitingToRecord(){if(this.waitingTimer){clearInterval(this.waitingTimer)}if(this.recordingTimer){clearInterval(this.recordingTimer)}this.waitingToRecord=true;this.waitingTimeLeft=10;this.waitingTimer=setInterval((()=>{this.waitingTimeLeft--;if(this.waitingTimeLeft<=0){clearInterval(this.waitingTimer);this.waitingTimer=null;this.waitingToRecord=false;this.startRecording()}}),1e3)}async startRecording(){try{const e=await navigator.mediaDevices.getUserMedia({audio:true,video:{width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}}});this.recordingStream=e;this.showRecordingUI=true;this.showCountdownWarning=false;this.videoRef=null;this.setupVideoPreview(e);const t=this.getSupportedMimeType();let i;try{i=new MediaRecorder(e,{mimeType:t})}catch(t){console.warn("指定的MIME类型不受支持,使用默认设置:",t);try{i=new MediaRecorder(e)}catch(e){this.recordingError.emit({type:"recorder_creation_failed",message:"无法创建媒体录制器,您的浏览器可能不支持此功能",details:e});this.showRecordingUI=false;return}}this.mediaRecorder=i;const s=[];i.ondataavailable=e=>{if(e.data.size>0){s.push(e.data)}};i.onerror=e=>{this.recordingError.emit({type:"recording_error",message:"录制过程中发生错误",details:e});this.stopRecording()};i.onstop=()=>{try{const e=t||"video/mp4";const i=new Blob(s,{type:e});if(i.size===0){this.recordingError.emit({type:"empty_recording",message:"录制的视频为空"});this.showRecordingUI=false;return}this.recordedBlob=i;this.recordingStatusChange.emit({status:"stopped",details:{duration:Math.floor((Date.now()-this.recordingStartTime)/1e3),size:i.size,type:i.type}});this.uploadRecordedVideo()}catch(e){this.recordingError.emit({type:"processing_error",message:"处理录制视频时出错",details:e});this.showRecordingUI=false}};try{i.start();this.isRecording=true;this.recordingStartTime=Date.now();this.recordingTimeLeft=this.maxRecordingTime;this.recordingStatusChange.emit({status:"started",details:{maxDuration:this.maxRecordingTime,mimeType:i.mimeType}})}catch(e){this.recordingError.emit({type:"start_failed",message:"开始录制失败,请检查您的设备权限",details:e});this.showRecordingUI=false;return}this.recordingTimer=setInterval((()=>{const e=Math.floor((Date.now()-this.recordingStartTime)/1e3);this.recordingTimeLeft=Math.max(0,this.maxRecordingTime-e);if(this.recordingTimeLeft<=this.countdownWarningTime&&!this.showCountdownWarning){this.showCountdownWarning=true}if(this.recordingTimeLeft<=0){this.stopRecording()}}),1e3)}catch(e){console.error("无法访问摄像头或麦克风:",e);this.recordingError.emit({type:"media_access_failed",message:"无法访问摄像头或麦克风,请确保已授予权限",details:e});this.showRecordingUI=false}}setupVideoPreview(e){setTimeout((()=>{const t=this.hostElement.shadowRoot?.querySelector("video");if(t&&e){try{t.srcObject=e;t.play().catch((e=>{console.error("视频播放失败:",e)}))}catch(i){console.warn("设置srcObject失败,尝试替代方法:",i);try{const i=URL.createObjectURL(e);t.src=i;t.onended=()=>{URL.revokeObjectURL(i)}}catch(e){console.error("创建对象URL失败:",e)}}}else{console.warn("未找到视频元素或媒体流无效")}}),100)}getSupportedMimeType(){const e=["video/webm;codecs=vp8,opus","video/webm;codecs=vp9,opus","video/webm","video/mp4","video/mp4;codecs=h264,aac",""];if(!window.MediaRecorder){console.warn("MediaRecorder API不可用");return""}for(const t of e){if(!t)return"";try{if(MediaRecorder.isTypeSupported(t)){console.log("使用支持的MIME类型:",t);return t}}catch(e){console.warn(`检查MIME类型支持时出错 ${t}:`,e)}}console.warn("没有找到支持的MIME类型,将使用浏览器默认值");return""}stopRecording(){if(this.mediaRecorder&&this.isRecording){this.mediaRecorder.stop();this.isRecording=false;if(this.recordingTimer){clearInterval(this.recordingTimer);this.recordingTimer=null}if(this.recordingStream){this.recordingStream.getTracks().forEach((e=>e.stop()));this.recordingStream=null}this.videoRef=null}}async uploadRecordedVideo(){if(!this.recordedBlob)return;try{this.isUploadingVideo=true;this.showRecordingUI=false;const e=this.recordedBlob.type.includes("webm")?"webm":"mp4";const t=`answer.${e}`;const i=new FormData;i.append("file",this.recordedBlob,t);const s=await fetch("https://pcm_api.ylzhaopin.com/external/v1/files/upload",{method:"POST",headers:{authorization:"Bearer "+this.apiKey},body:i});const o=await s.json();console.log("视频上传结果:",o);if(o&&o.cos_key){const e=await this.convertAudioToText(o.cos_key);await this.sendMessageToAPI(e||"下一题",o.cos_key)}else{throw new Error("视频上传失败")}}catch(e){console.error("视频上传或处理错误:",e);this.recordingError.emit({type:"upload_failed",message:"视频上传或处理失败",details:e})}finally{this.isUploadingVideo=false;this.showRecordingUI=false;this.recordedBlob=null}}async convertAudioToText(e){try{return new Promise(((t,i)=>{r({url:`https://pcm_api.ylzhaopin.com/external/v1/tts/audio_to_text`,method:"POST",headers:{"Content-Type":"application/json",authorization:"Bearer "+this.apiKey},data:{cos_key:e},onMessage:e=>{if(e&&e.text){console.log("转换后的文本:",e.text);t(e.text)}else{console.warn("音频转文字返回结果格式不正确");t(null)}},onError:e=>{console.error("音频转文字请求失败:",e);i(e)}})}))}catch(e){console.error("音频转文字错误:",e);return null}}async completeInterview(e,t){if(!this.conversationId)return;const i={response_mode:"streaming",conversation_id:this.conversationId,query:e,inputs:{id:this.resumeId}};if(t){i.inputs.video_url=t}o({url:`https://pcm_api.ylzhaopin.com/external/v1/chat/chat-messages`,method:"POST",headers:{authorization:"Bearer "+this.apiKey},data:i}).catch((e=>{console.error("发送面试完成请求失败:",e)}))}async synthesizeAudio(e){try{const t=await fetch("https://pcm_api.ylzhaopin.com/external/v1/tts/synthesize_audio",{method:"POST",headers:{"Content-Type":"application/json",authorization:"Bearer "+this.apiKey},body:JSON.stringify({text:e})});if(!t.ok){throw new Error("语音合成失败")}const i=await t.blob();return URL.createObjectURL(i)}catch(e){console.error("语音合成错误:",e);throw e}}playAudio(e){return new Promise((t=>{this.isPlayingAudio=true;this.audioUrl=e;if(!this.audioElement){this.audioElement=new Audio}this.audioElement.src=e;this.audioElement.onended=()=>{this.isPlayingAudio=false;this.audioUrl=null;t()};this.audioElement.onerror=()=>{console.error("音频播放错误");this.isPlayingAudio=false;this.audioUrl=null;t()};this.audioElement.play().catch((e=>{console.error("音频播放失败:",e);this.isPlayingAudio=false;this.audioUrl=null;t()}))}))}disconnectedCallback(){if(this.audioElement){this.audioElement.pause();this.audioElement.src="";this.audioElement=null}if(this.audioUrl){URL.revokeObjectURL(this.audioUrl);this.audioUrl=null}if(this.waitingTimer){clearInterval(this.waitingTimer);this.waitingTimer=null}if(this.recordingTimer){clearInterval(this.recordingTimer);this.recordingTimer=null}this.stopRecording()}handlePlayAudio=async()=>{if(this.audioUrl){await this.playAudio(this.audioUrl);this.startWaitingToRecord()}};render(){if(!this.isOpen)return null;const e={zIndex:String(this.zIndex)};const t={"modal-container":true,fullscreen:this.fullscreen};const i={"modal-overlay":true,"fullscreen-overlay":this.fullscreen};const o=()=>s("div",{class:"video-preview"},s("video",{autoPlay:true,playsInline:true,muted:true,style:{transform:"scaleX(-1)"},ref:e=>{if(e&&this.recordingStream&&!this.videoRef){this.videoRef=e}}}),s("div",{class:{"recording-status":true,warning:this.showCountdownWarning}},s("span",{class:"recording-dot"}),s("span",null,"录制中 ",Math.floor(this.recordingTimeLeft/60),":",(this.recordingTimeLeft%60).toString().padStart(2,"0"),this.showCountdownWarning&&` (即将自动完成)`)));const r=()=>{if(this.isPlayingAudio){return s("div",{class:"placeholder-status"},s("p",null,"正在播放问题,请听完后准备回答..."))}if(this.isUploadingVideo){return s("div",{class:"placeholder-status"},s("p",null,"正在上传视频,请稍候..."))}if(this.isLoading||this.currentStreamingMessage){return s("div",{class:"placeholder-status"},s("p",null,"请等待题目..."))}if(this.waitingToRecord){return s("div",{class:"placeholder-status"},s("p",null,"请准备好,",this.waitingTimeLeft,"秒后将开始录制您的回答..."))}return s("div",{class:"placeholder-status default-status"},s("p",null,"准备中..."))};return s("div",{class:i,style:e},s("div",{class:t},this.isShowHeader&&s("div",{class:"modal-header"},s("div",{class:"header-left"},this.icon&&s("img",{src:this.icon,class:"header-icon",alt:"应用图标"}),s("div",null,this.modalTitle)),this.isNeedClose&&s("button",{class:"close-button",onClick:this.handleClose},s("span",null,"×"))),s("div",{style:{height:"100%"}},s("div",{class:"chat-history",onScroll:this.handleScroll},this.isLoadingHistory?s("div",{class:"loading-container"},s("div",{class:"loading-spinner"}),s("p",null,"加载历史消息中...")):s("div",null,this.messages.map((e=>s("div",{id:`message_${e.id}`,key:e.id},s("pcm-chat-message",{message:e,onMessageChange:t=>{const i=this.messages.map((i=>i.id===e.id?{...i,...t.detail}:i));this.messages=i}})))),this.currentStreamingMessage&&s("div",{id:`message_${this.currentStreamingMessage.id}`},s("pcm-chat-message",{message:this.currentStreamingMessage})))),s("div",{class:"recording-section"},s("div",{class:"recording-container"},s("div",{class:"video-area"},this.showRecordingUI?o():s("div",{class:"video-preview placeholder"},r())),s("div",{class:"progress-container"},s("div",{class:"progress-bar-container"},s("div",{class:"progress-bar",style:{width:`${Math.max(0,this.currentQuestionNumber-1)/this.totalQuestions*100}%`}})),s("div",{class:"progress-text"},"已完成",Math.max(0,this.currentQuestionNumber-1),"/",this.totalQuestions)),s("div",{class:"recording-controls"},this.showRecordingUI?s("button",{class:"stop-recording-button",onClick:()=>this.stopRecording()},"完成本题回答"):s("div",{class:"waiting-message"},(()=>{if(!this.enableVoice&&this.audioUrl&&!this.isPlayingAudio){return s("div",{class:"play-audio-container",onClick:this.handlePlayAudio},s("p",null,s("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",style:{verticalAlign:"middle",marginRight:"8px"}},s("path",{d:"M8 5v14l11-7z"})),s("span",{style:{verticalAlign:"middle"}},"播放题目")))}return s("button",{class:"stop-recording-button disabled",disabled:true},"完成回答")})())))))))}static get watchers(){return{isOpen:["handleIsOpenChange"]}}};a.style=n;export{a as pcm_video_chat_modal};
|
|
2
|
-
//# sourceMappingURL=p-5f624943.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["pcmVideoChatModalCss","VideoChatModal","modalTitle","apiKey","isOpen","messages","modalClosed","icon","zIndex","isShowHeader","isNeedClose","conversationId","currentAssistantMessage","isLoading","currentStreamingMessage","shouldAutoScroll","isLoadingHistory","streamComplete","defaultQuery","showInitialUpload","isRecording","recordingStream","recordedBlob","mediaRecorder","recordingTimeLeft","showRecordingUI","recordingTimer","recordingStartTime","recordingMaxTime","waitingToRecord","waitingTimer","waitingTimeLeft","videoRef","totalQuestions","currentQuestionNumber","isInterviewComplete","interviewComplete","SCROLL_THRESHOLD","maxRecordingTime","countdownWarningTime","showCountdownWarning","fullscreen","isUploadingVideo","isPlayingAudio","audioUrl","audioElement","recordingError","recordingStatusChange","enableVoice","displayContentStatus","resumeId","handleClose","this","stopRecording","emit","sendMessageToAPI","message","videoUrl","answer","llmText","now","Date","time","getHours","getMinutes","toString","padStart","queryText","trim","isLastQuestion","newMessage","id","query","isStreaming","conversation_id","inputs","status","error","scrollToBottom","completeInterview","total_questions","requestData","response_mode","video_url","sendSSERequest","url","method","headers","authorization","data","onMessage","console","log","updateUrlWithConversationId","event","LLMText","updatedMessage","message_id","onError","alert","Error","onComplete","async","latestAIMessage","textForSynthesis","synthesizeAudio","playAudio","startWaitingToRecord","handleScroll","chatHistory","hostElement","shadowRoot","querySelector","scrollTop","scrollHeight","clientHeight","distanceFromBottom","componentDidRender","urlParams","URLSearchParams","window","location","search","get","newUrl","URL","href","searchParams","set","history","replaceState","loadHistoryMessages","sendHttpRequest","limit","historyData","formattedMessages","map","msg","created_at","hours","minutes","timeStr","msgWithoutInputs","requestAnimationFrame","handleIsOpenChange","newValue","clearInterval","setInterval","startRecording","stream","navigator","mediaDevices","getUserMedia","audio","video","width","ideal","height","frameRate","setupVideoPreview","mimeType","getSupportedMimeType","MediaRecorder","e","warn","recorderError","type","details","chunks","ondataavailable","size","push","onerror","onstop","blobType","blob","Blob","duration","Math","floor","uploadRecordedVideo","start","maxDuration","startError","elapsedTime","max","setTimeout","videoElement","srcObject","play","catch","err","objectUrl","createObjectURL","src","onended","revokeObjectURL","urlError","mimeTypes","isTypeSupported","stop","getTracks","forEach","track","fileExtension","includes","fileName","formData","FormData","append","response","fetch","body","result","json","cos_key","transcriptionText","convertAudioToText","cosKey","Promise","resolve","reject","text","JSON","stringify","ok","audioBlob","Audio","disconnectedCallback","pause","handlePlayAudio","render","modalStyle","String","containerClass","overlayClass","renderVideoPreview","h","class","autoPlay","playsInline","muted","style","transform","ref","el","warning","renderPlaceholderStatus","alt","onClick","onScroll","key","onMessageChange","updatedMessages","detail","viewBox","fill","verticalAlign","marginRight","d","disabled"],"sources":["src/components/pcm-video-chat-modal/pcm-video-chat-modal.css?tag=pcm-video-chat-modal&encapsulation=shadow","src/components/pcm-video-chat-modal/pcm-video-chat-modal.tsx"],"sourcesContent":[":host {\r\n display: block;\r\n }\r\n \r\n .modal-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n overflow-y: auto;\r\n padding: 20px;\r\n z-index: 1000;\r\n }\r\n \r\n /* 全屏模式下取消 padding */\r\n .fullscreen-overlay {\r\n padding: 0;\r\n }\r\n \r\n .modal-container {\r\n background: white;\r\n border-radius: 8px;\r\n width: 100%;\r\n max-width: 800px;\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n margin: auto;\r\n }\r\n \r\n /* 全屏模式样式 */\r\n .modal-container.fullscreen {\r\n width: 100vw;\r\n max-width: none;\r\n height: 100%;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n height: 100vh;\r\n max-height: 100vh;\r\n }\r\n \r\n /* 确保内容区域也使用 flex 布局并占满剩余空间 */\r\n .modal-container.fullscreen > div:not(.modal-header):not(.initial-upload) {\r\n display: flex;\r\n flex-direction: column;\r\n flex: 1;\r\n overflow: hidden; /* 防止内容溢出 */\r\n height: 100%;\r\n }\r\n \r\n /* PC端布局 */\r\n .pc-layout {\r\n width: 80%;\r\n max-width: 800px;\r\n /* height: 80vh; */\r\n /* max-height: 700px; */\r\n min-width: 320px;\r\n min-height: 400px;\r\n }\r\n \r\n /* 移动端布局 */\r\n .mobile-layout {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 0;\r\n }\r\n \r\n /* 响应式布局 */\r\n @media screen and (max-width: 768px) {\r\n .pc-layout {\r\n width: 95%;\r\n /* height: 90vh; */\r\n }\r\n \r\n .modal-overlay {\r\n padding: 0;\r\n }\r\n \r\n .modal-container.fullscreen {\r\n /* 支持 iOS Safari */\r\n height: -webkit-fill-available;\r\n max-height: -webkit-fill-available;\r\n /* 确保内容不会被顶部状态栏和底部工具栏遮挡 */\r\n padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);\r\n }\r\n \r\n \r\n .modal-container.mobile-layout {\r\n width: 100%;\r\n height: 100vh;\r\n max-height: 100vh;\r\n min-height: 100vh;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n \r\n }\r\n .video-preview.placeholder {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n background: #EAEAEA;\r\n }\r\n \r\n .placeholder-status {\r\n color: #00000066;\r\n }\r\n \r\n .waiting-message p {\r\n margin: 0;\r\n font-size: 16px;\r\n color: white;\r\n font-weight: 500;\r\n }\r\n \r\n .recording-container {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n }\r\n \r\n \r\n \r\n .video-area {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n }\r\n \r\n .stop-recording-button {\r\n width: 100%;\r\n height: 100%;\r\n font-size: 16px;\r\n background: #f44336;\r\n border-radius: 6px;\r\n color: white;\r\n border: none;\r\n cursor: pointer;\r\n }\r\n \r\n .stop-recording-button:hover {\r\n background: #d32f2f;\r\n }\r\n \r\n .play-audio-container {\r\n width: 100%;\r\n height: 100%;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n \r\n .modal-header {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n padding: 4px 16px;\r\n height: 50px;\r\n border-bottom: 1px solid #e8e8e8;\r\n flex-shrink: 0; /* 防止头部被压缩 */\r\n }\r\n \r\n .header-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n }\r\n \r\n .header-icon {\r\n width: 24px;\r\n height: 24px;\r\n }\r\n \r\n .close-button {\r\n background: transparent;\r\n border: none;\r\n cursor: pointer;\r\n padding: 8px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 32px;\r\n height: 32px;\r\n border-radius: 4px;\r\n }\r\n \r\n .close-button:hover {\r\n background-color: rgba(0, 0, 0, 0.04);\r\n }\r\n \r\n .close-button span {\r\n font-size: 24px;\r\n line-height: 1;\r\n color: #999;\r\n }\r\n \r\n .close-button:hover span {\r\n color: #666;\r\n }\r\n \r\n .chat-history {\r\n position: relative;\r\n flex: 1;\r\n overflow-y: auto;\r\n padding: 20px;\r\n scroll-behavior: smooth;\r\n min-height: 200px;\r\n background: url(https://pcm-resource-1312611446.cos.ap-guangzhou.myqcloud.com/web/sdk/chat_bg.png);\r\n background-size: 100%;\r\n }\r\n \r\n /* 添加全屏模式下的样式 */\r\n .fullscreen .chat-history {\r\n height: auto;\r\n flex: 1 1 auto;\r\n }\r\n \r\n \r\n .message-input {\r\n padding: 16px;\r\n border-top: 1px solid #eee;\r\n display: flex;\r\n gap: 8px;\r\n align-items: center;\r\n }\r\n \r\n .message-input input {\r\n flex: 1;\r\n padding: 8px 12px;\r\n border: 1px solid #ddd;\r\n border-radius: 4px;\r\n outline: none;\r\n transition: border-color 0.2s ease;\r\n }\r\n \r\n .message-input input:focus {\r\n border-color: #bbb;\r\n }\r\n \r\n /* 消息样式 */\r\n .message {\r\n margin-bottom: 16px;\r\n opacity: 1;\r\n transition: opacity 0.3s ease;\r\n }\r\n \r\n .message-content {\r\n max-width: 70%;\r\n padding: 8px 12px;\r\n border-radius: 8px;\r\n word-break: break-word;\r\n }\r\n \r\n .message-content p {\r\n margin: 0;\r\n word-break: break-word;\r\n }\r\n \r\n .user-message {\r\n display: flex;\r\n justify-content: flex-end;\r\n }\r\n \r\n .agent-message {\r\n display: flex;\r\n justify-content: flex-start;\r\n }\r\n \r\n .user-message .message-content {\r\n background-color: #007bff;\r\n color: white;\r\n }\r\n \r\n .agent-message .message-content {\r\n background-color: #f1f1f1;\r\n }\r\n \r\n .message-time {\r\n font-size: 12px;\r\n color: #999;\r\n margin-top: 4px;\r\n display: block;\r\n }\r\n \r\n .send-button {\r\n background-color: #1890ff;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 8px 16px;\r\n cursor: pointer;\r\n font-weight: 500;\r\n }\r\n \r\n .send-button:disabled {\r\n background-color: #ccc;\r\n cursor: not-allowed;\r\n }\r\n \r\n .empty-state {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n height: 100%;\r\n color: #999;\r\n text-align: center;\r\n }\r\n \r\n .loading-container {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: center;\r\n align-items: center;\r\n background-color: rgba(255, 255, 255, 0.98);\r\n z-index: 1;\r\n opacity: 1;\r\n transition: opacity 0.3s ease;\r\n }\r\n \r\n .loading-container p {\r\n margin-top: 16px;\r\n color: #666;\r\n font-size: 14px;\r\n }\r\n \r\n .loading-spinner {\r\n width: 40px;\r\n height: 40px;\r\n border: 3px solid #f3f3f3;\r\n border-top: 3px solid #1890ff;\r\n border-radius: 50%;\r\n animation: spin 1s linear infinite;\r\n }\r\n \r\n @keyframes spin {\r\n 0% {\r\n transform: rotate(0deg);\r\n }\r\n \r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n }\r\n \r\n /* 修改 messages-wrapper 的样式 */\r\n .messages-wrapper {\r\n width: 100%;\r\n min-height: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n /* 当内容少时,将内容放在底部 */\r\n justify-content: flex-end;\r\n }\r\n \r\n /* 当有很多消息时,取消固定在底部 */\r\n .messages-wrapper.has-overflow {\r\n justify-content: flex-start;\r\n }\r\n \r\n .suggested-questions {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 8px;\r\n padding: 16px;\r\n }\r\n \r\n .suggested-question {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n padding: 8px 12px;\r\n background-color: #f3f4f6;\r\n border-radius: 4px;\r\n cursor: pointer;\r\n font-size: 14px;\r\n color: #374151;\r\n transition: background-color 0.2s;\r\n }\r\n \r\n .suggested-question:hover {\r\n background-color: #e5e7eb;\r\n }\r\n \r\n .arrow-right {\r\n margin-left: 8px;\r\n }\r\n \r\n .loading-suggestions {\r\n display: flex;\r\n justify-content: center;\r\n padding: 16px;\r\n }\r\n \r\n .loading-spinner-small {\r\n width: 20px;\r\n height: 20px;\r\n border: 2px solid #e5e7eb;\r\n border-top-color: #6b7280;\r\n border-radius: 50%;\r\n animation: spin 1s linear infinite;\r\n }\r\n \r\n /* 添加上传按钮样式 */\r\n .upload-button {\r\n background: transparent;\r\n border: none;\r\n cursor: pointer;\r\n padding: 8px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n color: #666;\r\n border-radius: 4px;\r\n transition: background-color 0.2s;\r\n }\r\n \r\n .upload-button:hover {\r\n background-color: rgba(0, 0, 0, 0.04);\r\n }\r\n \r\n .upload-button svg {\r\n width: 20px;\r\n height: 20px;\r\n }\r\n \r\n /* 添加文件名显示区域样式 */\r\n .selected-file {\r\n font-size: 12px;\r\n color: #666;\r\n margin-left: 8px;\r\n max-width: 150px;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n }\r\n \r\n .input-wrapper {\r\n flex: 1;\r\n display: flex;\r\n align-items: center;\r\n border: 1px solid #ddd;\r\n border-radius: 4px;\r\n padding: 0 4px;\r\n background: white;\r\n }\r\n \r\n .input-wrapper input {\r\n border: none;\r\n flex: 1;\r\n padding: 8px;\r\n outline: none;\r\n }\r\n \r\n .input-wrapper:focus-within {\r\n border-color: #bbb;\r\n }\r\n \r\n /* 文件预览区域样式 */\r\n .file-preview {\r\n padding: 8px 16px;\r\n border-top: 1px solid #eee;\r\n background-color: #f9f9f9;\r\n }\r\n \r\n .function-select {\r\n margin-top: 2rem;\r\n }\r\n \r\n .function-options {\r\n display: flex;\r\n flex-wrap: wrap;\r\n gap: 1rem;\r\n justify-content: center;\r\n margin-top: 1rem;\r\n }\r\n \r\n .function-button {\r\n padding: 0.5rem 1rem;\r\n border: 1px solid #ddd;\r\n border-radius: 4px;\r\n background: white;\r\n cursor: pointer;\r\n transition: all 0.3s ease;\r\n }\r\n \r\n .function-button:hover {\r\n border-color: #1890ff;\r\n color: #1890ff;\r\n }\r\n \r\n .function-button.selected {\r\n background: #1890ff;\r\n color: white;\r\n border-color: #1890ff;\r\n }\r\n \r\n .recording-section {\r\n border-top: 1px solid #eee;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n padding: 20px;\r\n border-radius: 14px 14px 0 0;\r\n flex: 0 0 auto;\r\n }\r\n \r\n .recording-section .video-preview {\r\n width: 100%;\r\n height: 200px;\r\n max-width: 400px;\r\n position: relative;\r\n margin-bottom: 10px;\r\n border: 1px solid #ddd;\r\n border-radius: 12px;\r\n overflow: hidden;\r\n }\r\n \r\n .recording-section video {\r\n width: 100%;\r\n height: 100%;\r\n object-fit: cover;\r\n }\r\n \r\n /* 修改 recording-status 样式 */\r\n .recording-status {\r\n position: absolute;\r\n top: 10px;\r\n left: 10px;\r\n background-color: rgba(0, 0, 0, 0.6);\r\n color: white;\r\n padding: 4px 8px;\r\n border-radius: 4px;\r\n display: flex;\r\n align-items: center;\r\n gap: 5px;\r\n font-size: 0.8rem;\r\n z-index: 2;\r\n }\r\n \r\n .recording-status .recording-dot {\r\n display: inline-block;\r\n width: 10px;\r\n height: 10px;\r\n background-color: red;\r\n border-radius: 50%;\r\n margin-right: 5px;\r\n animation: blink 1s infinite;\r\n }\r\n \r\n .recording-status.warning {\r\n color: #ff4d4f;\r\n animation: blink 1s infinite;\r\n }\r\n \r\n @keyframes blink {\r\n 0% {\r\n opacity: 1;\r\n }\r\n \r\n 50% {\r\n opacity: 0.5;\r\n }\r\n \r\n 100% {\r\n opacity: 1;\r\n }\r\n }\r\n \r\n .recording-section .stop-recording-button {\r\n background-color: #f44336;\r\n color: white;\r\n border: none;\r\n cursor: pointer;\r\n font-weight: bold;\r\n }\r\n \r\n .recording-section .stop-recording-button:hover {\r\n background-color: #d32f2f;\r\n }\r\n \r\n .fullscreen {\r\n width: 100vw;\r\n border-radius: 0;\r\n height: 100vh;\r\n display: flex;\r\n flex-direction: column;\r\n overflow-y: auto;\r\n }\r\n \r\n .recording-controls {\r\n margin-top: 10px;\r\n height: 53px;\r\n width: 100%;\r\n max-width: 400px;\r\n display: flex;\r\n justify-content: center;\r\n }\r\n \r\n .recording-controls .waiting-message {\r\n text-align: center;\r\n color: white;\r\n font-size: 1rem;\r\n background-image: linear-gradient(100deg, #4A9FFF 0%, #1058FF 100%);\r\n border-radius: 6px;\r\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\r\n width: 95%;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n cursor: pointer;\r\n }\r\n \r\n .recording-controls .waiting-message.loading {\r\n background: #faad14;\r\n }\r\n \r\n .recording-controls .waiting-message p {\r\n margin: 0;\r\n font-size: 16px;\r\n color: white;\r\n font-weight: 500;\r\n }\r\n \r\n .recording-controls .stop-recording-button {\r\n background-color: #dc3545;\r\n color: white;\r\n border: none;\r\n cursor: pointer;\r\n font-size: 1rem;\r\n }\r\n \r\n .recording-controls .stop-recording-button:hover {\r\n background-color: #c82333;\r\n }\r\n \r\n /* 添加禁用状态的样式 */\r\n .recording-controls .stop-recording-button.disabled {\r\n background: #ccc;\r\n cursor: not-allowed;\r\n }\r\n \r\n .recording-controls .stop-recording-button.disabled:hover {\r\n background: #ccc;\r\n }\r\n \r\n /* 添加进度条和数字进度的样式 */\r\n .progress-container {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n width: 100%;\r\n max-width: 400px;\r\n margin-top: 10px;\r\n padding: 0 5px;\r\n }\r\n \r\n .progress-bar-container {\r\n height: 4px;\r\n background-color: #E5E5E5;\r\n border-radius: 2px;\r\n overflow: hidden;\r\n margin-right: 10px;\r\n width: 75px;\r\n }\r\n \r\n .progress-bar {\r\n height: 100%;\r\n background-image: linear-gradient(111deg, #4A9FFF 0%, #1058FF 100%);\r\n border-radius: 2px;\r\n transition: width 0.3s ease;\r\n }\r\n \r\n .progress-text {\r\n font-size: 14px;\r\n color: #666;\r\n white-space: nowrap;\r\n }","import { Component, Prop, h, State, Event, EventEmitter, Element, Watch } from '@stencil/core';\r\nimport { convertWorkflowStreamNodeToMessageRound, UserInputMessageType, sendSSERequest, sendHttpRequest } from '../../utils/utils';\r\nimport { ChatMessage } from '../../interfaces/chat';\r\n\r\n@Component({\r\n tag: 'pcm-video-chat-modal',\r\n styleUrl: 'pcm-video-chat-modal.css',\r\n shadow: true,\r\n})\r\nexport class VideoChatModal {\r\n /**\r\n * 模态框标题\r\n */\r\n @Prop() modalTitle: string = '在线客服';\r\n\r\n /**\r\n * API鉴权密钥\r\n */\r\n @Prop({ attribute: 'api-key' }) apiKey: string = '';\r\n\r\n /**\r\n * 是否显示聊天模态框\r\n */\r\n @Prop({ mutable: true }) isOpen: boolean = false;\r\n\r\n /**\r\n * 聊天消息历史\r\n */\r\n @State() messages: ChatMessage[] = [];\r\n\r\n\r\n /**\r\n * 当点击模态框关闭时触发\r\n */\r\n @Event() modalClosed: EventEmitter<void>;\r\n\r\n /**\r\n * 应用图标URL\r\n */\r\n @Prop() icon?: string;\r\n\r\n /**\r\n * 聊天框的页面层级\r\n */\r\n @Prop() zIndex?: number = 1000;\r\n\r\n /**\r\n * 是否展示顶部标题栏\r\n */\r\n @Prop() isShowHeader: boolean = true;\r\n\r\n /**\r\n * 是否展示右上角的关闭按钮\r\n */\r\n @Prop() isNeedClose: boolean = true;\r\n\r\n\r\n /**\r\n * 会话ID\r\n */\r\n @Prop({ mutable: true }) conversationId?: string;\r\n\r\n /**\r\n * 当前助手回复的消息\r\n */\r\n @State() currentAssistantMessage: string = '';\r\n\r\n /**\r\n * 是否正在加载回复\r\n */\r\n @State() isLoading: boolean = false;\r\n\r\n /**\r\n * 当前正在流式输出的消息\r\n */\r\n @State() currentStreamingMessage: ChatMessage | null = null;\r\n\r\n // 添加新的状态控制\r\n @State() shouldAutoScroll: boolean = true;\r\n\r\n @State() isLoadingHistory: boolean = false;\r\n\r\n // 使用 @Element 装饰器获取组件的 host 元素\r\n @Element() hostElement: HTMLElement;\r\n\r\n // 添加新的 Event\r\n @Event() streamComplete: EventEmitter<{\r\n conversation_id: string;\r\n event: string;\r\n message_id: string;\r\n id: string;\r\n }>;\r\n\r\n /**\r\n * 默认查询文本\r\n */\r\n @Prop() defaultQuery: string = '';\r\n\r\n // 添加新的状态\r\n @State() showInitialUpload: boolean = true;\r\n\r\n // 添加视频录制相关状态\r\n @State() isRecording: boolean = false;\r\n @State() recordingStream: MediaStream | null = null;\r\n @State() recordedBlob: Blob | null = null;\r\n @State() mediaRecorder: MediaRecorder | null = null;\r\n @State() recordingTimeLeft: number = 0;\r\n @State() showRecordingUI: boolean = false;\r\n @State() recordingTimer: any = null;\r\n @State() recordingStartTime: number = 0;\r\n @State() recordingMaxTime: number = 120; // 最大录制时间(秒)\r\n @State() waitingToRecord: boolean = false;\r\n @State() waitingTimer: any = null;\r\n @State() waitingTimeLeft: number = 10; // 等待时间(秒)\r\n\r\n // 添加一个新的私有属性来存储视频元素的引用\r\n private videoRef: HTMLVideoElement | null = null;\r\n\r\n /**\r\n * 总题目数量\r\n */\r\n @Prop() totalQuestions: number = 2;\r\n\r\n /**\r\n * 当前题目序号\r\n */\r\n @State() currentQuestionNumber: number = 0;\r\n\r\n /**\r\n * 面试是否已完成\r\n */\r\n @State() isInterviewComplete: boolean = false;\r\n\r\n /**\r\n * 当面试完成时触发\r\n */\r\n @Event() interviewComplete: EventEmitter<{\r\n conversation_id: string;\r\n total_questions: number;\r\n }>;\r\n\r\n private readonly SCROLL_THRESHOLD = 30;\r\n\r\n /**\r\n * 视频录制最大时长(秒)\r\n */\r\n @Prop() maxRecordingTime: number = 120;\r\n\r\n /**\r\n * 录制倒计时提醒时间(秒)\r\n * 当剩余时间小于此值时,显示倒计时警告\r\n */\r\n @Prop() countdownWarningTime: number = 30;\r\n\r\n @State() showCountdownWarning: boolean = false;\r\n\r\n\r\n /**\r\n * 是否以全屏模式打开\r\n */\r\n @Prop() fullscreen: boolean = false;\r\n\r\n // 添加新的状态来跟踪视频上传\r\n @State() isUploadingVideo: boolean = false;\r\n\r\n // 添加新的状态和属性\r\n @State() isPlayingAudio: boolean = false;\r\n @State() audioUrl: string | null = null;\r\n private audioElement: HTMLAudioElement | null = null;\r\n\r\n /**\r\n * 录制错误事件\r\n */\r\n @Event() recordingError: EventEmitter<{\r\n type: string;\r\n message: string;\r\n details?: any;\r\n }>;\r\n\r\n /**\r\n * 录制状态变化事件\r\n */\r\n @Event() recordingStatusChange: EventEmitter<{\r\n status: 'started' | 'stopped' | 'paused' | 'resumed' | 'failed';\r\n details?: any;\r\n }>;\r\n\r\n /**\r\n * 是否自动播放语音问题\r\n */\r\n @Prop() enableVoice: boolean = true;\r\n\r\n /**\r\n * 是否显示题干内容\r\n * 1: 显示题干内容\r\n * 0: 不显示题干内容\r\n */\r\n @Prop() displayContentStatus: string = \"1\";\r\n\r\n\r\n /**\r\n * 父组件传入的 简历id\r\n */\r\n @Prop() resumeId?: string;\r\n\r\n private handleClose = () => {\r\n this.stopRecording();\r\n this.modalClosed.emit();\r\n };\r\n\r\n private async sendMessageToAPI(message: string, videoUrl?: string) {\r\n this.isLoading = true;\r\n let answer = '';\r\n let llmText = '';\r\n\r\n const now = new Date();\r\n const time = `${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`;\r\n\r\n // 如果消息为空但有文件,使用默认文本\r\n const queryText = message.trim();\r\n\r\n // 检查是否是最后一题的\"下一题\"请求\r\n const isLastQuestion = this.currentQuestionNumber >= this.totalQuestions;\r\n\r\n // 创建新的消息对象\r\n const newMessage: ChatMessage = {\r\n id: `temp-${Date.now()}`,\r\n time: time,\r\n query: queryText,\r\n answer: '',\r\n isStreaming: true,\r\n conversation_id: this.conversationId,\r\n inputs: {},\r\n status: \"normal\",\r\n error: null\r\n };\r\n\r\n // 设置当前流式消息\r\n this.currentStreamingMessage = newMessage;\r\n\r\n this.shouldAutoScroll = true;\r\n // 滚动到底部\r\n this.scrollToBottom();\r\n\r\n // 如果是最后一题,直接显示结束消息并完成面试\r\n if (isLastQuestion) {\r\n this.messages = [...this.messages, newMessage];\r\n this.currentStreamingMessage = null;\r\n this.isLoading = false;\r\n this.isInterviewComplete = true;\r\n await this.completeInterview(queryText, videoUrl);\r\n this.interviewComplete.emit({\r\n conversation_id: this.conversationId,\r\n total_questions: this.totalQuestions\r\n });\r\n this.currentQuestionNumber++;\r\n return;\r\n }\r\n\r\n // 准备请求数据\r\n const requestData: any = {\r\n response_mode: 'streaming',\r\n conversation_id: this.conversationId,\r\n query: queryText,\r\n inputs: {\r\n id: this.resumeId\r\n }\r\n };\r\n\r\n // 如果有视频URL,添加到inputs中\r\n if (videoUrl) {\r\n requestData.inputs.video_url = videoUrl;\r\n }\r\n\r\n await sendSSERequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/chat/chat-messages`,\r\n method: 'POST',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: requestData,\r\n onMessage: (data) => {\r\n console.log('收到Stream数据:', data);\r\n\r\n if (data.conversation_id && !this.conversationId) {\r\n this.conversationId = data.conversation_id;\r\n this.updateUrlWithConversationId(data.conversation_id);\r\n }\r\n\r\n // 检查是否有 node_finished 事件和 LLMText\r\n if (data.event === 'node_finished' && data.data.inputs && data.data.inputs.LLMText) {\r\n llmText = data.data.inputs.LLMText;\r\n console.log('获取到 LLMText:', llmText);\r\n }\r\n\r\n if (data.event === 'message') {\r\n const inputMessage: UserInputMessageType = { message: message };\r\n convertWorkflowStreamNodeToMessageRound('message', inputMessage, data);\r\n\r\n if (data.event === 'agent_message' || data.event === 'message') {\r\n if (data.answer) {\r\n answer += data.answer;\r\n const updatedMessage: ChatMessage = {\r\n ...this.currentStreamingMessage,\r\n answer,\r\n isStreaming: true\r\n };\r\n this.currentStreamingMessage = updatedMessage;\r\n this.scrollToBottom();\r\n }\r\n }\r\n }\r\n if (data.event === \"message_end\") {\r\n this.streamComplete.emit({\r\n conversation_id: data.conversation_id || '',\r\n event: data.event,\r\n message_id: data.message_id,\r\n id: data.id,\r\n });\r\n }\r\n },\r\n onError: (error) => {\r\n console.error('发生错误:', error);\r\n alert(error instanceof Error ? error.message : '消息发送失败,请稍后再试');\r\n this.messages = [...this.messages, {\r\n ...newMessage,\r\n answer: '抱歉,发生了错误,请稍后再试。',\r\n error: error,\r\n isStreaming: false\r\n }];\r\n this.currentStreamingMessage = null;\r\n this.isLoading = false;\r\n },\r\n onComplete: async () => {\r\n console.log('请求完成');\r\n this.isLoading = false;\r\n\r\n // 获取最新的AI回复内容\r\n const latestAIMessage = this.currentStreamingMessage;\r\n\r\n // 更新消息列表\r\n this.messages = [...this.messages, this.currentStreamingMessage];\r\n this.currentStreamingMessage = null;\r\n\r\n // 增加题目计数\r\n this.currentQuestionNumber++;\r\n\r\n if (latestAIMessage && latestAIMessage.answer) {\r\n // 优先使用 LLMText,如果没有则使用 answer\r\n const textForSynthesis = llmText || latestAIMessage.answer;\r\n\r\n if (textForSynthesis) {\r\n // 合成语音\r\n const audioUrl = await this.synthesizeAudio(textForSynthesis);\r\n\r\n if (this.enableVoice) {\r\n // 自动播放语音\r\n await this.playAudio(audioUrl);\r\n // 自动播放模式下,播放完成后立即开始等待录制\r\n this.startWaitingToRecord();\r\n } else {\r\n // 只保存音频URL,不自动播放\r\n this.audioUrl = audioUrl;\r\n // 非自动播放模式下,不立即开始等待录制\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n // 监听滚动事件,用于控制聊天历史记录的自动滚动行为。\r\n private handleScroll = () => {\r\n const chatHistory = this.hostElement.shadowRoot?.querySelector('.chat-history');\r\n if (!chatHistory) return;\r\n\r\n const { scrollTop, scrollHeight, clientHeight } = chatHistory;\r\n const distanceFromBottom = scrollHeight - scrollTop - clientHeight;\r\n\r\n // 更新是否应该自动滚动的状态\r\n this.shouldAutoScroll = distanceFromBottom <= this.SCROLL_THRESHOLD;\r\n };\r\n\r\n private scrollToBottom() {\r\n if (!this.shouldAutoScroll) return;\r\n const chatHistory = this.hostElement.shadowRoot?.querySelector('.chat-history');\r\n if (chatHistory && this.isOpen) {\r\n // 强制浏览器重新计算布局\r\n chatHistory.scrollTop = chatHistory.scrollHeight;\r\n }\r\n }\r\n\r\n // 添加 componentDidRender 生命周期方法,用于在组件渲染后滚动到底部\r\n componentDidRender() {\r\n if (this.isLoadingHistory || (this.shouldAutoScroll && this.isOpen)) {\r\n const chatHistory = this.hostElement.shadowRoot?.querySelector('.chat-history');\r\n if (chatHistory) {\r\n chatHistory.scrollTop = chatHistory.scrollHeight;\r\n }\r\n }\r\n }\r\n\r\n private updateUrlWithConversationId(conversationId: string) {\r\n const urlParams = new URLSearchParams(window.location.search);\r\n if (!urlParams.get('conversation_id')) {\r\n const newUrl = new URL(window.location.href);\r\n newUrl.searchParams.set('conversation_id', conversationId);\r\n window.history.replaceState({}, '', newUrl);\r\n }\r\n }\r\n\r\n // 修改 loadHistoryMessages 方法\r\n private async loadHistoryMessages() {\r\n if (!this.conversationId) return;\r\n\r\n this.isLoadingHistory = true;\r\n console.log('加载历史消息...');\r\n\r\n try {\r\n await sendHttpRequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/chat/messages`,\r\n method: 'GET',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: {\r\n conversation_id: this.conversationId,\r\n limit: 20\r\n },\r\n onMessage: (data) => {\r\n if (data.data) {\r\n const historyData = data.data || [];\r\n const formattedMessages: ChatMessage[] = historyData.map(msg => {\r\n const time = new Date(msg.created_at * 1000);\r\n const hours = time.getHours().toString().padStart(2, '0');\r\n const minutes = time.getMinutes().toString().padStart(2, '0');\r\n const timeStr = `${hours}:${minutes}`;\r\n\r\n // 创建新的消息对象,不包含 inputs 字段\r\n const { inputs, ...msgWithoutInputs } = msg;\r\n\r\n return {\r\n ...msgWithoutInputs,\r\n time: timeStr,\r\n isStreaming: false,\r\n status: msg.status === 'error' ? 'error' : 'normal' as const\r\n };\r\n });\r\n\r\n this.messages = formattedMessages;\r\n this.isLoadingHistory = false;\r\n\r\n requestAnimationFrame(() => {\r\n this.shouldAutoScroll = true;\r\n this.scrollToBottom();\r\n });\r\n } else {\r\n this.isLoadingHistory = false;\r\n }\r\n },\r\n onError: (error) => {\r\n console.error('加载历史消息失败:', error);\r\n alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');\r\n this.isLoadingHistory = false;\r\n },\r\n onComplete: () => {\r\n this.isLoadingHistory = false;\r\n }\r\n });\r\n } catch (error) {\r\n console.error('加载历史消息失败:', error);\r\n alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');\r\n this.isLoadingHistory = false;\r\n }\r\n }\r\n\r\n // 修改 isOpen 的 watch 方法\r\n @Watch('isOpen')\r\n async handleIsOpenChange(newValue: boolean) {\r\n if (newValue) {\r\n if (this.conversationId) {\r\n await this.loadHistoryMessages();\r\n } else {\r\n // 直接开始对话\r\n this.sendMessageToAPI('请您开始提问');\r\n }\r\n }\r\n }\r\n\r\n // 开始等待录制\r\n private startWaitingToRecord() {\r\n // 清除可能存在的计时器\r\n if (this.waitingTimer) {\r\n clearInterval(this.waitingTimer);\r\n }\r\n if (this.recordingTimer) {\r\n clearInterval(this.recordingTimer);\r\n }\r\n\r\n this.waitingToRecord = true;\r\n this.waitingTimeLeft = 10;\r\n\r\n this.waitingTimer = setInterval(() => {\r\n this.waitingTimeLeft--;\r\n if (this.waitingTimeLeft <= 0) {\r\n clearInterval(this.waitingTimer);\r\n this.waitingTimer = null;\r\n this.waitingToRecord = false;\r\n this.startRecording();\r\n }\r\n }, 1000);\r\n }\r\n\r\n // 开始录制视频\r\n private async startRecording() {\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n audio: true,\r\n video: {\r\n width: { ideal: 1280 },\r\n height: { ideal: 720 },\r\n frameRate: { ideal: 30 }\r\n }\r\n });\r\n\r\n this.recordingStream = stream;\r\n this.showRecordingUI = true;\r\n this.showCountdownWarning = false;\r\n\r\n // 重置视频引用\r\n this.videoRef = null;\r\n\r\n // 确保视频元素获取到流\r\n this.setupVideoPreview(stream);\r\n\r\n // 检测浏览器支持的MIME类型\r\n const mimeType = this.getSupportedMimeType();\r\n\r\n // 创建MediaRecorder实例\r\n let mediaRecorder;\r\n try {\r\n mediaRecorder = new MediaRecorder(stream, {\r\n mimeType: mimeType\r\n });\r\n } catch (e) {\r\n // 如果指定MIME类型失败,尝试使用默认设置\r\n console.warn('指定的MIME类型不受支持,使用默认设置:', e);\r\n try {\r\n mediaRecorder = new MediaRecorder(stream);\r\n } catch (recorderError) {\r\n // 通知父组件录制器创建失败\r\n this.recordingError.emit({\r\n type: 'recorder_creation_failed',\r\n message: '无法创建媒体录制器,您的浏览器可能不支持此功能',\r\n details: recorderError\r\n });\r\n this.showRecordingUI = false;\r\n return;\r\n }\r\n }\r\n\r\n this.mediaRecorder = mediaRecorder;\r\n\r\n const chunks: BlobPart[] = [];\r\n\r\n mediaRecorder.ondataavailable = (event) => {\r\n if (event.data.size > 0) {\r\n chunks.push(event.data);\r\n }\r\n };\r\n\r\n mediaRecorder.onerror = (event) => {\r\n // 通知父组件录制过程中发生错误\r\n this.recordingError.emit({\r\n type: 'recording_error',\r\n message: '录制过程中发生错误',\r\n details: event\r\n });\r\n this.stopRecording();\r\n };\r\n\r\n mediaRecorder.onstop = () => {\r\n try {\r\n // 根据实际使用的MIME类型创建Blob\r\n const blobType = mimeType || 'video/mp4';\r\n const blob = new Blob(chunks, { type: blobType });\r\n\r\n if (blob.size === 0) {\r\n // 通知父组件录制的视频为空\r\n this.recordingError.emit({\r\n type: 'empty_recording',\r\n message: '录制的视频为空'\r\n });\r\n this.showRecordingUI = false;\r\n return;\r\n }\r\n\r\n this.recordedBlob = blob;\r\n\r\n // 通知父组件录制已完成\r\n this.recordingStatusChange.emit({\r\n status: 'stopped',\r\n details: {\r\n duration: Math.floor((Date.now() - this.recordingStartTime) / 1000),\r\n size: blob.size,\r\n type: blob.type\r\n }\r\n });\r\n\r\n this.uploadRecordedVideo();\r\n } catch (error) {\r\n // 通知父组件处理录制视频时出错\r\n this.recordingError.emit({\r\n type: 'processing_error',\r\n message: '处理录制视频时出错',\r\n details: error\r\n });\r\n this.showRecordingUI = false;\r\n }\r\n };\r\n\r\n // 开始录制\r\n try {\r\n mediaRecorder.start();\r\n this.isRecording = true;\r\n this.recordingStartTime = Date.now();\r\n this.recordingTimeLeft = this.maxRecordingTime;\r\n\r\n // 通知父组件录制已开始\r\n this.recordingStatusChange.emit({\r\n status: 'started',\r\n details: {\r\n maxDuration: this.maxRecordingTime,\r\n mimeType: mediaRecorder.mimeType\r\n }\r\n });\r\n } catch (startError) {\r\n // 通知父组件开始录制失败\r\n this.recordingError.emit({\r\n type: 'start_failed',\r\n message: '开始录制失败,请检查您的设备权限',\r\n details: startError\r\n });\r\n this.showRecordingUI = false;\r\n return;\r\n }\r\n\r\n // 设置录制计时器\r\n this.recordingTimer = setInterval(() => {\r\n const elapsedTime = Math.floor((Date.now() - this.recordingStartTime) / 1000);\r\n this.recordingTimeLeft = Math.max(0, this.maxRecordingTime - elapsedTime);\r\n\r\n // 检查是否需要显示倒计时警告\r\n if (this.recordingTimeLeft <= this.countdownWarningTime && !this.showCountdownWarning) {\r\n this.showCountdownWarning = true;\r\n }\r\n\r\n // 时间到自动停止录制\r\n if (this.recordingTimeLeft <= 0) {\r\n this.stopRecording();\r\n }\r\n }, 1000);\r\n\r\n } catch (error) {\r\n console.error('无法访问摄像头或麦克风:', error);\r\n // 通知父组件无法访问媒体设备\r\n this.recordingError.emit({\r\n type: 'media_access_failed',\r\n message: '无法访问摄像头或麦克风,请确保已授予权限',\r\n details: error\r\n });\r\n this.showRecordingUI = false;\r\n }\r\n }\r\n\r\n // 添加新方法来设置视频预览\r\n private setupVideoPreview(stream: MediaStream) {\r\n // 延迟执行以确保DOM已更新\r\n setTimeout(() => {\r\n const videoElement = this.hostElement.shadowRoot?.querySelector('video') as HTMLVideoElement;\r\n if (videoElement && stream) {\r\n // 先尝试使用标准方法\r\n try {\r\n videoElement.srcObject = stream;\r\n videoElement.play().catch(err => {\r\n console.error('视频播放失败:', err);\r\n });\r\n } catch (e) {\r\n console.warn('设置srcObject失败,尝试替代方法:', e);\r\n\r\n // 对于不支持srcObject的旧浏览器,使用URL.createObjectURL\r\n try {\r\n // 使用类型断言解决TypeScript错误\r\n const objectUrl = URL.createObjectURL(stream as unknown as MediaSource);\r\n videoElement.src = objectUrl;\r\n\r\n // 确保在视频元素不再使用时释放URL\r\n videoElement.onended = () => {\r\n URL.revokeObjectURL(objectUrl);\r\n };\r\n } catch (urlError) {\r\n console.error('创建对象URL失败:', urlError);\r\n }\r\n }\r\n } else {\r\n console.warn('未找到视频元素或媒体流无效');\r\n }\r\n }, 100);\r\n }\r\n\r\n // 添加一个新方法来检测浏览器支持的MIME类型\r\n private getSupportedMimeType(): string {\r\n // 按优先级排列的MIME类型列表\r\n const mimeTypes = [\r\n 'video/webm;codecs=vp8,opus',\r\n 'video/webm;codecs=vp9,opus',\r\n 'video/webm',\r\n 'video/mp4',\r\n 'video/mp4;codecs=h264,aac',\r\n '' // 空字符串表示使用浏览器默认值\r\n ];\r\n\r\n // 检查MediaRecorder是否可用\r\n if (!window.MediaRecorder) {\r\n console.warn('MediaRecorder API不可用');\r\n return '';\r\n }\r\n\r\n // 检查每种MIME类型是否受支持\r\n for (const type of mimeTypes) {\r\n if (!type) return ''; // 如果是空字符串,直接返回\r\n\r\n try {\r\n if (MediaRecorder.isTypeSupported(type)) {\r\n console.log('使用支持的MIME类型:', type);\r\n return type;\r\n }\r\n } catch (e) {\r\n console.warn(`检查MIME类型支持时出错 ${type}:`, e);\r\n }\r\n }\r\n\r\n // 如果没有找到支持的类型,返回空字符串\r\n console.warn('没有找到支持的MIME类型,将使用浏览器默认值');\r\n return '';\r\n }\r\n\r\n // 停止录制\r\n private stopRecording() {\r\n if (this.mediaRecorder && this.isRecording) {\r\n this.mediaRecorder.stop();\r\n this.isRecording = false;\r\n\r\n // 清理计时器\r\n if (this.recordingTimer) {\r\n clearInterval(this.recordingTimer);\r\n this.recordingTimer = null;\r\n }\r\n\r\n // 停止并释放媒体流\r\n if (this.recordingStream) {\r\n this.recordingStream.getTracks().forEach(track => track.stop());\r\n this.recordingStream = null;\r\n }\r\n\r\n // 清理视频引用\r\n this.videoRef = null;\r\n }\r\n }\r\n\r\n // 上传录制的视频\r\n private async uploadRecordedVideo() {\r\n if (!this.recordedBlob) return;\r\n\r\n try {\r\n this.isUploadingVideo = true; // 开始上传时设置状态\r\n this.showRecordingUI = false; // 隐藏视频预览\r\n\r\n // 根据Blob类型确定文件扩展名\r\n const fileExtension = this.recordedBlob.type.includes('webm') ? 'webm' : 'mp4';\r\n const fileName = `answer.${fileExtension}`;\r\n\r\n const formData = new FormData();\r\n formData.append('file', this.recordedBlob, fileName);\r\n\r\n const response = await fetch('https://pcm_api.ylzhaopin.com/external/v1/files/upload', {\r\n method: 'POST',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n body: formData\r\n });\r\n\r\n const result = await response.json();\r\n console.log('视频上传结果:', result);\r\n\r\n if (result && result.cos_key) {\r\n // 调用音频转文字API\r\n const transcriptionText = await this.convertAudioToText(result.cos_key);\r\n \r\n // 发送转换后的文本和视频URL到下一个请求\r\n await this.sendMessageToAPI(transcriptionText || \"下一题\", result.cos_key);\r\n } else {\r\n throw new Error('视频上传失败');\r\n }\r\n } catch (error) {\r\n console.error('视频上传或处理错误:', error);\r\n this.recordingError.emit({\r\n type: 'upload_failed',\r\n message: '视频上传或处理失败',\r\n details: error\r\n });\r\n } finally {\r\n this.isUploadingVideo = false; // 上传完成后重置状态\r\n this.showRecordingUI = false;\r\n this.recordedBlob = null;\r\n }\r\n }\r\n\r\n // 修改音频转文字方法\r\n private async convertAudioToText(cosKey: string): Promise<string | null> {\r\n try {\r\n // 创建一个Promise来处理响应\r\n return new Promise((resolve, reject) => {\r\n sendHttpRequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/tts/audio_to_text`,\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: {\r\n cos_key: cosKey\r\n },\r\n onMessage: (data) => {\r\n \r\n // 检查返回结果中是否包含转换后的文本\r\n if (data && data.text) {\r\n console.log('转换后的文本:', data.text);\r\n resolve(data.text);\r\n } else {\r\n console.warn('音频转文字返回结果格式不正确');\r\n resolve(null);\r\n }\r\n },\r\n onError: (error) => {\r\n console.error('音频转文字请求失败:', error);\r\n reject(error);\r\n }\r\n });\r\n });\r\n } catch (error) {\r\n console.error('音频转文字错误:', error);\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * 发送面试完成请求\r\n */\r\n private async completeInterview(queryText: string, videoUrl: string) {\r\n if (!this.conversationId) return;\r\n const requestData: any = {\r\n response_mode: 'streaming',\r\n conversation_id: this.conversationId,\r\n query: queryText,\r\n inputs: {\r\n id: this.resumeId\r\n }\r\n };\r\n\r\n // 如果有视频URL,添加到inputs中\r\n if (videoUrl) {\r\n requestData.inputs.video_url = videoUrl;\r\n }\r\n\r\n // 不使用 await,直接发送请求\r\n sendSSERequest({\r\n url: `https://pcm_api.ylzhaopin.com/external/v1/chat/chat-messages`,\r\n method: 'POST',\r\n headers: {\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n data: requestData,\r\n }).catch(error => {\r\n console.error('发送面试完成请求失败:', error);\r\n });\r\n }\r\n\r\n // 添加TTS合成音频的方法\r\n private async synthesizeAudio(text: string): Promise<string> {\r\n try {\r\n const response = await fetch('https://pcm_api.ylzhaopin.com/external/v1/tts/synthesize_audio', {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'authorization': 'Bearer ' + this.apiKey\r\n },\r\n body: JSON.stringify({ text })\r\n });\r\n\r\n if (!response.ok) {\r\n throw new Error('语音合成失败');\r\n }\r\n\r\n // 获取音频数据并创建Blob URL\r\n const audioBlob = await response.blob();\r\n return URL.createObjectURL(audioBlob);\r\n } catch (error) {\r\n console.error('语音合成错误:', error);\r\n throw error;\r\n }\r\n }\r\n\r\n // 播放音频的方法\r\n private playAudio(audioUrl: string): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.isPlayingAudio = true;\r\n this.audioUrl = audioUrl;\r\n\r\n // 创建音频元素\r\n if (!this.audioElement) {\r\n this.audioElement = new Audio();\r\n }\r\n\r\n this.audioElement.src = audioUrl;\r\n this.audioElement.onended = () => {\r\n this.isPlayingAudio = false;\r\n this.audioUrl = null;\r\n resolve();\r\n };\r\n\r\n this.audioElement.onerror = () => {\r\n console.error('音频播放错误');\r\n this.isPlayingAudio = false;\r\n this.audioUrl = null;\r\n resolve();\r\n };\r\n\r\n this.audioElement.play().catch(error => {\r\n console.error('音频播放失败:', error);\r\n this.isPlayingAudio = false;\r\n this.audioUrl = null;\r\n resolve();\r\n });\r\n });\r\n }\r\n\r\n // 修改 componentDidLoad 生命周期方法,确保组件卸载时释放资源\r\n disconnectedCallback() {\r\n // 释放音频资源\r\n if (this.audioElement) {\r\n this.audioElement.pause();\r\n this.audioElement.src = '';\r\n this.audioElement = null;\r\n }\r\n\r\n // 释放 Blob URL\r\n if (this.audioUrl) {\r\n URL.revokeObjectURL(this.audioUrl);\r\n this.audioUrl = null;\r\n }\r\n\r\n // 清理其他计时器\r\n if (this.waitingTimer) {\r\n clearInterval(this.waitingTimer);\r\n this.waitingTimer = null;\r\n }\r\n\r\n if (this.recordingTimer) {\r\n clearInterval(this.recordingTimer);\r\n this.recordingTimer = null;\r\n }\r\n\r\n // 停止录制\r\n this.stopRecording();\r\n }\r\n\r\n // 修改手动播放音频的方法\r\n private handlePlayAudio = async () => {\r\n if (this.audioUrl) {\r\n await this.playAudio(this.audioUrl);\r\n // 手动播放完成后开始等待录制\r\n this.startWaitingToRecord();\r\n }\r\n };\r\n\r\n render() {\r\n if (!this.isOpen) return null;\r\n\r\n const modalStyle = {\r\n zIndex: String(this.zIndex)\r\n };\r\n\r\n const containerClass = {\r\n 'modal-container': true,\r\n 'fullscreen': this.fullscreen\r\n };\r\n\r\n const overlayClass = {\r\n 'modal-overlay': true,\r\n 'fullscreen-overlay': this.fullscreen\r\n };\r\n\r\n const renderVideoPreview = () => (\r\n <div class=\"video-preview\">\r\n <video\r\n autoPlay\r\n playsInline\r\n muted\r\n style={{ transform: 'scaleX(-1)' }}\r\n ref={(el) => {\r\n if (el && this.recordingStream && !this.videoRef) {\r\n this.videoRef = el;\r\n // 不在这里设置srcObject,而是使用setupVideoPreview方法\r\n }\r\n }}\r\n ></video>\r\n <div class={{\r\n 'recording-status': true,\r\n 'warning': this.showCountdownWarning\r\n }}>\r\n <span class=\"recording-dot\"></span>\r\n <span>\r\n 录制中 {Math.floor(this.recordingTimeLeft / 60)}:{(this.recordingTimeLeft % 60).toString().padStart(2, '0')}\r\n {this.showCountdownWarning && ` (即将自动完成)`}\r\n </span>\r\n </div>\r\n </div>\r\n );\r\n\r\n // 渲染占位符状态信息\r\n const renderPlaceholderStatus = () => {\r\n // 正在播放音频\r\n if (this.isPlayingAudio) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>正在播放问题,请听完后准备回答...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 正在上传视频\r\n if (this.isUploadingVideo) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>正在上传视频,请稍候...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 正在加载或等待AI回复\r\n if (this.isLoading || this.currentStreamingMessage) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>请等待题目...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 等待开始录制\r\n if (this.waitingToRecord) {\r\n return (\r\n <div class=\"placeholder-status\">\r\n <p>请准备好,{this.waitingTimeLeft}秒后将开始录制您的回答...</p>\r\n </div>\r\n );\r\n }\r\n\r\n // 添加默认状态\r\n return (\r\n <div class=\"placeholder-status default-status\">\r\n <p>准备中...</p>\r\n </div>\r\n );\r\n };\r\n\r\n return (\r\n <div class={overlayClass} style={modalStyle}>\r\n <div class={containerClass}>\r\n {this.isShowHeader && (\r\n <div class=\"modal-header\">\r\n <div class=\"header-left\">\r\n {this.icon && <img src={this.icon} class=\"header-icon\" alt=\"应用图标\" />}\r\n <div>{this.modalTitle}</div>\r\n </div>\r\n {this.isNeedClose && (\r\n <button class=\"close-button\" onClick={this.handleClose}>\r\n <span>×</span>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n\r\n <div style={{ height: '100%' }}>\r\n <div class=\"chat-history\" onScroll={this.handleScroll}>\r\n {this.isLoadingHistory ? (\r\n <div class=\"loading-container\">\r\n <div class=\"loading-spinner\"></div>\r\n <p>加载历史消息中...</p>\r\n </div>\r\n ) : (\r\n <div>\r\n {this.messages.map((message) => (\r\n <div id={`message_${message.id}`} key={message.id}>\r\n <pcm-chat-message\r\n message={message}\r\n onMessageChange={(event) => {\r\n const updatedMessages = this.messages.map(msg =>\r\n msg.id === message.id ? { ...msg, ...event.detail } : msg\r\n );\r\n this.messages = updatedMessages;\r\n }}\r\n ></pcm-chat-message>\r\n </div>\r\n ))}\r\n {this.currentStreamingMessage && (\r\n <div id={`message_${this.currentStreamingMessage.id}`}>\r\n <pcm-chat-message\r\n message={this.currentStreamingMessage}\r\n ></pcm-chat-message>\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n\r\n <div class=\"recording-section\">\r\n <div class=\"recording-container\">\r\n <div class=\"video-area\">\r\n {this.showRecordingUI ? (\r\n renderVideoPreview()\r\n ) : (\r\n <div class=\"video-preview placeholder\">\r\n {renderPlaceholderStatus()}\r\n </div>\r\n )}\r\n </div>\r\n {/* 添加进度条和数字进度 */}\r\n <div class=\"progress-container\">\r\n <div class=\"progress-bar-container\">\r\n <div\r\n class=\"progress-bar\"\r\n style={{\r\n width: `${Math.max(0, this.currentQuestionNumber - 1) / this.totalQuestions * 100}%`\r\n }}\r\n ></div>\r\n </div>\r\n <div class=\"progress-text\">\r\n 已完成{Math.max(0, this.currentQuestionNumber - 1)}/{this.totalQuestions}\r\n </div>\r\n </div>\r\n <div class=\"recording-controls\">\r\n {this.showRecordingUI ? (\r\n <button\r\n class=\"stop-recording-button\"\r\n onClick={() => this.stopRecording()}\r\n >\r\n 完成本题回答\r\n </button>\r\n ) : (\r\n <div class=\"waiting-message\">\r\n {(() => {\r\n // 显示播放按钮(当不自动播放且有音频URL时)\r\n if (!this.enableVoice && this.audioUrl && !this.isPlayingAudio) {\r\n return (\r\n <div class=\"play-audio-container\" onClick={this.handlePlayAudio}>\r\n <p>\r\n <svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"currentColor\" style={{ verticalAlign: 'middle', marginRight: '8px' }}>\r\n <path d=\"M8 5v14l11-7z\" />\r\n </svg>\r\n <span style={{ verticalAlign: 'middle' }}>播放题目</span>\r\n </p>\r\n </div>\r\n );\r\n }\r\n\r\n // 其他状态下显示禁用的\"完成回答\"按钮\r\n return (\r\n <button class=\"stop-recording-button disabled\" disabled>\r\n 完成回答\r\n </button>\r\n );\r\n })()}\r\n </div>\r\n )}\r\n </div>\r\n\r\n\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n }\r\n}"],"mappings":"oGAAA,MAAMA,EAAuB,2iR,MCShBC,EAAc,M,wQAIjBC,WAAqB,OAKGC,OAAiB,GAKxBC,OAAkB,MAKlCC,SAA0B,GAM1BC,YAKDC,KAKAC,OAAkB,IAKlBC,aAAwB,KAKxBC,YAAuB,KAMNC,eAKhBC,wBAAkC,GAKlCC,UAAqB,MAKrBC,wBAA8C,KAG9CC,iBAA4B,KAE5BC,iBAA4B,M,iCAM5BC,eAUDC,aAAuB,GAGtBC,kBAA6B,KAG7BC,YAAuB,MACvBC,gBAAsC,KACtCC,aAA4B,KAC5BC,cAAsC,KACtCC,kBAA4B,EAC5BC,gBAA2B,MAC3BC,eAAsB,KACtBC,mBAA6B,EAC7BC,iBAA2B,IAC3BC,gBAA2B,MAC3BC,aAAoB,KACpBC,gBAA0B,GAG3BC,SAAoC,KAKpCC,eAAyB,EAKxBC,sBAAgC,EAKhCC,oBAA+B,MAK/BC,kBAKQC,iBAAmB,GAK5BC,iBAA2B,IAM3BC,qBAA+B,GAE9BC,qBAAgC,MAMjCC,WAAsB,MAGrBC,iBAA4B,MAG5BC,eAA0B,MAC1BC,SAA0B,KAC3BC,aAAwC,KAKvCC,eASAC,sBAQDC,YAAuB,KAOvBC,qBAA+B,IAM/BC,SAEAC,YAAc,KACpBC,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I,WAAWnB,KAAKtC,wBAAwByD,MAC/CsK,EACE,oBAAArL,QAASJ,KAAKtC,6BAQ1B+N,EAAK,OAAAC,MAAM,qBACTD,EAAK,OAAAC,MAAM,uBACTD,EAAK,OAAAC,MAAM,cACR1L,KAAK3B,gBACJmN,IAEAC,EAAA,OAAKC,MAAM,6BACRS,MAKPV,EAAK,OAAAC,MAAM,sBACTD,EAAK,OAAAC,MAAM,0BACTD,EAAA,OACEC,MAAM,eACNI,MAAO,CACLvF,MAAO,GAAGuB,KAAKO,IAAI,EAAGrI,KAAKlB,sBAAwB,GAAKkB,KAAKnB,eAAiB,WAIpF4M,EAAK,OAAAC,MAAM,iBAAe,MACpB5D,KAAKO,IAAI,EAAGrI,KAAKlB,sBAAwB,GAAE,IAAGkB,KAAKnB,iBAG3D4M,EAAA,OAAKC,MAAM,sBACR1L,KAAK3B,gBACJoN,EACE,UAAAC,MAAM,wBACNW,QAAS,IAAMrM,KAAKC,iBAAe,UAKrCwL,EAAA,OAAKC,MAAM,mBACR,MAEC,IAAK1L,KAAKJ,aAAeI,KAAKR,WAAaQ,KAAKT,eAAgB,CAC9D,OACEkM,EAAK,OAAAC,MAAM,uBAAuBW,QAASrM,KAAKkL,iBAC9CO,EAAA,SACEA,EAAK,OAAAkB,QAAQ,YAAYpG,MAAM,KAAKE,OAAO,KAAKmG,KAAK,eAAed,MAAO,CAAEe,cAAe,SAAUC,YAAa,QACjHrB,EAAA,QAAMsB,EAAE,mBAEVtB,EAAM,QAAAK,MAAO,CAAEe,cAAe,WAAuB,S,CAO7D,OACEpB,EAAA,UAAQC,MAAM,iCAAiCsB,SAEtC,aAEZ,EArBA,S","ignoreList":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,g as s,h as i}from"./p-DaMwkrv5.js";import{s as n,a as o}from"./p-B2EtEi7v.js";const a=":host{display:block}.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;overflow-y:auto;padding:20px;z-index:1000}.fullscreen-overlay{padding:0}.modal-container{background:white;border-radius:8px;width:100%;max-width:800px;height:80vh;min-height:600px;display:flex;flex-direction:column;position:relative;margin:auto}.modal-container.fullscreen{width:100vw;max-width:none;height:100vh;min-height:100vh;border-radius:0;margin:0}@media screen and (max-width: 768px){.modal-overlay{padding:0}.modal-container{width:95%;height:70vh;min-height:400px}.chat-history{min-height:200px;max-height:50vh}.modal-container.fullscreen{height:-webkit-fill-available;max-height:-webkit-fill-available;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}.modal-container.fullscreen .chat-history{max-height:unset}.modal-container.fullscreen .modal-header{padding:0px 16px;padding-top:max(30px, env(safe-area-inset-top))}}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:4px 16px;height:50px;border-bottom:1px solid #e8e8e8}.header-left{display:flex;align-items:center;gap:8px}.header-icon{width:24px;height:24px}.close-button{background:transparent;border:none;cursor:pointer;padding:8px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:4px}.close-button:hover{background-color:rgba(0, 0, 0, 0.04)}.close-button span{font-size:24px;line-height:1;color:#999}.close-button:hover span{color:#666}.chat-history{position:relative;flex:1;overflow-y:auto;padding:16px;scroll-behavior:smooth;min-height:400px;}@media screen and (max-width: 480px){.chat-history{min-height:200px;max-height:50vh}}.message-input{padding:16px;border-top:1px solid #eee;display:flex;gap:8px;align-items:center}.message-input input{flex:1;padding:8px 12px;border:1px solid #ddd;border-radius:4px;outline:none;transition:border-color 0.2s ease}.message-input input:focus{border-color:#bbb}.message{margin-bottom:16px;opacity:1;transition:opacity 0.3s ease}.message-content{max-width:70%;padding:8px 12px;border-radius:8px;word-break:break-word}.message-content p{margin:0;word-break:break-word}.user-message{display:flex;justify-content:flex-end}.agent-message{display:flex;justify-content:flex-start}.user-message .message-content{background-color:#007bff;color:white}.agent-message .message-content{background-color:#f1f1f1}.message-time{font-size:12px;color:#999;margin-top:4px;display:block}.send-button{background-color:#1890ff;color:white;border:none;border-radius:4px;padding:8px 16px;cursor:pointer;font-weight:500}.send-button:disabled{background-color:#ccc;cursor:not-allowed}.empty-state{display:flex;justify-content:center;align-items:center;height:100%;color:#999;text-align:center}.loading-container{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:rgba(255, 255, 255, 0.98);z-index:1;opacity:1;transition:opacity 0.3s ease}.loading-container p{margin-top:16px;color:#666;font-size:14px}.loading-spinner{width:40px;height:40px;border:3px solid #f3f3f3;border-top:3px solid #1890ff;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.messages-wrapper{width:100%;min-height:100%;display:flex;flex-direction:column;justify-content:flex-end}.messages-wrapper.has-overflow{justify-content:flex-start}.suggested-questions{display:flex;flex-direction:column;gap:8px;padding:16px}.suggested-question{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background-color:#f3f4f6;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;transition:background-color 0.2s}.suggested-question:hover{background-color:#e5e7eb}.arrow-right{margin-left:8px}.loading-suggestions{display:flex;justify-content:center;padding:16px}.loading-spinner-small{width:20px;height:20px;border:2px solid #e5e7eb;border-top-color:#6b7280;border-radius:50%;animation:spin 1s linear infinite}.upload-button{background:transparent;border:none;cursor:pointer;padding:8px;display:flex;align-items:center;justify-content:center;color:#666;border-radius:4px;transition:background-color 0.2s}.upload-button:hover{background-color:rgba(0, 0, 0, 0.04)}.upload-button svg{width:20px;height:20px}.file-input{display:none}.selected-file{font-size:12px;color:#666;margin-left:8px;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.input-wrapper{flex:1;display:flex;align-items:center;border:1px solid #ddd;border-radius:4px;padding:0 4px;background:white}.input-wrapper input{border:none;flex:1;padding:8px;outline:none}.input-wrapper:focus-within{border-color:#bbb}.file-preview{padding:8px 16px;border-top:1px solid #eee;background-color:#f9f9f9}.file-info{display:flex;align-items:center;justify-content:space-between;padding:8px;background:white;border:1px solid #e8e8e8;border-radius:4px}.file-name{font-size:13px;color:#333;margin-right:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 30px)}.remove-file{background:transparent;border:none;color:#999;cursor:pointer;padding:4px 8px;font-size:16px;line-height:1;border-radius:4px;transition:all 0.2s}.remove-file:hover{background-color:#f0f0f0;color:#666}";const r=class{constructor(s){e(this,s);this.messageSent=t(this,"messageSent");this.modalClosed=t(this,"modalClosed");this.streamComplete=t(this,"streamComplete")}modalTitle="在线客服";isOpen=false;messages=[];currentMessage="";messageSent;modalClosed;icon;zIndex=1e3;isShowHeader=true;isNeedClose=true;botId;conversationId;currentAssistantMessage="";isLoading=false;currentStreamingMessage=null;shouldAutoScroll=true;SCROLL_THRESHOLD=30;isLoadingHistory=false;get hostElement(){return s(this)}streamComplete;suggestedQuestions=[];suggestedQuestionsLoading=false;stopSuggestedQuestionsRef={current:false};selectedFile=null;isUploading=false;uploadedFileInfo=[];defaultQuery="";fullscreen=false;handleClose=()=>{this.modalClosed.emit()};handleInputChange=e=>{const t=e.target;this.currentMessage=t.value};async getSuggestedQuestions(e){this.stopSuggestedQuestionsRef.current=false;this.suggestedQuestionsLoading=true;try{const t=await n({url:`https://pcm_api.ylzhaopin.com/share/messages/${e}/suggested`,params:{bot_id:this.botId}});if(this.stopSuggestedQuestionsRef.current)return;if(t.isOk&&t.data?.result==="success"){this.suggestedQuestions=t.data?.data||[]}}catch(e){console.error("获取问题建议失败:",e)}finally{this.suggestedQuestionsLoading=false}}handleStopSuggestedQuestions=()=>{this.suggestedQuestions=[];this.stopSuggestedQuestionsRef.current=true};handleFileChange=async e=>{const t=e.target;if(t.files&&t.files.length>0){this.selectedFile=t.files[0];await this.uploadFile()}};async uploadFile(){if(!this.selectedFile)return;this.isUploading=true;try{const e=new FormData;e.append("file",this.selectedFile);const t=await fetch("https://pcm_api.ylzhaopin.com/external/v1/files/upload",{method:"POST",body:e});const s=await t.json();console.log("result",s);if(s){this.uploadedFileInfo.push({cos_key:s.cos_key,filename:s.filename,ext:s.ext,presigned_url:s.presigned_url})}}catch(e){console.error("文件上传错误:",e);this.clearSelectedFile();alert("文件上传失败,请重试")}finally{this.isUploading=false}}handleUploadClick=()=>{const e=this.hostElement.shadowRoot?.querySelector(".file-input");e?.click()};clearSelectedFile=()=>{this.selectedFile=null;this.uploadedFileInfo=[];const e=this.hostElement.shadowRoot?.querySelector(".file-input");if(e){e.value=""}};async sendMessageToAPI(e){this.handleStopSuggestedQuestions();console.log("开始发送消息:",e);this.isLoading=true;let t="";const s=new Date;const i=`${s.getHours()}:${s.getMinutes().toString().padStart(2,"0")}`;const n=e.trim()||(this.uploadedFileInfo.length>0?"请分析这个文件":"");const a={id:`temp-${Date.now()}`,time:i,query:n,answer:"",bot_id:this.botId,isStreaming:true,conversation_id:this.conversationId,inputs:{},status:"normal",error:null};this.currentStreamingMessage=a;this.shouldAutoScroll=true;this.scrollToBottom();const r={bot_id:this.botId,response_mode:"streaming",conversation_id:this.conversationId,query:n,user:"1234567890"};if(this.uploadedFileInfo.length>0){const e=this.uploadedFileInfo.map((e=>e.cos_key)).join(",");r.inputs={...r.inputs,input:e}}await o({url:`https://pcm_api.ylzhaopin.com/share/chat-messages`,method:"POST",data:r,onMessage:e=>{console.log("收到Stream数据:",e);if(e.conversation_id&&!this.conversationId){this.conversationId=e.conversation_id;this.updateUrlWithConversationId(e.conversation_id)}if(e.event==="message"){if(e.event==="agent_message"||e.event==="message"){if(e.answer){t+=e.answer;const s={...this.currentStreamingMessage,answer:t,isStreaming:true};this.currentStreamingMessage=s;this.scrollToBottom()}}}if(e.event==="message_end"){this.streamComplete.emit({conversation_id:e.conversation_id||"",event:e.event,message_id:e.message_id,id:e.id})}},onError:e=>{console.error("发生错误:",e);this.messages=[...this.messages,{...a,answer:"抱歉,发生了错误,请稍后再试。",error:e,isStreaming:false}];this.currentStreamingMessage=null;this.isLoading=false},onComplete:()=>{console.log("请求完成");this.isLoading=false;this.messages=[...this.messages,this.currentStreamingMessage];if(this.currentStreamingMessage){this.getSuggestedQuestions(this.currentStreamingMessage.conversation_id)}this.currentStreamingMessage=null}})}handleScroll=()=>{const e=this.hostElement.shadowRoot?.querySelector(".chat-history");if(!e)return;const{scrollTop:t,scrollHeight:s,clientHeight:i}=e;const n=s-t-i;this.shouldAutoScroll=n<=this.SCROLL_THRESHOLD};scrollToBottom(){if(!this.shouldAutoScroll)return;const e=this.hostElement.shadowRoot?.querySelector(".chat-history");console.log("chatHistory",e);if(e&&this.isOpen){e.scrollTop=e.scrollHeight}}componentDidRender(){if(this.isLoadingHistory||this.shouldAutoScroll&&this.isOpen){const e=this.hostElement.shadowRoot?.querySelector(".chat-history");if(e){e.scrollTop=e.scrollHeight}}}updateUrlWithConversationId(e){const t=new URLSearchParams(window.location.search);if(!t.get("conversation_id")){const t=new URL(window.location.href);t.searchParams.set("conversation_id",e);window.history.replaceState({},"",t)}}handleSendMessage=()=>{if(!this.currentMessage.trim()&&this.uploadedFileInfo.length===0||this.isLoading)return;this.messageSent.emit(this.currentMessage);this.sendMessageToAPI(this.currentMessage);this.currentMessage="";this.clearSelectedFile();const e=this.hostElement.shadowRoot?.querySelector("input");e?.focus()};handleKeyDown=e=>{if(e.key==="Enter"&&!e.shiftKey){e.preventDefault();this.handleSendMessage()}};async loadHistoryMessages(){if(!this.conversationId)return;this.isLoadingHistory=true;try{const e=await n({url:`https://pcm_api.ylzhaopin.com/share/messages`,params:{conversation_id:this.conversationId,bot_id:this.botId,user:"1234567890",limit:20}});if(!e.isOk||!e.data){throw new Error("加载历史消息失败")}const t=e.data.data||[];this.currentStreamingMessage=null;this.messages=[];const s=t.map((e=>{const t=new Date(e.created_at*1e3);const s=`${t.getHours()}:${t.getMinutes().toString().padStart(2,"0")}`;return{...e,time:s,bot_id:this.botId,isStreaming:false,status:e.status==="error"?"error":"normal"}}));this.messages=s;requestAnimationFrame((()=>{this.shouldAutoScroll=true;this.scrollToBottom()}))}catch(e){console.error("加载历史消息失败:",e)}finally{this.isLoadingHistory=false}}async handleIsOpenChange(e){if(e&&this.conversationId){await this.loadHistoryMessages()}}handleDefaultQueryChange(e){if(e&&!this.currentMessage){this.currentMessage=e}}componentWillLoad(){if(this.defaultQuery){this.currentMessage=this.defaultQuery}}render(){if(!this.isOpen)return null;const e={zIndex:String(this.zIndex)};const t={"modal-container":true,fullscreen:this.fullscreen};const s={"modal-overlay":true,"fullscreen-overlay":this.fullscreen};return i("div",{class:s,style:e},i("div",{class:t},this.isShowHeader&&i("div",{class:"modal-header"},i("div",{class:"header-left"},this.icon&&i("img",{src:this.icon,class:"header-icon",alt:"应用图标"}),i("h3",null,this.modalTitle)),this.isNeedClose&&i("button",{class:"close-button",onClick:this.handleClose},i("span",null,"×"))),i("div",{class:"chat-history",onScroll:this.handleScroll},this.isLoadingHistory?i("div",{class:"loading-container"},i("div",{class:"loading-spinner"}),i("p",null,"加载历史消息中...")):i(i.Fragment,null,this.messages.map((e=>i("div",{id:`message_${e.id}`,key:e.id},i("pcm-chat-message",{message:e,onMessageChange:t=>{const s=this.messages.map((s=>s.id===e.id?{...s,...t.detail}:s));this.messages=s}})))),this.currentStreamingMessage&&i("div",{id:`message_${this.currentStreamingMessage.id}`},i("pcm-chat-message",{message:this.currentStreamingMessage})),this.messages.length===0&&!this.currentStreamingMessage&&i("div",{class:"empty-state"},i("p",null,"请输入消息"))),this.suggestedQuestionsLoading?i("div",{class:"loading-suggestions"},i("div",{class:"loading-spinner-small"})):this.suggestedQuestions.length>0&&i("div",{class:"suggested-questions"},this.suggestedQuestions.map(((e,t)=>i("div",{key:t,class:"suggested-question",onClick:()=>{this.currentMessage=e;this.handleSendMessage()}},e,i("span",{class:"arrow-right"},"→")))))),this.selectedFile&&i("div",{class:"file-preview"},i("div",{class:"file-info"},i("span",{class:"file-name",title:this.selectedFile.name},this.selectedFile.name,this.isUploading&&i("span",{class:"uploading-indicator"}," (上传中...)"),this.uploadedFileInfo.length>0&&i("span",{class:"upload-success"}," (已上传)")),i("button",{class:"remove-file",onClick:this.clearSelectedFile},"×"))),i("div",{class:"message-input"},i("input",{type:"file",class:"file-input",onChange:this.handleFileChange,accept:"image/*,.pdf,.doc,.docx,.txt"}),i("button",{class:"upload-button",onClick:this.handleUploadClick,title:"上传文件",disabled:this.isUploading},i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m0-16l-4 4m4-4l4 4"}))),i("div",{class:"input-wrapper"},i("input",{type:"text",placeholder:"请输入消息...",value:this.currentMessage,onInput:this.handleInputChange,onKeyDown:this.handleKeyDown,disabled:this.isLoading})),i("button",{class:"send-button",onClick:()=>this.handleSendMessage(),disabled:!this.currentMessage.trim()&&this.uploadedFileInfo.length===0||this.isLoading||this.isUploading},this.isLoading?"发送中...":"发送"))))}static get watchers(){return{isOpen:["handleIsOpenChange"],defaultQuery:["handleDefaultQueryChange"]}}};r.style=a;export{r as pcm_chat_modal};
|
|
2
|
-
//# sourceMappingURL=p-6c07f155.entry.js.map
|