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,6 +1,5 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h } from './
|
|
2
|
-
import {
|
|
3
|
-
import { d as defineCustomElement$2 } from './p-D0s1Q-3O.js';
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, u as uploadFileToBackend, s as sendSSERequest, a as sendHttpRequest, A as API_DOMAIN, h } from './index.js';
|
|
2
|
+
import { d as defineCustomElement$2 } from './p-LkDC0SN2.js';
|
|
4
3
|
|
|
5
4
|
const pcmHrChatModalCss = ":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}.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}.initial-upload{padding:1rem 1rem;display:flex;flex-direction:column;align-items:center;height:100%}.upload-section{max-width:600px;width:100%;text-align:center}.upload-area{border:2px dashed #ddd;border-radius:8px;padding:1rem;cursor:pointer;transition:all 0.3s ease}.upload-area:hover{border-color:#1890ff;background-color:rgba(24, 144, 255, 0.05)}.upload-placeholder{display:flex;flex-direction:column;align-items:center;color:#666}.upload-hint{font-size:0.8rem;color:#999;margin-top:0.5rem}.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}.submit-button{margin-top:1rem;padding:0.8rem 2rem;background:#1890ff;color:white;border:none;border-radius:4px;font-size:1rem;cursor:pointer;transition:all 0.3s ease;width:95%}.submit-button:disabled{background:#ccc;cursor:not-allowed}.submit-button:hover:not(:disabled){background:#40a9ff}.category-select,.dimension-select{margin:30px 0}.category-options,.dimension-options{display:flex;flex-wrap:wrap;gap:10px;margin-top:10px}.category-button,.dimension-button{padding:12px 16px;border:1px solid #E5E5E5;border-radius:6px;background:white;cursor:pointer;transition:all 0.3s}.category-button:hover,.dimension-button:hover{background:#f5f5f5}.category-button.selected{background-image:linear-gradient(111deg, #4A9FFF 0%, #1058FF 100%);color:white}.dimension-button.selected{background-image:linear-gradient(111deg, #4A9FFF 0%, #1058FF 100%);color:white}.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}";
|
|
6
5
|
|
|
@@ -22,7 +21,7 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
22
21
|
/**
|
|
23
22
|
* API鉴权密钥
|
|
24
23
|
*/
|
|
25
|
-
|
|
24
|
+
token = '';
|
|
26
25
|
/**
|
|
27
26
|
* 是否显示聊天模态框
|
|
28
27
|
*/
|
|
@@ -52,7 +51,7 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
52
51
|
*/
|
|
53
52
|
isNeedClose = true;
|
|
54
53
|
/**
|
|
55
|
-
* 会话ID
|
|
54
|
+
* 会话ID,传入继续对话,否则创建新会话
|
|
56
55
|
*/
|
|
57
56
|
conversationId;
|
|
58
57
|
/**
|
|
@@ -146,7 +145,7 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
146
145
|
*/
|
|
147
146
|
toEmail = '';
|
|
148
147
|
/**
|
|
149
|
-
*
|
|
148
|
+
* 是否以全屏模式打开,移动端建议设置为true
|
|
150
149
|
*/
|
|
151
150
|
fullscreen = false;
|
|
152
151
|
// 添加新的状态来跟踪视频上传
|
|
@@ -173,10 +172,8 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
173
172
|
enableVoice = true;
|
|
174
173
|
/**
|
|
175
174
|
* 是否显示题干内容
|
|
176
|
-
* 1: 显示题干内容
|
|
177
|
-
* 0: 不显示题干内容
|
|
178
175
|
*/
|
|
179
|
-
displayContentStatus =
|
|
176
|
+
displayContentStatus = true;
|
|
180
177
|
/**
|
|
181
178
|
* 用户ID
|
|
182
179
|
*/
|
|
@@ -196,25 +193,16 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
196
193
|
return;
|
|
197
194
|
this.isUploading = true;
|
|
198
195
|
try {
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
const response = await fetch('https://pcm_api.ylzhaopin.com/external/v1/files/upload', {
|
|
202
|
-
method: 'POST',
|
|
203
|
-
headers: {
|
|
204
|
-
'authorization': 'Bearer ' + this.apiKey
|
|
205
|
-
},
|
|
206
|
-
body: formData
|
|
196
|
+
const result = await uploadFileToBackend(this.selectedFile, {
|
|
197
|
+
'authorization': 'Bearer ' + this.token
|
|
207
198
|
});
|
|
208
|
-
const result = await response.json();
|
|
209
|
-
if (!response.ok) {
|
|
210
|
-
throw new Error(result.message || '文件上传失败');
|
|
211
|
-
}
|
|
212
199
|
if (result) {
|
|
213
200
|
this.uploadedFileInfo = [{
|
|
214
201
|
cos_key: result.cos_key,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
presigned_url: result.presigned_url
|
|
202
|
+
file_name: result.file_name,
|
|
203
|
+
file_size: result.file_size,
|
|
204
|
+
presigned_url: result.presigned_url,
|
|
205
|
+
ext: result.ext
|
|
218
206
|
}];
|
|
219
207
|
}
|
|
220
208
|
}
|
|
@@ -292,13 +280,14 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
292
280
|
response_mode: 'streaming',
|
|
293
281
|
conversation_id: this.conversationId,
|
|
294
282
|
query: queryText,
|
|
295
|
-
user: this.userId // 使用传入的 userId
|
|
283
|
+
user: this.userId, // 使用传入的 userId
|
|
284
|
+
bot_id: "3022316191018880"
|
|
296
285
|
};
|
|
297
286
|
requestData.inputs = {
|
|
298
287
|
job_info: this.selectedJobCategory,
|
|
299
288
|
dimensional_info: this.selectedDimensions.join(','),
|
|
300
289
|
email: this.toEmail,
|
|
301
|
-
display_content_status: this.displayContentStatus
|
|
290
|
+
display_content_status: this.displayContentStatus ? "1" : "0"
|
|
302
291
|
};
|
|
303
292
|
// 如果有上传的文件,添加到inputs参数
|
|
304
293
|
if (this.uploadedFileInfo.length > 0) {
|
|
@@ -306,10 +295,10 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
306
295
|
requestData.inputs.file_urls = fileUrls;
|
|
307
296
|
}
|
|
308
297
|
await sendSSERequest({
|
|
309
|
-
url:
|
|
298
|
+
url: '/sdk/v1/chat/chat-messages',
|
|
310
299
|
method: 'POST',
|
|
311
300
|
headers: {
|
|
312
|
-
'authorization': 'Bearer ' + this.
|
|
301
|
+
'authorization': 'Bearer ' + this.token
|
|
313
302
|
},
|
|
314
303
|
data: requestData,
|
|
315
304
|
onMessage: (data) => {
|
|
@@ -394,18 +383,18 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
394
383
|
}
|
|
395
384
|
});
|
|
396
385
|
}
|
|
397
|
-
//
|
|
386
|
+
// 修改保存答案的方法
|
|
398
387
|
async saveAnswer(conversationId, question, answer) {
|
|
399
388
|
try {
|
|
400
389
|
await sendHttpRequest({
|
|
401
|
-
url: '
|
|
390
|
+
url: '/sdk/v1/hr_competition/answer',
|
|
402
391
|
method: 'POST',
|
|
403
392
|
headers: {
|
|
404
|
-
'authorization': 'Bearer ' + this.
|
|
393
|
+
'authorization': 'Bearer ' + this.token
|
|
405
394
|
},
|
|
406
395
|
data: {
|
|
407
396
|
conversation_id: conversationId,
|
|
408
|
-
user: this.userId,
|
|
397
|
+
user: this.userId,
|
|
409
398
|
question: question,
|
|
410
399
|
answer: answer
|
|
411
400
|
},
|
|
@@ -451,65 +440,53 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
451
440
|
window.history.replaceState({}, '', newUrl);
|
|
452
441
|
}
|
|
453
442
|
}
|
|
454
|
-
//
|
|
443
|
+
// 修改加载历史消息的方法
|
|
455
444
|
async loadHistoryMessages() {
|
|
456
445
|
if (!this.conversationId)
|
|
457
446
|
return;
|
|
458
447
|
this.isLoadingHistory = true;
|
|
459
448
|
console.log('加载历史消息...');
|
|
460
449
|
try {
|
|
461
|
-
await sendHttpRequest({
|
|
462
|
-
url:
|
|
450
|
+
const response = await sendHttpRequest({
|
|
451
|
+
url: '/sdk/v1/chat/messages',
|
|
463
452
|
method: 'GET',
|
|
464
453
|
headers: {
|
|
465
|
-
'authorization': 'Bearer ' + this.
|
|
454
|
+
'authorization': 'Bearer ' + this.token
|
|
466
455
|
},
|
|
467
456
|
data: {
|
|
468
457
|
conversation_id: this.conversationId,
|
|
458
|
+
bot_id: "3022316191018880",
|
|
469
459
|
limit: 20
|
|
470
|
-
},
|
|
471
|
-
onMessage: (data) => {
|
|
472
|
-
if (data.data) {
|
|
473
|
-
const historyData = data.data || [];
|
|
474
|
-
const formattedMessages = historyData.map(msg => {
|
|
475
|
-
const time = new Date(msg.created_at * 1000);
|
|
476
|
-
const hours = time.getHours().toString().padStart(2, '0');
|
|
477
|
-
const minutes = time.getMinutes().toString().padStart(2, '0');
|
|
478
|
-
const timeStr = `${hours}:${minutes}`;
|
|
479
|
-
// 创建新的消息对象,不包含 inputs 字段
|
|
480
|
-
const { inputs, ...msgWithoutInputs } = msg;
|
|
481
|
-
return {
|
|
482
|
-
...msgWithoutInputs,
|
|
483
|
-
time: timeStr,
|
|
484
|
-
isStreaming: false,
|
|
485
|
-
status: msg.status === 'error' ? 'error' : 'normal'
|
|
486
|
-
};
|
|
487
|
-
});
|
|
488
|
-
this.messages = formattedMessages;
|
|
489
|
-
this.isLoadingHistory = false;
|
|
490
|
-
requestAnimationFrame(() => {
|
|
491
|
-
this.shouldAutoScroll = true;
|
|
492
|
-
this.scrollToBottom();
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
else {
|
|
496
|
-
this.isLoadingHistory = false;
|
|
497
|
-
}
|
|
498
|
-
},
|
|
499
|
-
onError: (error) => {
|
|
500
|
-
console.error('加载历史消息失败:', error);
|
|
501
|
-
alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');
|
|
502
|
-
this.isLoadingHistory = false;
|
|
503
|
-
},
|
|
504
|
-
onComplete: () => {
|
|
505
|
-
this.isLoadingHistory = false;
|
|
506
460
|
}
|
|
507
461
|
});
|
|
462
|
+
if (response.success && response.data) {
|
|
463
|
+
const historyData = response.data.data || [];
|
|
464
|
+
const formattedMessages = historyData.map(msg => {
|
|
465
|
+
const time = new Date(msg.created_at * 1000);
|
|
466
|
+
const hours = time.getHours().toString().padStart(2, '0');
|
|
467
|
+
const minutes = time.getMinutes().toString().padStart(2, '0');
|
|
468
|
+
const timeStr = `${hours}:${minutes}`;
|
|
469
|
+
const { inputs, ...msgWithoutInputs } = msg;
|
|
470
|
+
return {
|
|
471
|
+
...msgWithoutInputs,
|
|
472
|
+
time: timeStr,
|
|
473
|
+
isStreaming: false,
|
|
474
|
+
status: msg.status === 'error' ? 'error' : 'normal'
|
|
475
|
+
};
|
|
476
|
+
});
|
|
477
|
+
this.messages = formattedMessages;
|
|
478
|
+
}
|
|
508
479
|
}
|
|
509
480
|
catch (error) {
|
|
510
481
|
console.error('加载历史消息失败:', error);
|
|
511
482
|
alert(error instanceof Error ? error.message : '加载历史消息失败,请刷新重试');
|
|
483
|
+
}
|
|
484
|
+
finally {
|
|
512
485
|
this.isLoadingHistory = false;
|
|
486
|
+
requestAnimationFrame(() => {
|
|
487
|
+
this.shouldAutoScroll = true;
|
|
488
|
+
this.scrollToBottom();
|
|
489
|
+
});
|
|
513
490
|
}
|
|
514
491
|
}
|
|
515
492
|
// 修改 isOpen 的 watch 方法
|
|
@@ -817,31 +794,25 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
817
794
|
this.videoRef = null;
|
|
818
795
|
}
|
|
819
796
|
}
|
|
820
|
-
//
|
|
797
|
+
// 修改上传录制的视频的方法
|
|
821
798
|
async uploadRecordedVideo() {
|
|
822
799
|
if (!this.recordedBlob)
|
|
823
800
|
return;
|
|
824
801
|
try {
|
|
825
|
-
this.isUploadingVideo = true;
|
|
826
|
-
this.showRecordingUI = false;
|
|
802
|
+
this.isUploadingVideo = true;
|
|
803
|
+
this.showRecordingUI = false;
|
|
827
804
|
// 根据Blob类型确定文件扩展名
|
|
828
805
|
const fileExtension = this.recordedBlob.type.includes('webm') ? 'webm' : 'mp4';
|
|
829
806
|
const fileName = `answer.${fileExtension}`;
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
'authorization': 'Bearer ' + this.apiKey
|
|
836
|
-
},
|
|
837
|
-
body: formData
|
|
807
|
+
// 创建File对象
|
|
808
|
+
const videoFile = new File([this.recordedBlob], fileName, { type: this.recordedBlob.type });
|
|
809
|
+
// 使用uploadFileToBackend上传视频
|
|
810
|
+
const result = await uploadFileToBackend(videoFile, {
|
|
811
|
+
'authorization': 'Bearer ' + this.token
|
|
838
812
|
});
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
if (result && result.cos_key) {
|
|
842
|
-
// 保存视频答案
|
|
813
|
+
if (result) {
|
|
814
|
+
// 使用 FileUploadResponse 类型的字段
|
|
843
815
|
await this.saveVideoAnswer(result.cos_key);
|
|
844
|
-
// 发送"下一题"请求
|
|
845
816
|
this.sendNextQuestion();
|
|
846
817
|
}
|
|
847
818
|
else {
|
|
@@ -850,7 +821,6 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
850
821
|
}
|
|
851
822
|
catch (error) {
|
|
852
823
|
console.error('视频上传错误:', error);
|
|
853
|
-
// 通知父组件视频上传失败
|
|
854
824
|
this.recordingError.emit({
|
|
855
825
|
type: 'upload_failed',
|
|
856
826
|
message: '视频上传失败',
|
|
@@ -858,12 +828,12 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
858
828
|
});
|
|
859
829
|
}
|
|
860
830
|
finally {
|
|
861
|
-
this.isUploadingVideo = false;
|
|
831
|
+
this.isUploadingVideo = false;
|
|
862
832
|
this.showRecordingUI = false;
|
|
863
833
|
this.recordedBlob = null;
|
|
864
834
|
}
|
|
865
835
|
}
|
|
866
|
-
//
|
|
836
|
+
// 修改保存视频答案的方法
|
|
867
837
|
async saveVideoAnswer(cosKey) {
|
|
868
838
|
if (!this.conversationId)
|
|
869
839
|
return;
|
|
@@ -872,14 +842,14 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
872
842
|
if (!lastAIMessage)
|
|
873
843
|
return;
|
|
874
844
|
await sendHttpRequest({
|
|
875
|
-
url: '
|
|
845
|
+
url: '/sdk/v1/hr_competition/answer',
|
|
876
846
|
method: 'POST',
|
|
877
847
|
headers: {
|
|
878
|
-
'authorization': 'Bearer ' + this.
|
|
848
|
+
'authorization': 'Bearer ' + this.token
|
|
879
849
|
},
|
|
880
850
|
data: {
|
|
881
851
|
conversation_id: this.conversationId,
|
|
882
|
-
user: this.userId,
|
|
852
|
+
user: this.userId,
|
|
883
853
|
question: lastAIMessage.answer,
|
|
884
854
|
file_url: cosKey
|
|
885
855
|
},
|
|
@@ -901,10 +871,10 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
901
871
|
return;
|
|
902
872
|
try {
|
|
903
873
|
await sendHttpRequest({
|
|
904
|
-
url:
|
|
874
|
+
url: `/sdk/v1/hr_competition/${this.conversationId}/end`,
|
|
905
875
|
method: 'POST',
|
|
906
876
|
headers: {
|
|
907
|
-
'authorization': 'Bearer ' + this.
|
|
877
|
+
'authorization': 'Bearer ' + this.token
|
|
908
878
|
},
|
|
909
879
|
});
|
|
910
880
|
}
|
|
@@ -915,11 +885,11 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
915
885
|
// 添加TTS合成音频的方法
|
|
916
886
|
async synthesizeAudio(text) {
|
|
917
887
|
try {
|
|
918
|
-
const response = await fetch(
|
|
888
|
+
const response = await fetch(`${API_DOMAIN}/sdk/v1/tts/synthesize_audio`, {
|
|
919
889
|
method: 'POST',
|
|
920
890
|
headers: {
|
|
921
891
|
'Content-Type': 'application/json',
|
|
922
|
-
'authorization': 'Bearer ' + this.
|
|
892
|
+
'authorization': 'Bearer ' + this.token
|
|
923
893
|
},
|
|
924
894
|
body: JSON.stringify({ text })
|
|
925
895
|
});
|
|
@@ -1073,7 +1043,7 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
1073
1043
|
static get style() { return pcmHrChatModalCss; }
|
|
1074
1044
|
}, [1, "pcm-hr-chat-modal", {
|
|
1075
1045
|
"modalTitle": [1, "modal-title"],
|
|
1076
|
-
"
|
|
1046
|
+
"token": [1],
|
|
1077
1047
|
"isOpen": [1028, "is-open"],
|
|
1078
1048
|
"icon": [1],
|
|
1079
1049
|
"zIndex": [2, "z-index"],
|
|
@@ -1088,7 +1058,7 @@ const ChatHRModal = /*@__PURE__*/ proxyCustomElement(class ChatHRModal extends H
|
|
|
1088
1058
|
"fullscreen": [4],
|
|
1089
1059
|
"requireResume": [4, "require-resume"],
|
|
1090
1060
|
"enableVoice": [4, "enable-voice"],
|
|
1091
|
-
"displayContentStatus": [
|
|
1061
|
+
"displayContentStatus": [4, "display-content-status"],
|
|
1092
1062
|
"userId": [1, "user-id"],
|
|
1093
1063
|
"messages": [32],
|
|
1094
1064
|
"currentAssistantMessage": [32],
|