pcm-agents 1.0.7 → 1.0.8

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.
Files changed (170) hide show
  1. package/dist/cjs/components-chat-message_33.cjs.entry.js +7 -3
  2. package/dist/cjs/components-chat-message_33.cjs.entry.js.map +1 -1
  3. package/dist/cjs/components-oem-virtual-chat-modal.cjs.entry.js +1 -1
  4. package/dist/cjs/{conversation-utils-srlCwYy5.js → conversation-utils-Ut-DjZGS.js} +3 -3
  5. package/dist/cjs/{conversation-utils-srlCwYy5.js.map → conversation-utils-Ut-DjZGS.js.map} +1 -1
  6. package/dist/cjs/{index-CJQRBB6e.js → index-BJXw-mBt.js} +7 -4
  7. package/dist/cjs/{index-CJQRBB6e.js.map → index-BJXw-mBt.js.map} +1 -1
  8. package/dist/cjs/index.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/oem-htws-modal.cjs.entry.js +6 -2
  11. package/dist/cjs/oem-htws-modal.cjs.entry.js.map +1 -1
  12. package/dist/cjs/oem-htws-modal.entry.cjs.js.map +1 -1
  13. package/dist/cjs/oem-jd-modal.cjs.entry.js +1 -1
  14. package/dist/cjs/oem-jlpp-modal.cjs.entry.js +2 -2
  15. package/dist/cjs/oem-jlpp-modal.cjs.entry.js.map +1 -1
  16. package/dist/cjs/oem-jlpp-modal.entry.cjs.js.map +1 -1
  17. package/dist/cjs/oem-jlzz-modal.cjs.entry.js +1 -1
  18. package/dist/cjs/oem-mnct-modal.cjs.entry.js +1 -1
  19. package/dist/cjs/oem-mnms-modal.cjs.entry.js +2 -2
  20. package/dist/cjs/oem-mnms-modal.cjs.entry.js.map +1 -1
  21. package/dist/cjs/oem-mnms-modal.entry.cjs.js.map +1 -1
  22. package/dist/cjs/oem-qgqjl-modal.cjs.entry.js +2 -2
  23. package/dist/cjs/pcm-agents.cjs.js +1 -1
  24. package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js +1 -1
  25. package/dist/cjs/pcm-jlsx-modal.cjs.entry.js +1 -1
  26. package/dist/collection/components/oem-htws-modal/oem-htws-modal.js +24 -1
  27. package/dist/collection/components/oem-htws-modal/oem-htws-modal.js.map +1 -1
  28. package/dist/collection/components/oem-jlpp-modal/oem-jlpp-modal.js +1 -1
  29. package/dist/collection/components/oem-jlpp-modal/oem-jlpp-modal.js.map +1 -1
  30. package/dist/collection/components/oem-mnms-modal/oem-mnms-modal.js +1 -1
  31. package/dist/collection/components/oem-mnms-modal/oem-mnms-modal.js.map +1 -1
  32. package/dist/collection/components/oem-zygh-modal/oem-zygh-modal.js +24 -1
  33. package/dist/collection/components/oem-zygh-modal/oem-zygh-modal.js.map +1 -1
  34. package/dist/collection/utils/utils.js +4 -1
  35. package/dist/collection/utils/utils.js.map +1 -1
  36. package/dist/components/components-chat-message.js +1 -1
  37. package/dist/components/components-digital-human.js +1 -1
  38. package/dist/components/components-export-records-modal.js +1 -1
  39. package/dist/components/components-mobile-input-btn.js +1 -1
  40. package/dist/components/components-mobile-upload-btn.js +1 -1
  41. package/dist/components/components-oem-virtual-chat-modal.js +1 -1
  42. package/dist/components/components-position-selector.js +1 -1
  43. package/dist/components/components-thousand-resume-wrapper.js +1 -1
  44. package/dist/components/components-upload.js +1 -1
  45. package/dist/components/components-voice-input-btn.js +1 -1
  46. package/dist/components/index.js +1 -1
  47. package/dist/components/oem-htws-modal.js +11 -6
  48. package/dist/components/oem-htws-modal.js.map +1 -1
  49. package/dist/components/oem-jd-modal.js +5 -5
  50. package/dist/components/oem-jlpp-modal.js +8 -8
  51. package/dist/components/oem-jlpp-modal.js.map +1 -1
  52. package/dist/components/oem-jlsx-modal.js +5 -5
  53. package/dist/components/oem-jlzz-modal.js +5 -5
  54. package/dist/components/oem-mnct-modal.js +7 -7
  55. package/dist/components/oem-mnms-modal.js +9 -9
  56. package/dist/components/oem-mnms-modal.js.map +1 -1
  57. package/dist/components/oem-qgqjl-modal.js +9 -9
  58. package/dist/components/oem-zygh-modal.js +11 -6
  59. package/dist/components/oem-zygh-modal.js.map +1 -1
  60. package/dist/components/{p-BdzFXB1t.js → p-5bswLwh6.js} +3 -3
  61. package/dist/components/{p-BdzFXB1t.js.map → p-5bswLwh6.js.map} +1 -1
  62. package/dist/components/{p-14CtQGo8.js → p-A7OBthUL.js} +4 -4
  63. package/dist/components/{p-14CtQGo8.js.map → p-A7OBthUL.js.map} +1 -1
  64. package/dist/components/{p-BdgdgjaW.js → p-BV5z8A4a.js} +3 -3
  65. package/dist/components/{p-BdgdgjaW.js.map → p-BV5z8A4a.js.map} +1 -1
  66. package/dist/components/{p-BWdXlms4.js → p-Co9TJcgO.js} +3 -3
  67. package/dist/components/{p-BWdXlms4.js.map → p-Co9TJcgO.js.map} +1 -1
  68. package/dist/components/{p--IeRQcxT.js → p-CzFTb8J3.js} +3 -3
  69. package/dist/components/{p--IeRQcxT.js.map → p-CzFTb8J3.js.map} +1 -1
  70. package/dist/components/{p-BJKIlCmI.js → p-D1MNPWYG.js} +3 -3
  71. package/dist/components/{p-BJKIlCmI.js.map → p-D1MNPWYG.js.map} +1 -1
  72. package/dist/components/{p-c8fMPeu_.js → p-D1Zbs1E9.js} +3 -3
  73. package/dist/components/{p-c8fMPeu_.js.map → p-D1Zbs1E9.js.map} +1 -1
  74. package/dist/components/{p-5TyoLbXy.js → p-DMcvouAq.js} +5 -5
  75. package/dist/components/{p-5TyoLbXy.js.map → p-DMcvouAq.js.map} +1 -1
  76. package/dist/components/{p-BUVNyxhI.js → p-DUzMuUXg.js} +7 -4
  77. package/dist/components/p-DUzMuUXg.js.map +1 -0
  78. package/dist/components/{p-wTdMzyVB.js → p-DjY3Uc0V.js} +3 -3
  79. package/dist/components/{p-wTdMzyVB.js.map → p-DjY3Uc0V.js.map} +1 -1
  80. package/dist/components/{p-Bxg4nW6-.js → p-DoiGRCSv.js} +3 -3
  81. package/dist/components/{p-Bxg4nW6-.js.map → p-DoiGRCSv.js.map} +1 -1
  82. package/dist/components/{p-wAqiaji9.js → p-JbxUsVe3.js} +3 -3
  83. package/dist/components/{p-wAqiaji9.js.map → p-JbxUsVe3.js.map} +1 -1
  84. package/dist/components/{p-2BiWHTOV.js → p-PVcS8Z81.js} +3 -3
  85. package/dist/components/{p-2BiWHTOV.js.map → p-PVcS8Z81.js.map} +1 -1
  86. package/dist/components/{p-BUA1GYVe.js → p-cML-tdcc.js} +3 -3
  87. package/dist/components/{p-BUA1GYVe.js.map → p-cML-tdcc.js.map} +1 -1
  88. package/dist/components/pcm-1zhanshi-mnms-modal.js +5 -5
  89. package/dist/components/pcm-app-chat-modal.js +1 -1
  90. package/dist/components/pcm-ats-mnms-modal.js +5 -5
  91. package/dist/components/pcm-card.js +1 -1
  92. package/dist/components/pcm-hr-chat-modal.js +2 -2
  93. package/dist/components/pcm-htws-modal.js +8 -8
  94. package/dist/components/pcm-hyzj-modal.js +5 -5
  95. package/dist/components/pcm-jd-modal.js +6 -6
  96. package/dist/components/pcm-jlpp-modal.js +8 -8
  97. package/dist/components/pcm-jlsx-modal.js +5 -5
  98. package/dist/components/pcm-jlzz-modal.js +6 -6
  99. package/dist/components/pcm-mnct-modal.js +7 -7
  100. package/dist/components/pcm-mnms-modal.js +8 -8
  101. package/dist/components/pcm-mnms-zp-modal.js +8 -8
  102. package/dist/components/pcm-msbg-modal.js +5 -5
  103. package/dist/components/pcm-qgqjl-modal.js +9 -9
  104. package/dist/components/pcm-virtual-chat-modal.js +1 -1
  105. package/dist/components/pcm-zsk-chat-modal.js +2 -2
  106. package/dist/components/pcm-zygh-modal.js +7 -7
  107. package/dist/components/pcm-zygh-v2-modal.js +7 -7
  108. package/dist/esm/components-chat-message_33.entry.js +7 -3
  109. package/dist/esm/components-chat-message_33.entry.js.map +1 -1
  110. package/dist/esm/components-oem-virtual-chat-modal.entry.js +1 -1
  111. package/dist/esm/{conversation-utils-B8KFe8e5.js → conversation-utils-DhbVyrpx.js} +3 -3
  112. package/dist/esm/{conversation-utils-B8KFe8e5.js.map → conversation-utils-DhbVyrpx.js.map} +1 -1
  113. package/dist/esm/{index-mY4LYmpx.js → index-D8Ey1n8b.js} +7 -4
  114. package/dist/esm/{index-mY4LYmpx.js.map → index-D8Ey1n8b.js.map} +1 -1
  115. package/dist/esm/index.js +1 -1
  116. package/dist/esm/loader.js +1 -1
  117. package/dist/esm/oem-htws-modal.entry.js +6 -2
  118. package/dist/esm/oem-htws-modal.entry.js.map +1 -1
  119. package/dist/esm/oem-jd-modal.entry.js +1 -1
  120. package/dist/esm/oem-jlpp-modal.entry.js +2 -2
  121. package/dist/esm/oem-jlpp-modal.entry.js.map +1 -1
  122. package/dist/esm/oem-jlzz-modal.entry.js +1 -1
  123. package/dist/esm/oem-mnct-modal.entry.js +1 -1
  124. package/dist/esm/oem-mnms-modal.entry.js +2 -2
  125. package/dist/esm/oem-mnms-modal.entry.js.map +1 -1
  126. package/dist/esm/oem-qgqjl-modal.entry.js +2 -2
  127. package/dist/esm/pcm-agents.js +1 -1
  128. package/dist/esm/pcm-hr-chat-modal.entry.js +1 -1
  129. package/dist/esm/pcm-jlsx-modal.entry.js +1 -1
  130. package/dist/pcm-agents/index.esm.js +1 -1
  131. package/dist/pcm-agents/oem-htws-modal.entry.esm.js.map +1 -1
  132. package/dist/pcm-agents/oem-jlpp-modal.entry.esm.js.map +1 -1
  133. package/dist/pcm-agents/oem-mnms-modal.entry.esm.js.map +1 -1
  134. package/dist/pcm-agents/{p-724d9471.entry.js → p-030c829e.entry.js} +2 -2
  135. package/dist/pcm-agents/p-11426012.entry.js +8 -0
  136. package/dist/pcm-agents/p-11426012.entry.js.map +1 -0
  137. package/dist/pcm-agents/{p-24ce19fc.entry.js → p-1fdb05d7.entry.js} +2 -2
  138. package/dist/pcm-agents/p-1fdb05d7.entry.js.map +1 -0
  139. package/dist/pcm-agents/{p-557664fc.entry.js → p-4732c615.entry.js} +2 -2
  140. package/dist/pcm-agents/{p-0cedc9bf.entry.js → p-646b6128.entry.js} +2 -2
  141. package/dist/pcm-agents/{p-58493403.entry.js → p-66cb43c9.entry.js} +2 -2
  142. package/dist/pcm-agents/{p-5ca45877.entry.js → p-75efc351.entry.js} +2 -2
  143. package/dist/pcm-agents/{p-CcIrA6cr.js → p-B3osOuvR.js} +2 -2
  144. package/dist/pcm-agents/{p-CcIrA6cr.js.map → p-B3osOuvR.js.map} +1 -1
  145. package/dist/pcm-agents/p-CXe7oxeN.js +2 -0
  146. package/dist/pcm-agents/{p-rR0ghCa0.js.map → p-CXe7oxeN.js.map} +1 -1
  147. package/dist/pcm-agents/{p-81d12737.entry.js → p-b071ed75.entry.js} +2 -2
  148. package/dist/pcm-agents/{p-81d12737.entry.js.map → p-b071ed75.entry.js.map} +1 -1
  149. package/dist/pcm-agents/{p-d0a7e02b.entry.js → p-b3ff7816.entry.js} +2 -2
  150. package/dist/pcm-agents/{p-f4d5841a.entry.js → p-c2c3e968.entry.js} +2 -2
  151. package/dist/pcm-agents/{p-f4d5841a.entry.js.map → p-c2c3e968.entry.js.map} +1 -1
  152. package/dist/pcm-agents/{p-783b46c0.entry.js → p-f92d70a8.entry.js} +2 -2
  153. package/dist/pcm-agents/pcm-agents.esm.js +1 -1
  154. package/dist/types/components/oem-htws-modal/oem-htws-modal.d.ts +4 -0
  155. package/dist/types/components/oem-zygh-modal/oem-zygh-modal.d.ts +4 -0
  156. package/dist/types/components.d.ts +16 -0
  157. package/dist/types/utils/utils.d.ts +2 -1
  158. package/package.json +1 -1
  159. package/dist/components/p-BUVNyxhI.js.map +0 -1
  160. package/dist/pcm-agents/p-24ce19fc.entry.js.map +0 -1
  161. package/dist/pcm-agents/p-b9368b8e.entry.js +0 -8
  162. package/dist/pcm-agents/p-b9368b8e.entry.js.map +0 -1
  163. package/dist/pcm-agents/p-rR0ghCa0.js +0 -2
  164. /package/dist/pcm-agents/{p-724d9471.entry.js.map → p-030c829e.entry.js.map} +0 -0
  165. /package/dist/pcm-agents/{p-557664fc.entry.js.map → p-4732c615.entry.js.map} +0 -0
  166. /package/dist/pcm-agents/{p-0cedc9bf.entry.js.map → p-646b6128.entry.js.map} +0 -0
  167. /package/dist/pcm-agents/{p-58493403.entry.js.map → p-66cb43c9.entry.js.map} +0 -0
  168. /package/dist/pcm-agents/{p-5ca45877.entry.js.map → p-75efc351.entry.js.map} +0 -0
  169. /package/dist/pcm-agents/{p-d0a7e02b.entry.js.map → p-b3ff7816.entry.js.map} +0 -0
  170. /package/dist/pcm-agents/{p-783b46c0.entry.js.map → p-f92d70a8.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{r as e,c as t,a as o,h as i}from"./p-DA8Myhft.js";import{a as n,v as s}from"./p-CcIrA6cr.js";import{E as r}from"./p-C0FYX2-Z.js";import{c as a}from"./p-C7m_4Gmk.js";import{M as l}from"./p-D39f_W8k.js";const d=".label-with-button{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.button-group{display:flex;gap:8px;align-items:center}.position-selector-button{padding:4px 12px;background:#1890ff;color:white;border:none;border-radius:4px;font-size:13px;cursor:pointer;transition:all 0.3s ease;white-space:nowrap;height:28px;line-height:20px}.position-selector-button:hover{background:#40a9ff}.position-selector-button:active{background:#096dd9}.position-selector-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.5);display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.position-selector-modal{background:white;border-radius:8px;width:90%;max-width:900px;height:80vh;max-height:600px;display:flex;flex-direction:column;box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);animation:modalFadeIn 0.3s ease}@keyframes modalFadeIn{from{opacity:0;transform:scale(0.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}.position-selector-modal-header{display:flex;justify-content:space-between;align-items:center;padding:16px 24px;border-bottom:1px solid #f0f0f0;flex-shrink:0}.position-selector-modal-header h3{margin:0;font-size:16px;font-weight:500;color:rgba(0, 0, 0, 0.85)}.position-selector-close-btn{background:none;border:none;font-size:24px;line-height:1;cursor:pointer;color:rgba(0, 0, 0, 0.45);padding:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:all 0.3s}.position-selector-close-btn:hover{background-color:rgba(0, 0, 0, 0.06);color:rgba(0, 0, 0, 0.85)}.position-selector-modal-body{flex:1;overflow:hidden;display:flex;flex-direction:column}@media screen and (max-width: 768px){.position-selector-modal{width:100%;height:90vh;max-height:none;border-radius:8px 8px 0 0;margin-top:auto}.position-selector-modal-overlay{padding:0;align-items:flex-end}}";const p='.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.5);display:flex;z-index:1000;overflow-y:auto}.fullscreen-overlay{padding:0;background-color:rgba(0, 0, 0, 0.7);position:absolute;width:100%;height:auto}.modal-container{background-color:#fff;border-radius:8px;width:100%;display:flex;flex-direction:column;position:relative;margin:5vh auto auto auto;transition:all 0.3s ease-out;overflow:hidden}.modal-container.fullscreen{width:100%;max-width:none;height:100%;border-radius:0;margin:0;display:flex;flex-direction:column;max-height:100%}.pc-layout{width:80%;max-width:600px;min-width:320px}@media screen and (max-width: 768px){.pc-layout{width:95%}.modal-overlay{padding:10px 0px 0px 0px}.modal-container.fullscreen{width:100%;height:100%;max-height:100%;border-radius:16px 16px 0 0;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}}.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;font-size:16px;font-weight:600;color:#333}.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}.upload-area{cursor:pointer;width:100%}.upload-placeholder{transition:all 0.3s ease;display:flex;flex-direction:column;align-items:center;background:rgba(0, 0, 0, 0.02);border:1px dashed #d9d9d9;border-radius:8px;cursor:pointer}.upload-placeholder:hover{border:1px dashed #1890ff}.upload-placeholder img{margin-top:8px;width:50px;height:50px}.upload-placeholder .upload-text{margin:4px 0;color:#332F39;font-size:14px}.upload-placeholder .upload-hint{font-size:14px;color:#949AA5;margin-top:8px;padding:0px 10px;text-align:center;white-space:normal;word-wrap:break-word;word-break:break-all;line-height:1.4}.file-item{position:relative;padding:16px;border:1px solid #e2e8f0;border-radius:8px;transition:border-color 0.3s;cursor:pointer;margin-bottom:16px;display:flex;justify-content:space-between;align-items:center}.file-item:hover{border-color:#0D75FB}.file-item-content{display:flex;align-items:center;gap:8px;flex:1;min-width:0;overflow:hidden}.file-icon{color:#0D75FB;flex-shrink:0}.file-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 50px)}.remove-file{background:transparent;border:none;color:#94a3b8;cursor:pointer;font-size:18px;display:flex;align-items:center;justify-content:center;padding:4px;margin-left:8px;border-radius:4px;transition:all 0.2s;min-width:30px;min-height:30px}.remove-file:hover{background-color:#f1f5f9;color:#475569}.file-input{display:none}.input-container{padding:20px;display:flex;flex-direction:column;height:calc(100% - 50px);background:linear-gradient(150deg, #2a6ee933, #0000 50%) 0 0 / 400px 200px no-repeat, #fff;overflow-y:auto}.input-container h3{margin-top:0;margin-bottom:20px;font-size:18px;color:#333;text-align:center}.jd-input-section{margin-bottom:20px}.jd-input-section label{display:block;margin-bottom:8px;font-weight:500;color:#333}.job-description-textarea{width:calc(100% - 16px);border:1px solid #ddd;border-radius:4px;resize:vertical;font-family:inherit;font-size:14px;line-height:1.5;transition:border-color 0.3s;padding:8px}.job-description-textarea:focus{outline:none;border-color:#1890ff;box-shadow:0 0 0 2px rgba(24, 144, 255, 0.2)}.resume-upload-section{margin-bottom:20px;width:100%;display:flex;flex-direction:column}.resume-upload-section label{display:block;margin-bottom:8px;font-weight:500;color:#333}.interview-settings-section{margin-bottom:24px;padding:20px;background-color:#f8f9fa;border-radius:8px;border:1px solid #e9ecef}.settings-row{margin-bottom:20px}.settings-row:last-child{margin-bottom:0}.settings-label{display:block;font-weight:500;color:#333;margin-bottom:12px;font-size:14px}.question-number-section{width:100%}.slider-container{display:flex;align-items:center;gap:12px}.question-slider{flex:1;height:6px;background:#ddd;outline:none;border-radius:3px;-webkit-appearance:none;appearance:none}.question-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;background:#0D75FB;cursor:pointer;border-radius:50%;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2)}.question-slider::-moz-range-thumb{width:20px;height:20px;background:#0D75FB;cursor:pointer;border-radius:50%;border:none;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2)}.slider-value{font-weight:600;color:#0D75FB;font-size:14px;min-width:30px;text-align:center}.analysis-toggle-section{width:100%}.toggle-container{display:flex;align-items:center;gap:12px}.toggle-switch{position:relative;display:inline-block;width:44px;height:24px}.toggle-switch input{opacity:0;width:0;height:0}.toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;transition:0.3s;border-radius:24px}.toggle-slider:before{position:absolute;content:"";height:18px;width:18px;left:3px;bottom:3px;background-color:white;transition:0.3s;border-radius:50%;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2)}input:checked+.toggle-slider{background-color:#0D75FB}input:checked+.toggle-slider:before{transform:translateX(20px)}.toggle-text{font-size:14px;color:#666;font-weight:500}.submit-button{margin-top:10px;padding:10px 30px;background:#0D75FB;color:white;border:none;border-radius:4px;font-size:16px;cursor:pointer;transition:all 0.3s ease;width:100%;max-width:400px;align-self:center}.submit-button:hover{background-color:#40a9ff}.submit-button:disabled{background-color:rgba(0,0,0,0.04);color:rgba(0,0,0,0.25);cursor:not-allowed}.ai-disclaimer{margin-top:16px;text-align:center;font-size:12px;color:#999;line-height:1.5}.ai-disclaimer p{margin:4px 0}.beian-info{display:flex;justify-content:center;flex-wrap:wrap;gap:4px}.ai-disclaimer a{color:#666;text-decoration:none;transition:color 0.2s ease}.ai-disclaimer a:hover{color:#1890ff;text-decoration:underline}.loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:24px}.loading-spinner{width:40px;height:40px;border:4px solid rgba(0, 0, 0, 0.1);border-radius:50%;border-top-color:var(--pcm-primary-color, #1890ff);animation:spin 1s linear infinite;margin-bottom:16px}.loading-text{font-size:16px;color:var(--pcm-text-color, #333)}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.header-history-button{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:4px 8px;border:none;border-radius:4px;background:transparent;color:#bbb;cursor:pointer;font-size:13px;font-family:inherit;line-height:1;transition:all 0.2s ease;flex-shrink:0;white-space:nowrap}.header-history-button svg{width:16px;height:16px;display:block;flex-shrink:0}.header-history-button:hover{background-color:rgba(0, 0, 0, 0.04);color:#666}.header-history-button:focus-visible{outline:2px solid rgba(13, 117, 251, 0.35);outline-offset:2px}.history-drawer-content{height:100%;display:flex;flex-direction:column}.conversation-list{flex:1;overflow-y:auto;padding:8px 0}.loading-conversations,.empty-conversations{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 20px;color:#999}.loading-conversations .loading-spinner-small{margin-bottom:12px}.conversation-item{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;margin:0 8px 4px 8px;border-radius:8px;cursor:pointer;transition:all 0.2s ease;border:1px solid transparent}.conversation-item:hover{background:#f5f5f5}.conversation-info{flex:1;min-width:0}.conversation-title{font-size:14px;font-weight:500;color:#262626;margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.conversation-meta{display:flex;align-items:center;gap:8px;font-size:12px;color:#8c8c8c}.conversation-time{flex-shrink:0}.message-count{flex-shrink:0}.conversation-status{padding:2px 6px;border-radius:4px;font-size:11px;font-weight:500}.conversation-status.completed{background:#f6ffed;color:#52c41a}.conversation-status.running{background:#fff7e6;color:#fa8c16}.header-history-entry{display:inline-flex;align-items:center;justify-content:center;margin-left:8px;padding:4px 8px;border:none;border-radius:4px;background:#e6f7ff;color:#1890ff;cursor:pointer;font-size:12px;font-family:inherit;line-height:1;white-space:nowrap;transition:all 0.2s ease}.header-history-entry:hover{background:#bae7ff;color:#0958d9;transform:translateY(-1px)}.header-history-entry:focus-visible{outline:2px solid rgba(13, 117, 251, 0.35);outline-offset:2px}.history-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px 16px;border-top:1px solid #f0f0f0}.history-pagination-button{min-width:72px;padding:6px 12px;border:1px solid #d9d9d9;border-radius:6px;background:#fff;color:#595959;cursor:pointer;font-size:12px;transition:all 0.2s ease}.history-pagination-button:hover:not(:disabled){border-color:#1890ff;color:#1890ff;background:#e6f7ff}.history-pagination-button:disabled{border-color:#f0f0f0;color:#bfbfbf;background:#fafafa;cursor:not-allowed}.history-pagination-info{flex:1;text-align:center;color:#8c8c8c;font-size:12px}';const c=":host{font-size:16px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;font-weight:normal;font-style:normal;font-variant:normal;line-height:1.5;letter-spacing:normal;word-spacing:normal;color:#333;text-align:left;text-indent:0;text-transform:none;white-space:normal;word-wrap:normal;word-break:normal;visibility:visible;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;border-collapse:separate;border-spacing:0;caption-side:top;empty-cells:show;table-layout:auto;quotes:auto;cursor:auto;direction:ltr;orphans:2;widows:2;page-break-inside:auto;text-decoration:none;text-shadow:none;box-sizing:border-box;writing-mode:horizontal-tb;text-orientation:mixed}";const h=class{constructor(o){e(this,o);this.modalClosed=t(this,"modalClosed");this.uploadSuccess=t(this,"uploadSuccess");this.streamComplete=t(this,"streamComplete");this.conversationStart=t(this,"conversationStart");this.interviewComplete=t(this,"interviewComplete");this.tokenInvalid=t(this,"tokenInvalid");this.someErrorEvent=t(this,"someErrorEvent")}modalTitle="面试出题大师";token;isOpen=false;modalClosed;icon;zIndex=1e3;isShowHeader=true;isNeedClose=true;conversationId;defaultQuery="请开始出题";fullscreen=false;customInputs={};showWorkspaceHistory=false;oemId;questionNumber=6;canOutputAnalysis=true;uploadSuccess;streamComplete;conversationStart;interviewComplete;tokenInvalid;someErrorEvent;filePreviewMode="drawer";uploadedFileInfo=null;showChatModal=false;get hostElement(){return o(this)}jobDescription="";isSubmitting=false;showPositionSelector=false;tokenInvalidListener;removeErrorListener;pcmUploadRef;handleTokenChange(e){if(e&&e!==n.getToken()){n.setToken(e)}}async handleIsOpenChange(e){if(!e){this.showChatModal=false;this.jobDescription=""}else{await s(this.token);if(this.conversationId){this.showChatModal=true}}}componentWillLoad(){if(this.zIndex){a.setItem("modal-zIndex",this.zIndex)}if(this.token){n.setToken(this.token)}this.tokenInvalidListener=()=>{this.tokenInvalid.emit()};this.removeErrorListener=r.addErrorListener((e=>{this.someErrorEvent.emit(e)}));document.addEventListener("pcm-token-invalid",this.tokenInvalidListener)}disconnectedCallback(){document.removeEventListener("pcm-token-invalid",this.tokenInvalidListener);if(this.removeErrorListener){this.removeErrorListener()}}handleClose=()=>{this.modalClosed.emit()};handleJobDescriptionChange=e=>{const t=e.target;this.jobDescription=t.value};handleQuestionNumberChange=e=>{const t=e.target;const o=parseInt(t.value);this.questionNumber=o>=3&&o<=20?o:6};handleAnalysisToggle=e=>{const t=e.target;this.canOutputAnalysis=t.checked};handleOpenPositionSelector=()=>{if(!this.oemId){l.info("未配置OEM ID,无法选择职位");return}this.showPositionSelector=true};handleClosePositionSelector=()=>{this.showPositionSelector=false};handlePositionSelected=e=>{const t=e.detail;this.jobDescription=t.formatted_text||"";this.showPositionSelector=false;l.success("职位信息已填充")};handleStartInterview=async()=>{if(!this.customInputs?.file_url&&!this.uploadedFileInfo){l.info("请上传简历");return}if(!this.customInputs?.job_info&&!this.jobDescription.trim()){l.info("请输入职位描述");return}if(await(this.pcmUploadRef?.getIsUploading?.())){l.info("文件上传中,请稍后");return}this.isSubmitting=true;this.showChatModal=true;this.isSubmitting=false};render(){if(!this.isOpen)return null;const e={zIndex:String(this.zIndex)};const t={"modal-container":true,fullscreen:this.fullscreen,"pc-layout":true};const o={"modal-overlay":true,"fullscreen-overlay":this.fullscreen};const n=this.conversationId&&!this.showChatModal;const s=Boolean(this.customInputs&&this.customInputs.job_info);const r=Boolean(this.customInputs&&this.customInputs.file_url);return i("div",{class:o,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("div",null,this.modalTitle)),this.isNeedClose&&i("button",{class:"close-button",onClick:this.handleClose},i("span",null,"×"))),!this.showChatModal&&!this.conversationId&&i("div",{class:"input-container"},i("div",{class:"jd-input-section"},i("div",{class:"label-with-button"},i("label",{htmlFor:"job-description"},"请输入职位描述 (JD)"),!s&&i("div",{class:"button-group"},this.oemId&&i("button",{class:"position-selector-button",onClick:this.handleOpenPositionSelector,type:"button"},"选择职位"),i("components-mobile-input-btn",{name:"职位描述",onOk:e=>{this.jobDescription=e.detail}}))),i("textarea",{id:"job-description",class:"job-description-textarea",placeholder:"请输入职位描述,包括职责、要求等信息...",rows:6,value:this.customInputs?.job_info||this.jobDescription,onInput:this.handleJobDescriptionChange,disabled:s})),i("div",{class:"resume-upload-section"},i("label",null,"上传简历"),i("components-mobile-upload-btn",{maxFileSize:15*1024*1024,multiple:false,uploadAreaMode:true,acceptFileSuffixList:[".txt",".md",".pdf",".docx",".doc"],uploadParams:{tags:["resume"]},defaultFileList:this.customInputs?.file_url?[{cos_key:this.customInputs.file_url,file_name:this.customInputs?.file_name||"预设简历",file_size:0,ext:""}]:undefined,disabled:r,onOk:e=>{const t=e.detail??[];this.uploadedFileInfo=t[0];this.uploadSuccess.emit(this.uploadedFileInfo)}})),i("div",{class:"interview-settings-section"},i("div",{class:"settings-row"},i("div",{class:"question-number-section"},i("label",{class:"settings-label"},"面试题数量:"),i("div",{class:"slider-container"},i("input",{type:"range",min:"3",max:"20",value:this.questionNumber,class:"question-slider",onInput:this.handleQuestionNumberChange}),i("div",{class:"slider-value"},this.questionNumber,"题")))),i("div",{class:"settings-row"},i("div",{class:"analysis-toggle-section"},i("label",{class:"settings-label"},"是否需要参考答案:"),i("div",{class:"toggle-container"},i("label",{class:"toggle-switch"},i("input",{type:"checkbox",checked:this.canOutputAnalysis,onChange:this.handleAnalysisToggle}),i("span",{class:"toggle-slider"})),i("span",{class:"toggle-text"},this.canOutputAnalysis?"开启":"关闭"))))),i("button",{class:"submit-button",disabled:!r&&!this.uploadedFileInfo||!(this.customInputs?.job_info||this.jobDescription.trim())||this.isSubmitting,onClick:this.handleStartInterview},this.isSubmitting?"处理中...":"开始分析"),i("div",{class:"ai-disclaimer"},i("p",null,"所有内容均由AI生成仅供参考"),i("p",{class:"beian-info"},i("span",null,"中央网信办生成式人工智能服务备案号"),":",i("a",{href:"https://www.pincaimao.com",target:"_blank",rel:"noopener noreferrer"},"Hunan-PinCaiMao-202412310003")))),n&&i("div",{class:"loading-container"},i("div",{class:"loading-spinner"}),i("p",{class:"loading-text"},"正在加载对话...")),this.showChatModal&&i("div",null,i("pcm-app-chat-modal",{isOpen:true,modalTitle:this.modalTitle,icon:this.icon,isShowHeader:this.isShowHeader,isNeedClose:this.isNeedClose,fullscreen:this.fullscreen,showWorkspaceHistory:this.showWorkspaceHistory,botId:"3022316191018876",conversationId:this.conversationId,defaultQuery:this.defaultQuery,filePreviewMode:this.filePreviewMode,customInputs:{...this.customInputs,file_url:this.customInputs?.file_url||this.uploadedFileInfo?.cos_key,file_name:this.customInputs?.file_name||this.uploadedFileInfo?.file_name,job_info:this.customInputs?.job_info||this.jobDescription,question_number:this.questionNumber,can_outputAnalysis:this.canOutputAnalysis?"true":"false"},interviewMode:"text"}))),this.showPositionSelector&&i("div",{class:"position-selector-modal-overlay"},i("div",{class:"position-selector-modal"},i("div",{class:"position-selector-modal-header"},i("h3",null,"选择职位"),i("button",{class:"position-selector-close-btn",onClick:this.handleClosePositionSelector},"×")),i("div",{class:"position-selector-modal-body"},i("components-position-selector",{oemId:this.oemId,multiple:false,onPositionSelected:this.handlePositionSelected})))))}static get watchers(){return{token:["handleTokenChange"],isOpen:["handleIsOpenChange"]}}};h.style=d+(p+c);export{h as oem_mnct_modal};
2
- //# sourceMappingURL=p-58493403.entry.js.map
1
+ import{r as e,c as t,a as o,h as i}from"./p-DA8Myhft.js";import{a as n,v as s}from"./p-B3osOuvR.js";import{E as r}from"./p-C0FYX2-Z.js";import{c as a}from"./p-C7m_4Gmk.js";import{M as l}from"./p-D39f_W8k.js";const d=".label-with-button{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.button-group{display:flex;gap:8px;align-items:center}.position-selector-button{padding:4px 12px;background:#1890ff;color:white;border:none;border-radius:4px;font-size:13px;cursor:pointer;transition:all 0.3s ease;white-space:nowrap;height:28px;line-height:20px}.position-selector-button:hover{background:#40a9ff}.position-selector-button:active{background:#096dd9}.position-selector-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.5);display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.position-selector-modal{background:white;border-radius:8px;width:90%;max-width:900px;height:80vh;max-height:600px;display:flex;flex-direction:column;box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);animation:modalFadeIn 0.3s ease}@keyframes modalFadeIn{from{opacity:0;transform:scale(0.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}.position-selector-modal-header{display:flex;justify-content:space-between;align-items:center;padding:16px 24px;border-bottom:1px solid #f0f0f0;flex-shrink:0}.position-selector-modal-header h3{margin:0;font-size:16px;font-weight:500;color:rgba(0, 0, 0, 0.85)}.position-selector-close-btn{background:none;border:none;font-size:24px;line-height:1;cursor:pointer;color:rgba(0, 0, 0, 0.45);padding:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:all 0.3s}.position-selector-close-btn:hover{background-color:rgba(0, 0, 0, 0.06);color:rgba(0, 0, 0, 0.85)}.position-selector-modal-body{flex:1;overflow:hidden;display:flex;flex-direction:column}@media screen and (max-width: 768px){.position-selector-modal{width:100%;height:90vh;max-height:none;border-radius:8px 8px 0 0;margin-top:auto}.position-selector-modal-overlay{padding:0;align-items:flex-end}}";const p='.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.5);display:flex;z-index:1000;overflow-y:auto}.fullscreen-overlay{padding:0;background-color:rgba(0, 0, 0, 0.7);position:absolute;width:100%;height:auto}.modal-container{background-color:#fff;border-radius:8px;width:100%;display:flex;flex-direction:column;position:relative;margin:5vh auto auto auto;transition:all 0.3s ease-out;overflow:hidden}.modal-container.fullscreen{width:100%;max-width:none;height:100%;border-radius:0;margin:0;display:flex;flex-direction:column;max-height:100%}.pc-layout{width:80%;max-width:600px;min-width:320px}@media screen and (max-width: 768px){.pc-layout{width:95%}.modal-overlay{padding:10px 0px 0px 0px}.modal-container.fullscreen{width:100%;height:100%;max-height:100%;border-radius:16px 16px 0 0;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}}.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;font-size:16px;font-weight:600;color:#333}.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}.upload-area{cursor:pointer;width:100%}.upload-placeholder{transition:all 0.3s ease;display:flex;flex-direction:column;align-items:center;background:rgba(0, 0, 0, 0.02);border:1px dashed #d9d9d9;border-radius:8px;cursor:pointer}.upload-placeholder:hover{border:1px dashed #1890ff}.upload-placeholder img{margin-top:8px;width:50px;height:50px}.upload-placeholder .upload-text{margin:4px 0;color:#332F39;font-size:14px}.upload-placeholder .upload-hint{font-size:14px;color:#949AA5;margin-top:8px;padding:0px 10px;text-align:center;white-space:normal;word-wrap:break-word;word-break:break-all;line-height:1.4}.file-item{position:relative;padding:16px;border:1px solid #e2e8f0;border-radius:8px;transition:border-color 0.3s;cursor:pointer;margin-bottom:16px;display:flex;justify-content:space-between;align-items:center}.file-item:hover{border-color:#0D75FB}.file-item-content{display:flex;align-items:center;gap:8px;flex:1;min-width:0;overflow:hidden}.file-icon{color:#0D75FB;flex-shrink:0}.file-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:calc(100% - 50px)}.remove-file{background:transparent;border:none;color:#94a3b8;cursor:pointer;font-size:18px;display:flex;align-items:center;justify-content:center;padding:4px;margin-left:8px;border-radius:4px;transition:all 0.2s;min-width:30px;min-height:30px}.remove-file:hover{background-color:#f1f5f9;color:#475569}.file-input{display:none}.input-container{padding:20px;display:flex;flex-direction:column;height:calc(100% - 50px);background:linear-gradient(150deg, #2a6ee933, #0000 50%) 0 0 / 400px 200px no-repeat, #fff;overflow-y:auto}.input-container h3{margin-top:0;margin-bottom:20px;font-size:18px;color:#333;text-align:center}.jd-input-section{margin-bottom:20px}.jd-input-section label{display:block;margin-bottom:8px;font-weight:500;color:#333}.job-description-textarea{width:calc(100% - 16px);border:1px solid #ddd;border-radius:4px;resize:vertical;font-family:inherit;font-size:14px;line-height:1.5;transition:border-color 0.3s;padding:8px}.job-description-textarea:focus{outline:none;border-color:#1890ff;box-shadow:0 0 0 2px rgba(24, 144, 255, 0.2)}.resume-upload-section{margin-bottom:20px;width:100%;display:flex;flex-direction:column}.resume-upload-section label{display:block;margin-bottom:8px;font-weight:500;color:#333}.interview-settings-section{margin-bottom:24px;padding:20px;background-color:#f8f9fa;border-radius:8px;border:1px solid #e9ecef}.settings-row{margin-bottom:20px}.settings-row:last-child{margin-bottom:0}.settings-label{display:block;font-weight:500;color:#333;margin-bottom:12px;font-size:14px}.question-number-section{width:100%}.slider-container{display:flex;align-items:center;gap:12px}.question-slider{flex:1;height:6px;background:#ddd;outline:none;border-radius:3px;-webkit-appearance:none;appearance:none}.question-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;background:#0D75FB;cursor:pointer;border-radius:50%;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2)}.question-slider::-moz-range-thumb{width:20px;height:20px;background:#0D75FB;cursor:pointer;border-radius:50%;border:none;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2)}.slider-value{font-weight:600;color:#0D75FB;font-size:14px;min-width:30px;text-align:center}.analysis-toggle-section{width:100%}.toggle-container{display:flex;align-items:center;gap:12px}.toggle-switch{position:relative;display:inline-block;width:44px;height:24px}.toggle-switch input{opacity:0;width:0;height:0}.toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;transition:0.3s;border-radius:24px}.toggle-slider:before{position:absolute;content:"";height:18px;width:18px;left:3px;bottom:3px;background-color:white;transition:0.3s;border-radius:50%;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2)}input:checked+.toggle-slider{background-color:#0D75FB}input:checked+.toggle-slider:before{transform:translateX(20px)}.toggle-text{font-size:14px;color:#666;font-weight:500}.submit-button{margin-top:10px;padding:10px 30px;background:#0D75FB;color:white;border:none;border-radius:4px;font-size:16px;cursor:pointer;transition:all 0.3s ease;width:100%;max-width:400px;align-self:center}.submit-button:hover{background-color:#40a9ff}.submit-button:disabled{background-color:rgba(0,0,0,0.04);color:rgba(0,0,0,0.25);cursor:not-allowed}.ai-disclaimer{margin-top:16px;text-align:center;font-size:12px;color:#999;line-height:1.5}.ai-disclaimer p{margin:4px 0}.beian-info{display:flex;justify-content:center;flex-wrap:wrap;gap:4px}.ai-disclaimer a{color:#666;text-decoration:none;transition:color 0.2s ease}.ai-disclaimer a:hover{color:#1890ff;text-decoration:underline}.loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:24px}.loading-spinner{width:40px;height:40px;border:4px solid rgba(0, 0, 0, 0.1);border-radius:50%;border-top-color:var(--pcm-primary-color, #1890ff);animation:spin 1s linear infinite;margin-bottom:16px}.loading-text{font-size:16px;color:var(--pcm-text-color, #333)}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.header-history-button{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:4px 8px;border:none;border-radius:4px;background:transparent;color:#bbb;cursor:pointer;font-size:13px;font-family:inherit;line-height:1;transition:all 0.2s ease;flex-shrink:0;white-space:nowrap}.header-history-button svg{width:16px;height:16px;display:block;flex-shrink:0}.header-history-button:hover{background-color:rgba(0, 0, 0, 0.04);color:#666}.header-history-button:focus-visible{outline:2px solid rgba(13, 117, 251, 0.35);outline-offset:2px}.history-drawer-content{height:100%;display:flex;flex-direction:column}.conversation-list{flex:1;overflow-y:auto;padding:8px 0}.loading-conversations,.empty-conversations{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 20px;color:#999}.loading-conversations .loading-spinner-small{margin-bottom:12px}.conversation-item{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;margin:0 8px 4px 8px;border-radius:8px;cursor:pointer;transition:all 0.2s ease;border:1px solid transparent}.conversation-item:hover{background:#f5f5f5}.conversation-info{flex:1;min-width:0}.conversation-title{font-size:14px;font-weight:500;color:#262626;margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.conversation-meta{display:flex;align-items:center;gap:8px;font-size:12px;color:#8c8c8c}.conversation-time{flex-shrink:0}.message-count{flex-shrink:0}.conversation-status{padding:2px 6px;border-radius:4px;font-size:11px;font-weight:500}.conversation-status.completed{background:#f6ffed;color:#52c41a}.conversation-status.running{background:#fff7e6;color:#fa8c16}.header-history-entry{display:inline-flex;align-items:center;justify-content:center;margin-left:8px;padding:4px 8px;border:none;border-radius:4px;background:#e6f7ff;color:#1890ff;cursor:pointer;font-size:12px;font-family:inherit;line-height:1;white-space:nowrap;transition:all 0.2s ease}.header-history-entry:hover{background:#bae7ff;color:#0958d9;transform:translateY(-1px)}.header-history-entry:focus-visible{outline:2px solid rgba(13, 117, 251, 0.35);outline-offset:2px}.history-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px 16px;border-top:1px solid #f0f0f0}.history-pagination-button{min-width:72px;padding:6px 12px;border:1px solid #d9d9d9;border-radius:6px;background:#fff;color:#595959;cursor:pointer;font-size:12px;transition:all 0.2s ease}.history-pagination-button:hover:not(:disabled){border-color:#1890ff;color:#1890ff;background:#e6f7ff}.history-pagination-button:disabled{border-color:#f0f0f0;color:#bfbfbf;background:#fafafa;cursor:not-allowed}.history-pagination-info{flex:1;text-align:center;color:#8c8c8c;font-size:12px}';const c=":host{font-size:16px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;font-weight:normal;font-style:normal;font-variant:normal;line-height:1.5;letter-spacing:normal;word-spacing:normal;color:#333;text-align:left;text-indent:0;text-transform:none;white-space:normal;word-wrap:normal;word-break:normal;visibility:visible;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;border-collapse:separate;border-spacing:0;caption-side:top;empty-cells:show;table-layout:auto;quotes:auto;cursor:auto;direction:ltr;orphans:2;widows:2;page-break-inside:auto;text-decoration:none;text-shadow:none;box-sizing:border-box;writing-mode:horizontal-tb;text-orientation:mixed}";const h=class{constructor(o){e(this,o);this.modalClosed=t(this,"modalClosed");this.uploadSuccess=t(this,"uploadSuccess");this.streamComplete=t(this,"streamComplete");this.conversationStart=t(this,"conversationStart");this.interviewComplete=t(this,"interviewComplete");this.tokenInvalid=t(this,"tokenInvalid");this.someErrorEvent=t(this,"someErrorEvent")}modalTitle="面试出题大师";token;isOpen=false;modalClosed;icon;zIndex=1e3;isShowHeader=true;isNeedClose=true;conversationId;defaultQuery="请开始出题";fullscreen=false;customInputs={};showWorkspaceHistory=false;oemId;questionNumber=6;canOutputAnalysis=true;uploadSuccess;streamComplete;conversationStart;interviewComplete;tokenInvalid;someErrorEvent;filePreviewMode="drawer";uploadedFileInfo=null;showChatModal=false;get hostElement(){return o(this)}jobDescription="";isSubmitting=false;showPositionSelector=false;tokenInvalidListener;removeErrorListener;pcmUploadRef;handleTokenChange(e){if(e&&e!==n.getToken()){n.setToken(e)}}async handleIsOpenChange(e){if(!e){this.showChatModal=false;this.jobDescription=""}else{await s(this.token);if(this.conversationId){this.showChatModal=true}}}componentWillLoad(){if(this.zIndex){a.setItem("modal-zIndex",this.zIndex)}if(this.token){n.setToken(this.token)}this.tokenInvalidListener=()=>{this.tokenInvalid.emit()};this.removeErrorListener=r.addErrorListener((e=>{this.someErrorEvent.emit(e)}));document.addEventListener("pcm-token-invalid",this.tokenInvalidListener)}disconnectedCallback(){document.removeEventListener("pcm-token-invalid",this.tokenInvalidListener);if(this.removeErrorListener){this.removeErrorListener()}}handleClose=()=>{this.modalClosed.emit()};handleJobDescriptionChange=e=>{const t=e.target;this.jobDescription=t.value};handleQuestionNumberChange=e=>{const t=e.target;const o=parseInt(t.value);this.questionNumber=o>=3&&o<=20?o:6};handleAnalysisToggle=e=>{const t=e.target;this.canOutputAnalysis=t.checked};handleOpenPositionSelector=()=>{if(!this.oemId){l.info("未配置OEM ID,无法选择职位");return}this.showPositionSelector=true};handleClosePositionSelector=()=>{this.showPositionSelector=false};handlePositionSelected=e=>{const t=e.detail;this.jobDescription=t.formatted_text||"";this.showPositionSelector=false;l.success("职位信息已填充")};handleStartInterview=async()=>{if(!this.customInputs?.file_url&&!this.uploadedFileInfo){l.info("请上传简历");return}if(!this.customInputs?.job_info&&!this.jobDescription.trim()){l.info("请输入职位描述");return}if(await(this.pcmUploadRef?.getIsUploading?.())){l.info("文件上传中,请稍后");return}this.isSubmitting=true;this.showChatModal=true;this.isSubmitting=false};render(){if(!this.isOpen)return null;const e={zIndex:String(this.zIndex)};const t={"modal-container":true,fullscreen:this.fullscreen,"pc-layout":true};const o={"modal-overlay":true,"fullscreen-overlay":this.fullscreen};const n=this.conversationId&&!this.showChatModal;const s=Boolean(this.customInputs&&this.customInputs.job_info);const r=Boolean(this.customInputs&&this.customInputs.file_url);return i("div",{class:o,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("div",null,this.modalTitle)),this.isNeedClose&&i("button",{class:"close-button",onClick:this.handleClose},i("span",null,"×"))),!this.showChatModal&&!this.conversationId&&i("div",{class:"input-container"},i("div",{class:"jd-input-section"},i("div",{class:"label-with-button"},i("label",{htmlFor:"job-description"},"请输入职位描述 (JD)"),!s&&i("div",{class:"button-group"},this.oemId&&i("button",{class:"position-selector-button",onClick:this.handleOpenPositionSelector,type:"button"},"选择职位"),i("components-mobile-input-btn",{name:"职位描述",onOk:e=>{this.jobDescription=e.detail}}))),i("textarea",{id:"job-description",class:"job-description-textarea",placeholder:"请输入职位描述,包括职责、要求等信息...",rows:6,value:this.customInputs?.job_info||this.jobDescription,onInput:this.handleJobDescriptionChange,disabled:s})),i("div",{class:"resume-upload-section"},i("label",null,"上传简历"),i("components-mobile-upload-btn",{maxFileSize:15*1024*1024,multiple:false,uploadAreaMode:true,acceptFileSuffixList:[".txt",".md",".pdf",".docx",".doc"],uploadParams:{tags:["resume"]},defaultFileList:this.customInputs?.file_url?[{cos_key:this.customInputs.file_url,file_name:this.customInputs?.file_name||"预设简历",file_size:0,ext:""}]:undefined,disabled:r,onOk:e=>{const t=e.detail??[];this.uploadedFileInfo=t[0];this.uploadSuccess.emit(this.uploadedFileInfo)}})),i("div",{class:"interview-settings-section"},i("div",{class:"settings-row"},i("div",{class:"question-number-section"},i("label",{class:"settings-label"},"面试题数量:"),i("div",{class:"slider-container"},i("input",{type:"range",min:"3",max:"20",value:this.questionNumber,class:"question-slider",onInput:this.handleQuestionNumberChange}),i("div",{class:"slider-value"},this.questionNumber,"题")))),i("div",{class:"settings-row"},i("div",{class:"analysis-toggle-section"},i("label",{class:"settings-label"},"是否需要参考答案:"),i("div",{class:"toggle-container"},i("label",{class:"toggle-switch"},i("input",{type:"checkbox",checked:this.canOutputAnalysis,onChange:this.handleAnalysisToggle}),i("span",{class:"toggle-slider"})),i("span",{class:"toggle-text"},this.canOutputAnalysis?"开启":"关闭"))))),i("button",{class:"submit-button",disabled:!r&&!this.uploadedFileInfo||!(this.customInputs?.job_info||this.jobDescription.trim())||this.isSubmitting,onClick:this.handleStartInterview},this.isSubmitting?"处理中...":"开始分析"),i("div",{class:"ai-disclaimer"},i("p",null,"所有内容均由AI生成仅供参考"),i("p",{class:"beian-info"},i("span",null,"中央网信办生成式人工智能服务备案号"),":",i("a",{href:"https://www.pincaimao.com",target:"_blank",rel:"noopener noreferrer"},"Hunan-PinCaiMao-202412310003")))),n&&i("div",{class:"loading-container"},i("div",{class:"loading-spinner"}),i("p",{class:"loading-text"},"正在加载对话...")),this.showChatModal&&i("div",null,i("pcm-app-chat-modal",{isOpen:true,modalTitle:this.modalTitle,icon:this.icon,isShowHeader:this.isShowHeader,isNeedClose:this.isNeedClose,fullscreen:this.fullscreen,showWorkspaceHistory:this.showWorkspaceHistory,botId:"3022316191018876",conversationId:this.conversationId,defaultQuery:this.defaultQuery,filePreviewMode:this.filePreviewMode,customInputs:{...this.customInputs,file_url:this.customInputs?.file_url||this.uploadedFileInfo?.cos_key,file_name:this.customInputs?.file_name||this.uploadedFileInfo?.file_name,job_info:this.customInputs?.job_info||this.jobDescription,question_number:this.questionNumber,can_outputAnalysis:this.canOutputAnalysis?"true":"false"},interviewMode:"text"}))),this.showPositionSelector&&i("div",{class:"position-selector-modal-overlay"},i("div",{class:"position-selector-modal"},i("div",{class:"position-selector-modal-header"},i("h3",null,"选择职位"),i("button",{class:"position-selector-close-btn",onClick:this.handleClosePositionSelector},"×")),i("div",{class:"position-selector-modal-body"},i("components-position-selector",{oemId:this.oemId,multiple:false,onPositionSelected:this.handlePositionSelected})))))}static get watchers(){return{token:["handleTokenChange"],isOpen:["handleIsOpenChange"]}}};h.style=d+(p+c);export{h as oem_mnct_modal};
2
+ //# sourceMappingURL=p-66cb43c9.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as t,c as e,a as i,h as o}from"./p-DA8Myhft.js";import{a as s,f as n,b as r,s as a,g as l,u as d,d as c}from"./p-CcIrA6cr.js";import{s as h}from"./p-DnoxSHNP.js";import{E as p}from"./p-C0FYX2-Z.js";import{c as f}from"./p-C7m_4Gmk.js";import{S as g}from"./p-B23366TU.js";import"./p-Bs-zO1WZ.js";const m=':host{display:block;font-size:16px}.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:hidden;padding:0;z-index:1000}.fullscreen-overlay{padding:0;position:absolute;width:100%;height:100%}.modal-container{background:#fff;border-radius:0;width:100%;height:100%;display:flex;flex-direction:column;position:relative;margin:0;overflow:hidden}.modal-container.fullscreen{width:100%;max-width:none;height:100%;border-radius:0;margin:0;display:flex;flex-direction:column;max-height:100%}.digital-human-background{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;overflow:hidden;display:flex;justify-content:center}.digital-human-background-video{width:100%;height:100%;object-fit:cover;object-position:center;max-width:1200px}.modal-container:not(.digital-human-mode){background:white;border-radius:8px;width:100%;max-width:900px;height:90vh;max-height:800px}.modal-content-layer{position:relative;z-index:10;height:100%;display:flex;flex-direction:column;background:linear-gradient(\r\n 180deg,\r\n rgba(0, 0, 0, 0.3) 0%,\r\n rgba(0, 0, 0, 0.1) 20%,\r\n rgba(0, 0, 0, 0.1) 80%,\r\n rgba(0, 0, 0, 0.4) 100%\r\n )}.main-content{display:flex;flex-direction:column;align-items:center;overflow:hidden;padding:24px 24px 40px 24px;position:absolute;bottom:0px;width:-webkit-fill-available}.chat-history-section{width:100%;max-width:1240px;text-align:center;color:white}.ai-message-item{padding:12px 20px;border-radius:12px;margin-bottom:12px;animation:fadeIn 0.5s ease-in-out}.recording-preview-top-right{position:absolute;top:20px;right:20px;width:180px;height:120px;border-radius:12px;overflow:hidden;border:2px solid rgba(255, 255, 255, 0.5);box-shadow:0 4px 12px rgba(0, 0, 0, 0.3);background-color:#000;z-index:10}.user-video-preview{width:100%;height:100%;object-fit:cover}.recording-status-bar{display:flex;align-items:center;justify-content:space-between;background-color:white;padding:8px 12px;border-radius:999px;margin-top:4px;width:100%;max-width:400px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.1);animation:slideInUp 0.5s ease-out;line-height:40px}.audio-waveform{display:flex;align-items:center;height:24px}.waveform-bar{width:4px;margin:0 2px;background-color:#16a34a;border-radius:2px;height:6px;animation:waveform-animation 1.2s infinite ease-in-out}.waveform-bar:nth-child(1){animation-delay:0.1s}.waveform-bar:nth-child(2){animation-delay:0.3s}.waveform-bar:nth-child(3){animation-delay:0.5s}.waveform-bar:nth-child(4){animation-delay:0.2s}.waveform-bar:nth-child(5){animation-delay:0.4s}.waveform-bar:nth-child(6){animation-delay:0.1s}.waveform-bar:nth-child(7){animation-delay:0.3s}.waveform-bar:nth-child(8){animation-delay:0.5s}@keyframes waveform-animation{0%,100%{height:6px}50%{height:35px}}.recording-timer{font-size:14px;color:#595959;font-family:\'Courier New\', Courier, monospace}.finish-recording-btn{background-color:#16a34a;border:none;border-radius:50%;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);transition:background-color 0.3s,\r\n transform 0.2s}.finish-recording-btn:hover{background-color:#148a3f}.finish-recording-btn:active{transform:scale(0.95)}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes slideInUp{from{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}.status-indicator-text{display:flex;align-items:center;gap:8px;font-size:14px;color:#595959;width:100%;justify-content:center}.status-indicator-text.loading .loading-spinner-small{width:16px;height:16px;border:2px solid rgba(0, 0, 0, 0.1);border-top-color:#595959;border-radius:50%;animation:spin 0.8s linear infinite}.status-indicator-text.error{color:#ff4d4f}.status-indicator-text.ready{color:#16a34a}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.loading-spinner-small{width:20px;height:20px;border:2px solid #e5e7eb;border-top-color:#6b7280;border-radius:50%;animation:spin 0.8s 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}.recording-section{border-top:1px solid #eee;display:flex;flex-direction:column;align-items:center;padding:10px 20px 0px 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:14px;z-index:0}.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:16px;background-color:#0d75fb;border-radius:6px;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:16px}.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}.text-input-area{display:flex;flex-direction:column;width:100%;height:100%;padding:0px 16px 16px 16px;border-radius:8px;border:none;}.text-answer-input{flex:1;min-height:80px;padding:12px 12px 0px 12px;border:1px solid #ddd;border-radius:8px 8px 0 0;resize:none;font-size:16px;background-color:#fff;border-bottom:none;outline:none;}.input-toolbar{display:flex;justify-content:flex-end;align-items:center;padding:8px 12px;background-color:#fff;border:1px solid #ddd;border-top:none;border-radius:0 0 8px 8px}.text-answer-input:focus{border-color:rgb(74, 144, 226);border-bottom:none}.text-answer-input:focus+.input-toolbar{border-color:rgb(74, 144, 226);border-top:none}.toolbar-actions{width:32px;height:32px;display:flex;justify-content:center;align-items:center;margin-right:10px;border:1px solid #d9d9d9;border-radius:6px}.toolbar-actions:hover{background-color:#f0f0f0}.toolbar-button{background:transparent;border:none;color:#666;cursor:pointer;padding:0;margin:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.toolbar-button>div,.toolbar-button>svg{display:flex;justify-content:center;align-items:center}.submit-text-button{padding:6px 16px;background-color:#4a90e2;color:white;border:none;border-radius:4px;font-size:14px;font-weight:500;cursor:pointer;transition:background-color 0.2s}.submit-text-button:hover:not(.disabled){background-color:#3a7bc8}.submit-text-button.disabled{background-color:#b3b3b3;cursor:not-allowed}.toolbar-button.recording{background-color:rgba(255, 0, 0, 0.1);color:#ff3b30;animation:pulse 1.5s infinite}.toolbar-button.converting{background-color:rgba(0, 122, 255, 0.1);color:#007aff}.toolbar-button .recording-time{font-size:12px;margin-left:4px}.converting-indicator{display:flex;justify-content:center;align-items:center}.converting-indicator svg{animation:spin 1.5s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(255, 0, 0, 0.4)}70%{box-shadow:0 0 0 6px rgba(255, 0, 0, 0)}100%{box-shadow:0 0 0 0 rgba(255, 0, 0, 0)}}@media screen and (max-width: 768px){.pc-layout{width:95%}.modal-overlay{padding:0}.modal-container.fullscreen{width:100%;height:100%;max-height:100%;border-radius:16px 16px 0 0;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}}.workspace-section{width:100%;padding:0px 16px 16px}.workspace-toolbar{display:flex;justify-content:space-between;align-items:end;gap:12px;position:relative}.workspace-button{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #d9d9d9;border-radius:6px;background:white;color:#666;font-size:14px;cursor:pointer;transition:all 0.2s ease;box-shadow:0 1px 2px rgba(0, 0, 0, 0.05)}.workspace-button:hover{border-color:#4096ff;color:#4096ff;box-shadow:0 2px 4px rgba(64, 150, 255, 0.1)}.workspace-button svg{flex-shrink:0}.digital-human-wrapper{display:flex;align-items:center;justify-content:center;width:120px;height:80px;border:1px solid #d9d9d9;border-radius:8px;background:#fafafa;overflow:hidden;position:absolute;right:0px}.history-drawer-content{height:100%;display:flex;flex-direction:column}.conversation-list{flex:1;overflow-y:auto;padding:8px 0}.loading-conversations,.empty-conversations{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 20px;color:#999}.loading-conversations .loading-spinner-small{margin-bottom:12px}.conversation-item{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;margin:0 8px 4px 8px;border-radius:8px;cursor:pointer;transition:all 0.2s ease;border:1px solid transparent}.conversation-item:hover{background:#f5f5f5}.conversation-item.active{background:#e6f7ff;border-color:#1890ff}.conversation-info{flex:1;min-width:0}.conversation-title{font-size:14px;font-weight:500;color:#262626;margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.conversation-meta{display:flex;align-items:center;gap:8px;font-size:12px;color:#8c8c8c}.conversation-time{flex-shrink:0}.message-count{flex-shrink:0}.conversation-status{padding:2px 6px;border-radius:4px;font-size:11px;font-weight:500}.conversation-status.completed{background:#f6ffed;color:#52c41a}.conversation-status.running{background:#fff7e6;color:#fa8c16}.current-indicator{flex-shrink:0;color:#1890ff;margin-left:8px}.ai-message-item{box-sizing:border-box;margin:0 auto;animation:messageSlideIn 0.3s ease-out;width:100%;padding:40px}.ai-message-item.streaming{position:relative}@keyframes messageSlideIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.ai-message-content{box-sizing:border-box;color:#fff;padding:40px 48px;border-radius:32px;font-family:"Microsoft YaHei", "PingFang SC", sans-serif;font-size:32px;font-weight:500;line-height:1.6;word-wrap:break-word;backdrop-filter:blur(100px);border:1px solid rgba(255, 255, 255, 0.2);box-shadow:0 4px 20px rgba(0, 0, 0, 0.2);margin-bottom:16px;max-width:100%;text-align:left}.typing-indicator{display:flex;align-items:center;gap:8px;padding:16px 48px;margin-top:-16px}.typing-indicator span{width:16px;height:16px;border-radius:50%;background:#4facfe;animation:typingPulse 1.4s ease-in-out infinite;opacity:0.6}.typing-indicator span:nth-child(1){animation-delay:0s}.typing-indicator span:nth-child(2){animation-delay:0.2s}.typing-indicator span:nth-child(3){animation-delay:0.4s}@keyframes typingPulse{0%,60%,100%{transform:scale(1);opacity:0.4}30%{transform:scale(1.3);opacity:1}}@media screen and (max-width: 768px){.ai-message-item{padding:30px}.ai-message-content{padding:32px 40px;font-size:30px}.typing-indicator{padding:12px 40px}}@media screen and (max-width: 480px){.ai-message-item{padding:0}.ai-message-content{padding:28px 36px;font-size:28px;line-height:1.5}.typing-indicator{padding:10px 36px}.typing-indicator span{width:12px;height:12px}}.waveform-bar{width:3px;background:#4facfe;border-radius:2px;min-height:2px;animation:waveformAnimation 1.2s ease-in-out infinite alternate;transform-origin:bottom}@keyframes waveformAnimation{0%{transform:scaleY(0.2)}100%{transform:scaleY(1)}}.recording-timer{font-size:14px;color:#666;white-space:nowrap}.close-button{position:absolute;top:16px;left:16px;z-index:20;background:rgba(255, 255, 255, 0.9);backdrop-filter:blur(4px);border:1px solid rgba(0, 0, 0, 0.1);border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px rgba(0, 0, 0, 0.1)}.close-button:hover{background:rgba(255, 255, 255, 1);border-color:rgba(0, 0, 0, 0.15);box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);transform:translateY(-1px)}.close-button:active{transform:translateY(0);box-shadow:0 2px 6px rgba(0, 0, 0, 0.1)}.close-button svg{color:#666;transition:color 0.2s ease}.close-button:hover svg{color:#333}.end-interview-button-container{display:flex;align-items:center;justify-content:flex-start;width:100%;max-width:400px;margin-bottom:4px;padding-left:0}.end-interview-button{padding:5px 10px;background-color:#ff4d4f;color:white;border:none;border-radius:20px;font-size:14px;font-weight:500;cursor:pointer;transition:all 0.3s ease;box-shadow:0 2px 8px rgba(255, 77, 79, 0.3);white-space:nowrap}.end-interview-button:hover{background-color:#ff7875;box-shadow:0 4px 12px rgba(255, 77, 79, 0.4);transform:translateY(-1px)}.end-interview-button:active{transform:translateY(0);box-shadow:0 2px 8px rgba(255, 77, 79, 0.3)}.end-interview-button:disabled{background-color:#f0f0f0;color:#bfbfbf;cursor:not-allowed;box-shadow:none;transform:none}';const u=":host{font-size:16px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;font-weight:normal;font-style:normal;font-variant:normal;line-height:1.5;letter-spacing:normal;word-spacing:normal;color:#333;text-align:left;text-indent:0;text-transform:none;white-space:normal;word-wrap:normal;word-break:normal;visibility:visible;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;border-collapse:separate;border-spacing:0;caption-side:top;empty-cells:show;table-layout:auto;quotes:auto;cursor:auto;direction:ltr;orphans:2;widows:2;page-break-inside:auto;text-decoration:none;text-shadow:none;box-sizing:border-box;writing-mode:horizontal-tb;text-orientation:mixed}";const x=class{constructor(i){t(this,i);this.streamComplete=e(this,"streamComplete");this.conversationStart=e(this,"conversationStart");this.interviewComplete=e(this,"interviewComplete");this.recordingError=e(this,"recordingError");this.recordingStatusChange=e(this,"recordingStatusChange");this.tokenInvalid=e(this,"tokenInvalid");this.modalClosed=e(this,"modalClosed")}token;isOpen=false;messages=[];zIndex;conversationId;isLoading=false;currentStreamingMessage=null;isLoadingHistory=false;get hostElement(){return i(this)}streamComplete;conversationStart;defaultQuery="你好!聘才猫";maxRecordingTime=120;countdownWarningTime=30;isRecording=false;recordingStream=null;recordedBlob=null;mediaRecorder=null;recordingTimeLeft=0;showRecordingUI=false;recordingTimer=null;recordingStartTime=0;waitingToRecord=false;waitingTimer=null;_visibilityChangeHandler=null;waitingTimeLeft=10;videoRef=null;currentQuestionNumber=0;interviewComplete;showCountdownWarning=false;fullscreen=false;isUploadingVideo=false;digitalHumanVideoUrl="";digitalHumanDefaultVideoUrl="";virtualmanKey="";isPlayingDigitalHumanVideo=false;digitalHumanVideoReady=false;digitalHumanOpeningContents=[];isPlayingWelcomeVideo=false;isGeneratingDigitalHumanVideo=false;pendingGeneratedVideoUrl="";preloadedVideos=new Set;preloadingVideos=new Map;waitingForDigitalHuman=false;digitalId;openingIndex=0;waitingTime=10;playbackRate=1;showEndInterviewButton=false;recordingError;recordingStatusChange;tokenInvalid;modalClosed;customInputs={};botId;agentLogo="";isTaskCompleted=false;tokenInvalidListener;deviceError=null;showConfirmModal=false;skipConfirmThisInterview=false;showCloseConfirmModal=false;showEndInterviewConfirmModal=false;isEndingInterview=false;isComponentActive=true;handleTokenChange(t){if(t&&t!==s.getToken()){s.setToken(t)}}async setComponentActive(t){this.isComponentActive=t}componentWillLoad(){if(this.zIndex){f.setItem("modal-zIndex",this.zIndex)}else{const t=f.getItem("modal-zIndex");if(t){this.zIndex=t}else{this.zIndex=1e3;f.setItem("modal-zIndex",1e3)}}if(this.token){s.setToken(this.token)}this.tokenInvalidListener=()=>{this.tokenInvalid.emit()};document.addEventListener("pcm-token-invalid",this.tokenInvalidListener);this._visibilityChangeHandler=()=>{if(document.visibilityState==="visible"){this.handlePageResume()}};document.addEventListener("visibilitychange",this._visibilityChangeHandler);if(!this.customInputs){this.customInputs={}}if(this.botId){this.fetchAgentLogo()}console.log("componentWillLoad - 数字人相关状态:",{digitalId:this.digitalId,isOpen:this.isOpen,conversationId:this.conversationId,virtualmanKey:this.virtualmanKey});if(this.isOpen){if(this.conversationId){setTimeout((()=>this.loadHistoryMessages()),0)}else{if(this.digitalId){this.initializeDigitalHuman()}setTimeout((()=>{this.sendMessageToAPI(this.defaultQuery)}),0)}}}async fetchAgentLogo(){if(!this.botId)return;try{const t=await n(this.botId);if(t&&t.logo){this.agentLogo=t.logo}}catch(t){g.captureError(t,{action:"fetchAgentLogo",component:"components-oem-virtual-chat-modal",title:"获取智能体信息失败"});p.emitError({error:t,message:"获取智能体信息失败"})}}async sendMessageToAPI(t,e){if(this.isTaskCompleted&&!this.isEndingInterview){return}this.waitingForDigitalHuman=false;this.digitalHumanVideoReady=false;this.isLoading=true;let i="";let o="";const s=new Date;const n=`${s.getHours()}:${s.getMinutes().toString().padStart(2,"0")}`;const a=t.trim()||"请开始";if(e){this.customInputs={...this.customInputs,video_url:e}}if(!this.customInputs.url_callback){this.customInputs={...this.customInputs,url_callback:"https://tagents.ylzhaopin.com/agents/api/test/callback"}}const l={id:`temp-${Date.now()}`,conversation_id:this.conversationId,inputs:this.customInputs||{},query:a,answer:"",message_files:[],feedback:{},retriever_resources:[],created_at:Math.floor(Date.now()/1e3).toString(),agent_thoughts:[],status:"normal",error:null,time:n,isStreaming:true};this.currentStreamingMessage=l;const d={response_mode:"streaming",conversation_id:this.conversationId,query:a,bot_id:this.botId};d.inputs={...this.customInputs};await r({url:"/sdk/v1/chat/chat-messages",method:"POST",data:d,onMessage:t=>{if(t.conversation_id&&!this.conversationId){this.conversationId=t.conversation_id;this.conversationStart.emit({conversation_id:t.conversation_id,event:t.event,message_id:t.message_id,id:t.id})}if(t.event==="node_finished"&&t.data.inputs&&t.data.inputs.LLMText){o=t.data.inputs.LLMText}if(t.event==="node_finished"&&t.data.title&&t.data.title.includes("聘才猫任务结束")){this.isTaskCompleted=true;const t=o||i||this.currentStreamingMessage?.answer||"";this.interviewComplete.emit({conversation_id:this.conversationId,current_question_number:this.currentQuestionNumber,ai_response:t})}if(t.event==="node_finished"&&t.data.title&&t.data.title.includes("聘才猫数字人题目")){const e=JSON.parse(t.data.process_data.digital_human_list);this.precreateDigitalHumanVideos(e)}if(t.event==="error"){const e=t.data?.message||t.message||"请求失败";this.messages=[...this.messages,{...l,answer:e,error:t.data,isStreaming:false}];this.currentStreamingMessage=null;this.isLoading=false;p.emitError({error:t.data,message:e});return}if(t.event==="message"){if(t.event==="agent_message"||t.event==="message"){if(t.answer){i+=t.answer;const e={...this.currentStreamingMessage,answer:i,id:t.message_id||this.currentStreamingMessage.id,isStreaming:true,retriever_resources:t.retriever_resources||this.currentStreamingMessage.retriever_resources,agent_thoughts:t.agent_thoughts||this.currentStreamingMessage.agent_thoughts};this.currentStreamingMessage=e}}}if(t.event==="message_end"){this.streamComplete.emit({conversation_id:t.conversation_id||"",event:t.event,message_id:t.message_id,id:t.id})}},onError:t=>{console.error("发生错误:",t);p.emitError({error:t,message:"消息发送失败,请稍后再试"});g.captureError(t,{action:"sendMessageToAPI",component:"components-oem-virtual-chat-modal",title:"消息发送失败"});this.messages=[...this.messages,{...l,answer:"消息发送失败,请检查网络。",error:t,isStreaming:false}];this.currentStreamingMessage=null;this.isLoading=false},onComplete:async()=>{this.isLoading=false;if(this.currentQuestionNumber===0){setTimeout((()=>{if(this.customInputs){delete this.customInputs.job_info;delete this.customInputs.file_url;delete this.customInputs.file_name}}),1e3)}const t=this.currentStreamingMessage;t.isStreaming=false;if(this.digitalId&&t&&t.answer){this.generateDigitalHumanVideo(t.answer)}this.currentStreamingMessage=null;this.messages=[...this.messages,t];this.currentQuestionNumber++;if(this.isTaskCompleted||this.isEndingInterview){return}if(this.digitalId){this.waitingForDigitalHuman=true}}})}async loadHistoryMessages(){if(!this.conversationId)return;this.isLoadingHistory=true;let t=false;this.digitalHumanVideoReady=true;try{const e=await a({url:`/sdk/v1/chat/conversation`,method:"GET",data:{conversation_id:this.conversationId}});if(e.success&&e.data&&e.data.run_status=="结束"){t=true}const i=await a({url:"/sdk/v1/chat/messages",method:"GET",data:{conversation_id:this.conversationId,bot_id:this.botId,limit:20}});if(i.success&&i.data){const t=i.data.data||[];const e=t.map((t=>{const e=new Date(parseInt(t.created_at)*1e3);const i=e.getHours().toString().padStart(2,"0");const o=e.getMinutes().toString().padStart(2,"0");const s=`${i}:${o}`;return{id:t.id,conversation_id:t.conversation_id,inputs:t.inputs||{},query:t.query||"",answer:t.answer||"",message_files:t.message_files||[],feedback:t.feedback||{},retriever_resources:t.retriever_resources||[],created_at:t.created_at,agent_thoughts:t.agent_thoughts||[],status:t.status||"normal",error:t.error,time:s,isStreaming:false}}));this.messages=e;this.currentQuestionNumber=e.length||0}}catch(t){console.error("加载历史消息或会话状态失败:",t);g.captureError(t,{action:"loadHistoryMessages",component:"components-oem-virtual-chat-modal",title:"加载历史消息失败"});p.emitError({error:t,message:"加载历史消息失败,请刷新重试"})}finally{this.isLoadingHistory=false;if(this.conversationId&&this.messages.length>0&&!t&&!this.isEndingInterview){this.isPlayingDigitalHumanVideo=false;this.isPlayingWelcomeVideo=false;this.digitalHumanVideoReady=true;this.initializeDigitalHuman().then((()=>{if(this.digitalHumanDefaultVideoUrl){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl}}));setTimeout((()=>{this.startWaitingToRecord()}),200)}else if(t){this.isTaskCompleted=true;if(this.digitalId){this.isPlayingDigitalHumanVideo=false;this.isPlayingWelcomeVideo=false;this.digitalHumanVideoReady=true;this.initializeDigitalHuman().then((()=>{if(this.digitalHumanDefaultVideoUrl){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl}}))}}}}startWaitingToRecord(){if(this.isTaskCompleted||this.isEndingInterview){return}if(this.waitingTimer){clearInterval(this.waitingTimer)}if(this.recordingTimer){clearInterval(this.recordingTimer)}this.waitingToRecord=true;this.waitingTimeLeft=this.waitingTime;this.waitingTimer=setInterval((()=>{this.waitingTimeLeft--;if(this.waitingTimeLeft<=0){clearInterval(this.waitingTimer);this.waitingTimer=null;this.waitingToRecord=false;this.startRecording()}}),1e3)}async startRecording(){if(this.isTaskCompleted||this.isEndingInterview){return}try{const t=await navigator.mediaDevices.getUserMedia({audio:true,video:{width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}}});this.deviceError=null;this.recordingStream=t;this.showRecordingUI=true;this.showCountdownWarning=false;this.videoRef=null;this.setupVideoPreview(t);const e=l();let i;try{i=new MediaRecorder(t,{mimeType:e,videoBitsPerSecond:8e5,audioBitsPerSecond:64e3})}catch(e){console.warn("指定的MIME类型不受支持,使用默认设置:",e);try{i=new MediaRecorder(t,{videoBitsPerSecond:8e5,audioBitsPerSecond:64e3})}catch(e){try{i=new MediaRecorder(t)}catch(t){this.recordingError.emit({type:"recorder_creation_failed",message:"无法创建媒体录制器,您的浏览器可能不支持此功能",details:t});this.showRecordingUI=false;return}}}this.mediaRecorder=i;const o=[];i.ondataavailable=t=>{if(t.data.size>0){o.push(t.data)}};i.onerror=t=>{this.recordingError.emit({type:"recording_error",message:"录制过程中发生错误",details:t});this.stopRecording()};i.onstop=()=>{try{const t=e||"video/mp4";const i=new Blob(o,{type:t});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(t){this.recordingError.emit({type:"processing_error",message:"处理录制视频时出错",details:t});this.showRecordingUI=false;g.captureError(t,{action:"uploadRecordedVideo",component:"pcm-hr-chat-modal",title:"处理录制视频时出错"})}};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(t){this.recordingError.emit({type:"start_failed",message:"开始录制失败,请检查您的设备权限",details:t});this.showRecordingUI=false;g.captureError(t,{action:"startRecording",component:"pcm-hr-chat-modal",title:"开始录制失败"});return}this.recordingTimer=setInterval((()=>{const t=Math.floor((Date.now()-this.recordingStartTime)/1e3);this.recordingTimeLeft=Math.max(0,this.maxRecordingTime-t);if(this.recordingTimeLeft<=this.countdownWarningTime&&!this.showCountdownWarning){this.showCountdownWarning=true}if(this.recordingTimeLeft<=0){this.stopRecording()}}),1e3)}catch(t){console.error("无法访问摄像头或麦克风:",t);let e="设备访问失败";if(t.name==="NotAllowedError"){e="请允许访问摄像头和麦克风权限"}else if(t.name==="NotFoundError"){e="未检测到摄像头或麦克风设备"}else if(t.name==="NotReadableError"){e="您的浏览器不支持视频录制,请切换到微信或Chrome、Edge使用"}else if(t.name==="OverconstrainedError"){e="摄像头不支持指定的配置"}else{e="无法访问摄像头或麦克风,请检查设备连接"}this.deviceError=e;this.showRecordingUI=false;p.emitError({error:t,message:e});g.captureError(t,{action:"startRecording",component:"components-oem-virtual-chat-modal",title:e})}}setupVideoPreview(t){setTimeout((()=>{const e=this.hostElement.shadowRoot?.querySelector(".user-video-preview");if(e&&t){try{e.srcObject=t;e.play().catch((t=>{console.error("视频播放失败:",t);g.captureError(t,{action:"setupVideoPreview",component:"components-oem-virtual-chat-modal",title:"视频播放失败"});p.emitError({error:t,message:"视频播放失败"})}))}catch(i){console.warn("设置srcObject失败,尝试替代方法:",i);try{const i=URL.createObjectURL(t);e.src=i;e.onended=()=>{URL.revokeObjectURL(i)}}catch(t){console.error("创建对象URL失败:",t);g.captureError(t,{action:"setupVideoPreview",component:"components-oem-virtual-chat-modal",title:"创建对象URL失败"});p.emitError({error:t,message:"创建对象URL失败"})}}}else{console.warn("未找到视频元素或媒体流无效")}}),100)}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((t=>t.stop()));this.recordingStream=null}this.videoRef=null}this.pendingGeneratedVideoUrl=""}handleStopRecording=()=>{if(this.skipConfirmThisInterview){this.stopRecording();return}this.showConfirmModal=true};handleSkipConfirmChange=t=>{const e=t.target;this.skipConfirmThisInterview=e.checked};handleConfirmModalCancel=()=>{this.showConfirmModal=false};handleConfirmModalOk=()=>{this.showConfirmModal=false;this.stopRecording()};handleConfirmModalCancelEvent=()=>{this.showConfirmModal=false};async uploadRecordedVideo(){if(!this.recordedBlob)return;try{this.isUploadingVideo=true;this.showRecordingUI=false;const t=this.recordedBlob.type.includes("webm")?"webm":"mp4";const e=`answer.${t}`;const i=new File([this.recordedBlob],e,{type:this.recordedBlob.type});const o=await d(i,{},{tags:["other"]});const s=await c(o.cos_key);if(this.isEndingInterview){await this.sendEndInterviewMessage()}else{this.sendMessageToAPI(s||"下一题",o.cos_key)}}catch(t){console.error("视频上传或处理错误:",t);this.isEndingInterview=false;g.captureError(t,{action:"uploadRecordedVideo",component:"components-oem-virtual-chat-modal",title:"视频上传或处理失败"});p.emitError({error:t,message:"视频上传或处理失败"})}finally{this.isUploadingVideo=false;this.showRecordingUI=false;this.recordedBlob=null}}handleCloseClick=()=>{this.showCloseConfirmModal=true};handleCloseConfirmOk=()=>{this.showCloseConfirmModal=false;this.stopRecording();this.modalClosed.emit()};handleCloseConfirmCancel=()=>{this.showCloseConfirmModal=false};disconnectedCallback(){document.removeEventListener("pcm-token-invalid",this.tokenInvalidListener);if(this._visibilityChangeHandler){document.removeEventListener("visibilitychange",this._visibilityChangeHandler);this._visibilityChangeHandler=null}if(this.waitingTimer){clearInterval(this.waitingTimer);this.waitingTimer=null}if(this.recordingTimer){clearInterval(this.recordingTimer);this.recordingTimer=null}this.stopRecording();this.preloadedVideos.clear();this.preloadingVideos.clear();this.pendingGeneratedVideoUrl=""}async precreateDigitalHumanVideos(t){if(!this.virtualmanKey){console.warn("VirtualmanKey尚未加载,无法预创建视频。");return}for(const e of t){if(!e||!e.trim())continue;try{await a({url:"/sdk/v1/virtual-human/create-video",method:"POST",data:{VirtualmanKey:this.virtualmanKey,InputSsml:e,SpeechParam:{Speed:1},VideoParam:{Format:"TransparentWebm"},DriverType:"Text"}})}catch(t){console.error(`为文本 "${e}" 创建视频任务失败:`,t);g.captureError(t,{action:"precreateDigitalHumanVideos",component:"components-oem-virtual-chat-modal",title:`为文本 "${e}" 创建视频任务失败`})}}}async initializeDigitalHuman(){if(!this.digitalId)return;try{const t=await a({url:"/sdk/v1/virtual-human/avatar-detail",method:"POST",data:{avatar_id:this.digitalId}});if(t.success){const{placeholder_video_url:e,virtualman_key:i,opening_contents:o}=t.data;if(e){this.digitalHumanDefaultVideoUrl=e;this.digitalHumanVideoUrl=e}if(i){this.virtualmanKey=i}if(o&&Array.isArray(o)&&o.length>0){this.digitalHumanOpeningContents=o;const t=Math.max(0,Math.min(2,this.openingIndex||0));const i=this.digitalHumanOpeningContents[t]||this.digitalHumanOpeningContents[0];const s=[];if(i.video_url){s.push(i.video_url)}if(e&&e!==i.video_url){s.push(e)}this.handleVideoUrlReceivedSequential(s,"数字人初始化(顺序)");if(i.video_url&&!this.digitalHumanVideoReady){this.playDigitalHumanVideo(i.video_url,true)}}else{if(e){this.handleVideoUrlReceivedSequential([e],"数字人初始化(仅默认视频)")}}}}catch(t){console.error("初始化数字人失败:",t);g.captureError(t,{action:"initializeDigitalHuman",component:"components-oem-virtual-chat-modal",title:"数字人初始化失败"})}}async generateDigitalHumanVideo(t){if(!this.isComponentActive){console.warn("组件已停用,跳过数字人视频生成");return}if(!t.trim()||!this.virtualmanKey){if(this.waitingForDigitalHuman&&!this.isTaskCompleted){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}return}this.isGeneratingDigitalHumanVideo=true;try{const e=await a({url:"/sdk/v1/virtual-human/create-video",method:"POST",data:{VirtualmanKey:this.virtualmanKey,InputSsml:t,SpeechParam:{Speed:1},VideoParam:{Format:"TransparentWebm"},DriverType:"Text"}});if(!e.success){h(e.message,"error");throw new Error(`创建视频任务失败: ${e.message}`)}const i=e.data.Payload.TaskId;const o=await this.pollVideoProgress(i);if(!this.isComponentActive){console.warn("组件已停用,跳过视频播放");return}if(o){await this.preloadVideo(o);if(!this.isComponentActive){console.warn("组件已停用,跳过视频播放");return}if(this.isPlayingWelcomeVideo){this.pendingGeneratedVideoUrl=o}else{await this.playDigitalHumanVideo(o)}}else{throw new Error("未能获取到数字人视频URL")}}catch(t){console.error("数字人视频生成失败:",t);g.captureError(t,{action:"generateDigitalHumanVideo",component:"components-oem-virtual-chat-modal",title:"数字人视频生成失败"});if(this.waitingForDigitalHuman&&!this.isTaskCompleted){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}finally{this.isGeneratingDigitalHumanVideo=false}}async pollVideoProgress(t){const e=45;const i=2e3;for(let o=0;o<e;o++){try{const e=await a({url:"/sdk/v1/virtual-human/query-progress",method:"POST",data:{TaskId:t}});if(!e.success){throw new Error(`查询进度失败: ${e.message}`)}const o=e.data.Payload;if(o.Status==="SUCCESS"&&o.Progress===100){return o.MediaUrl}else if(o.Status==="FAILED"){throw new Error(`视频生成失败: ${o.FailMessage}`)}await new Promise((t=>setTimeout(t,i)))}catch(t){console.error("轮询视频进度失败:",t);break}}throw new Error("视频生成超时")}async playDigitalHumanVideo(t,e=false){try{await this.preloadVideo(t);this.digitalHumanVideoUrl=t;this.isPlayingDigitalHumanVideo=true;this.digitalHumanVideoReady=true;this.isPlayingWelcomeVideo=e}catch(t){console.error("播放数字人视频失败:",t);if(this.waitingForDigitalHuman&&!this.isTaskCompleted){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}}async preloadVideo(t){if(!t||!t.trim()){return Promise.resolve()}const e=t.trim();const i=e.split("/").pop()||e;if(this.preloadedVideos.has(e)){return Promise.resolve()}if(this.preloadingVideos.has(e)){return this.preloadingVideos.get(e)}const o=this.executeVideoPreload(e);this.preloadingVideos.set(e,o);try{await o;this.preloadedVideos.add(e)}catch(t){console.error(`💥 视频预加载失败: ${i.substring(0,30)}${i.length>30?"...":""}`,t)}finally{this.preloadingVideos.delete(e)}}async executeVideoPreload(t){return new Promise(((e,i)=>{const o=document.createElement("video");o.preload="auto";o.src=t;o.muted=true;o.crossOrigin="anonymous";let s=false;const n=()=>{if(s)return;s=true;a();e()};const r=e=>{if(s)return;s=true;a();console.error("视频预加载失败:",t,e);i(new Error("视频预加载失败"))};const a=()=>{o.removeEventListener("canplaythrough",n);o.removeEventListener("loadeddata",n);o.removeEventListener("error",r);o.removeEventListener("abort",r);o.src=""};o.addEventListener("canplaythrough",n);o.addEventListener("loadeddata",n);o.addEventListener("error",r);o.addEventListener("abort",r);setTimeout((()=>{if(!s){console.warn("视频预加载超时:",t);r("timeout")}}),15e3);o.load()}))}async sequentialPreloadVideos(t){if(!t||t.length===0){return}const e=t.filter((t=>t&&t.trim()));if(e.length===0){return}e.forEach(((t,e)=>{t.split("/").pop()||t}));for(let t=0;t<e.length;t++){const i=e[t];const o=i.split("/").pop()||i;try{await this.preloadVideo(i)}catch(i){console.warn(`❌ [${t+1}/${e.length}] 预加载失败: ${o.substring(0,50)}${o.length>50?"...":""}`,i)}}}handleVideoUrlReceivedSequential(t,e=""){if(!t||t.length===0)return;const i=t.filter((t=>t&&t.trim()));if(i.length===0)return;this.sequentialPreloadVideos(i).catch((t=>{console.warn(`⚠️ 顺序预加载视频失败 (${e}):`,t)}))}handlePageResume(){if(this.isTaskCompleted||!this.isOpen||this.isEndingInterview){return}console.log("页面恢复可见,检查流程状态:",{waitingForDigitalHuman:this.waitingForDigitalHuman,isPlayingDigitalHumanVideo:this.isPlayingDigitalHumanVideo,waitingToRecord:this.waitingToRecord,isRecording:this.isRecording,showRecordingUI:this.showRecordingUI});if(this.isPlayingDigitalHumanVideo){const t=this.hostElement.shadowRoot?.querySelector(".digital-human-background-video");if(t){const e=t.play();if(e){e.catch((()=>{console.warn("恢复数字人视频播放失败,跳过视频");this.skipDigitalHumanVideo()}))}setTimeout((()=>{if(this.isPlayingDigitalHumanVideo){console.warn("数字人视频恢复后3秒仍未结束,强制跳过");this.skipDigitalHumanVideo()}}),3e3)}else{this.skipDigitalHumanVideo()}return}if(this.waitingForDigitalHuman&&!this.isPlayingDigitalHumanVideo){console.warn("检测到waitingForDigitalHuman卡住(视频未在播放),直接开始录制流程");this.waitingForDigitalHuman=false;this.startWaitingToRecord();return}if(this.isRecording&&this.recordingStream){const t=this.recordingStream.getTracks();const e=t.length>0&&t.every((t=>t.readyState==="ended"));if(e){console.warn("检测到录制的MediaStream已被系统回收,停止录制");this.deviceError="设备被系统中断,请重新录制";this.stopRecording()}}}skipDigitalHumanVideo(){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl;this.isPlayingDigitalHumanVideo=false;this.isPlayingWelcomeVideo=false;if(this.waitingForDigitalHuman&&!this.isTaskCompleted&&!this.isEndingInterview){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}handleVideoElementEnded=async()=>{if(this.isPlayingDigitalHumanVideo){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl;this.isPlayingDigitalHumanVideo=false;const t=this.isPlayingWelcomeVideo;this.isPlayingWelcomeVideo=false;if(t&&this.pendingGeneratedVideoUrl){const t=this.pendingGeneratedVideoUrl;this.pendingGeneratedVideoUrl="";await this.playDigitalHumanVideo(t);return}if(this.waitingForDigitalHuman&&!this.isTaskCompleted&&!this.isEndingInterview&&!t){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}};handleInterviewEnd=()=>{if(this.isEndingInterview||this.isTaskCompleted){return}this.showEndInterviewConfirmModal=true};handleConfirmEndInterview=async()=>{try{this.showEndInterviewConfirmModal=false;this.isEndingInterview=true;if(this.waitingTimer){clearInterval(this.waitingTimer);this.waitingTimer=null}this.waitingToRecord=false;this.waitingForDigitalHuman=false;if(this.isRecording){this.stopRecording()}else{await this.sendEndInterviewMessage()}}catch(t){console.error("点击结束发送消息失败:",t);this.isEndingInterview=false;g.captureError(t,{action:"handleConfirmEndInterview",component:"components-oem-virtual-chat-modal",title:"点击结束发送消息失败"});p.emitError({error:t,message:"点击结束发送消息失败"})}};sendEndInterviewMessage=async()=>{try{const t="请结束面试";console.log("面试结束消息已发送:",{conversation_id:this.conversationId,message:t});await this.sendMessageToAPI(t);this.isEndingInterview=false}catch(t){console.error("发送结束面试消息失败:",t);this.isEndingInterview=false;throw t}};handleCancelEndInterview=()=>{this.showEndInterviewConfirmModal=false};getAnsweredQuestionCount=()=>this.messages.filter((t=>t.answer&&t.answer.trim())).length;renderChatHistory(){if(this.isPlayingWelcomeVideo){const t=Math.max(0,Math.min(2,this.openingIndex||0));const e=this.digitalHumanOpeningContents[t]||this.digitalHumanOpeningContents[0];const i=e.text;return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content"},i))}if(this.isGeneratingDigitalHumanVideo||this.isLoading){return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content"},"请稍等,我查看一下本次面试的信息..."))}if(this.currentStreamingMessage&&this.currentStreamingMessage.answer){return o("div",{class:"ai-message-item streaming"},o("div",{class:"ai-message-content",innerHTML:this.currentStreamingMessage.answer}),this.currentStreamingMessage.isStreaming&&o("div",{class:"typing-indicator"},o("span",null),o("span",null),o("span",null)))}const t=[...this.messages].reverse().find((t=>t.answer&&t.answer.trim()));if(t){return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content",innerHTML:t.answer}))}return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content"},"请稍等,我查看一下本次面试的信息..."))}render(){if(!this.isOpen)return null;const t={zIndex:String(this.zIndex)};const e={"modal-container":true,fullscreen:this.fullscreen,"digital-human-mode":!!this.digitalId};const i={"modal-overlay":true,"fullscreen-overlay":this.fullscreen};return o("div",{class:i,style:t},o("div",{class:e},o("button",{class:"close-button",onClick:this.handleCloseClick},o("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},o("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}))),this.digitalId&&this.digitalHumanVideoUrl&&o("div",{class:"digital-human-background"},o("video",{autoplay:true,playsinline:true,loop:!this.isPlayingDigitalHumanVideo,muted:!this.isPlayingDigitalHumanVideo,src:this.digitalHumanVideoUrl,class:"digital-human-background-video",onEnded:this.handleVideoElementEnded,onPlay:t=>{const e=t.target;const i=this.digitalHumanVideoUrl===this.digitalHumanDefaultVideoUrl;e.playbackRate=i?1:this.playbackRate},ref:t=>{if(t){const e=this.digitalHumanVideoUrl===this.digitalHumanDefaultVideoUrl;t.playbackRate=e?1:this.playbackRate;if(t.src&&t.readyState===0){t.load()}}}})),this.renderVideoPreview(),o("div",{class:"modal-content-layer"},o("div",{class:"main-content"},o("div",{class:"chat-history-section"},this.renderChatHistory()),this.showEndInterviewButton&&!this.isTaskCompleted&&this.conversationId&&o("div",{class:"end-interview-button-container"},o("button",{class:"end-interview-button",onClick:this.handleInterviewEnd,disabled:this.isEndingInterview||!this.isRecording,title:this.isEndingInterview?"正在结束面试...":!this.isRecording?"请在录制时点击":"结束面试"},this.isEndingInterview?"正在结束...":"结束面试")),this.renderRecordingStatusBar())),o("div",{style:{position:"relative",zIndex:"100"}},o("components-confirm-modal",{isOpen:this.showConfirmModal,modalTitle:"确认完成回答?",okText:"确认完成",cancelText:"继续录制",okType:"danger",onOk:this.handleConfirmModalOk,onCancel:this.handleConfirmModalCancelEvent,onClosed:this.handleConfirmModalCancel},o("div",{style:{marginBottom:"16px"}},o("div",{style:{fontSize:"14px",color:"#1890ff",fontWeight:"500",marginBottom:"16px",textAlign:"center"}},"当前录制时长:",(()=>{const t=this.recordingStartTime>0?Math.floor((Date.now()-this.recordingStartTime)/1e3):0;const e=Math.floor(t/60);const i=t%60;return`${e.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`})()),o("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",background:"#fff7e6",border:"1px solid #ffec99",borderRadius:"6px",color:"#d46b08",fontSize:"14px",marginBottom:"16px"}},o("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},o("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})),o("span",null,"注意:录制仍在进行中")),o("div",{style:{fontSize:"16px",color:"#595959",lineHeight:"1.5",marginBottom:"16px"}},'点击"确认完成"将结束本题回答'),o("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",padding:"8px 0",userSelect:"none"}},o("input",{type:"checkbox",style:{width:"16px",height:"16px",accentColor:"#1890ff",cursor:"pointer",margin:"0"},checked:this.skipConfirmThisInterview,onChange:this.handleSkipConfirmChange}),o("span",{style:{fontSize:"14px",color:"#595959",cursor:"pointer",lineHeight:"1.4"}},"本次面试不再提醒"))))),o("div",{style:{position:"relative",zIndex:"100"}},o("components-confirm-modal",{isOpen:this.showCloseConfirmModal,modalTitle:"确认关闭?",okText:"确认关闭",cancelText:"取消",okType:"danger",onOk:this.handleCloseConfirmOk,onCancel:this.handleCloseConfirmCancel,onClosed:this.handleCloseConfirmCancel},o("div",{style:{marginBottom:"16px"}},o("div",{style:{fontSize:"16px",color:"#595959",lineHeight:"1.5",marginBottom:"16px"}},this.isTaskCompleted?"面试已结束,确认要关闭吗?":"您的面试未完成,确认要关闭吗?")))),o("div",{style:{position:"relative",zIndex:"100"}},o("components-confirm-modal",{isOpen:this.showEndInterviewConfirmModal,modalTitle:"确认结束面试?",okText:"确认结束",cancelText:"取消",okType:"danger",onOk:this.handleConfirmEndInterview,onCancel:this.handleCancelEndInterview,onClosed:this.handleCancelEndInterview},o("div",{style:{marginBottom:"16px"}},(()=>{const t=this.getAnsweredQuestionCount();return o("div",null,o("div",{style:{fontSize:"14px",color:"#1890ff",fontWeight:"500",marginBottom:"16px",textAlign:"center"}},"当前第 ",t," 题"),t<3&&o("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"12px 16px",background:"#fff2e8",border:"1px solid #ffbb96",borderRadius:"6px",color:"#d4380d",fontSize:"14px",marginBottom:"16px"}},o("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",style:{flexShrink:"0",marginTop:"2px"}},o("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})),o("span",null,o("strong",null,"警告:"),"当前已回答题数小于 3 题,结束面试可能无法正常完成面试流程,建议继续完成更多题目后再结束面试。")),o("div",{style:{fontSize:"14px",color:"#595959",lineHeight:"1.6",textAlign:"center"}},"确认要结束面试吗?结束后将生成面试报告。"))})())))))}renderVideoPreview(){if(!this.showRecordingUI){return null}return o("div",{class:"recording-preview-top-right"},o("video",{class:"user-video-preview",autoPlay:true,playsInline:true,muted:true,style:{transform:"scaleX(-1)"},ref:t=>{if(t&&this.recordingStream&&!this.videoRef){this.videoRef=t}}}))}renderRecordingStatusBar(){if(this.showRecordingUI){const t=Math.floor(this.recordingTimeLeft/60).toString().padStart(2,"0");const e=(this.recordingTimeLeft%60).toString().padStart(2,"0");return o("div",{class:"recording-status-bar"},o("div",{class:"audio-waveform"},o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"})),o("span",{class:"recording-timer"},t,":",e),o("button",{class:"finish-recording-btn",onClick:()=>this.handleStopRecording()},o("img",{src:"https://pcm-resource-1312611446.cos.ap-guangzhou.myqcloud.com/sdk/icon/gou.png",width:"16",height:"16",alt:"完成",style:{filter:"brightness(0) invert(1)"}})))}return o("div",{class:"recording-status-bar"},this.renderStatusIndicator())}renderStatusIndicator(){if(this.deviceError){return o("div",{class:"status-indicator-text error"},o("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},o("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})),o("span",null,this.deviceError))}if(this.isTaskCompleted){return o("div",{class:"status-indicator-text"},o("span",null,"面试已完成"))}if(this.waitingForDigitalHuman&&this.digitalId){return o("div",{class:"status-indicator-text loading"},o("div",{class:"loading-spinner-small"}),o("span",null,"面试官思考中..."))}if(this.isUploadingVideo){return o("div",{class:"status-indicator-text loading"},o("div",{class:"loading-spinner-small"}),o("span",null,"正在提交回答..."))}if(this.isLoading||this.currentStreamingMessage){return o("div",{class:"status-indicator-text loading"},o("div",{class:"loading-spinner-small"}),o("span",null,"题目生成中..."))}if(this.waitingToRecord){return o("div",{class:"status-indicator-text"},o("span",null,this.waitingTimeLeft," 秒后开始您的回答"))}return o("div",{class:"status-indicator-text ready"},o("img",{src:"https://pcm-resource-1312611446.cos.ap-guangzhou.myqcloud.com/sdk/icon/gou.png",width:"16",height:"16",alt:"准备就绪"}),o("span",null,"准备就绪"))}static get watchers(){return{token:["handleTokenChange"]}}};x.style=m+u;export{x as components_oem_virtual_chat_modal};
2
- //# sourceMappingURL=p-5ca45877.entry.js.map
1
+ import{r as t,c as e,a as i,h as o}from"./p-DA8Myhft.js";import{a as s,f as n,b as r,s as a,g as l,u as d,d as c}from"./p-B3osOuvR.js";import{s as h}from"./p-DnoxSHNP.js";import{E as p}from"./p-C0FYX2-Z.js";import{c as f}from"./p-C7m_4Gmk.js";import{S as g}from"./p-B23366TU.js";import"./p-Bs-zO1WZ.js";const m=':host{display:block;font-size:16px}.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:hidden;padding:0;z-index:1000}.fullscreen-overlay{padding:0;position:absolute;width:100%;height:100%}.modal-container{background:#fff;border-radius:0;width:100%;height:100%;display:flex;flex-direction:column;position:relative;margin:0;overflow:hidden}.modal-container.fullscreen{width:100%;max-width:none;height:100%;border-radius:0;margin:0;display:flex;flex-direction:column;max-height:100%}.digital-human-background{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;overflow:hidden;display:flex;justify-content:center}.digital-human-background-video{width:100%;height:100%;object-fit:cover;object-position:center;max-width:1200px}.modal-container:not(.digital-human-mode){background:white;border-radius:8px;width:100%;max-width:900px;height:90vh;max-height:800px}.modal-content-layer{position:relative;z-index:10;height:100%;display:flex;flex-direction:column;background:linear-gradient(\r\n 180deg,\r\n rgba(0, 0, 0, 0.3) 0%,\r\n rgba(0, 0, 0, 0.1) 20%,\r\n rgba(0, 0, 0, 0.1) 80%,\r\n rgba(0, 0, 0, 0.4) 100%\r\n )}.main-content{display:flex;flex-direction:column;align-items:center;overflow:hidden;padding:24px 24px 40px 24px;position:absolute;bottom:0px;width:-webkit-fill-available}.chat-history-section{width:100%;max-width:1240px;text-align:center;color:white}.ai-message-item{padding:12px 20px;border-radius:12px;margin-bottom:12px;animation:fadeIn 0.5s ease-in-out}.recording-preview-top-right{position:absolute;top:20px;right:20px;width:180px;height:120px;border-radius:12px;overflow:hidden;border:2px solid rgba(255, 255, 255, 0.5);box-shadow:0 4px 12px rgba(0, 0, 0, 0.3);background-color:#000;z-index:10}.user-video-preview{width:100%;height:100%;object-fit:cover}.recording-status-bar{display:flex;align-items:center;justify-content:space-between;background-color:white;padding:8px 12px;border-radius:999px;margin-top:4px;width:100%;max-width:400px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.1);animation:slideInUp 0.5s ease-out;line-height:40px}.audio-waveform{display:flex;align-items:center;height:24px}.waveform-bar{width:4px;margin:0 2px;background-color:#16a34a;border-radius:2px;height:6px;animation:waveform-animation 1.2s infinite ease-in-out}.waveform-bar:nth-child(1){animation-delay:0.1s}.waveform-bar:nth-child(2){animation-delay:0.3s}.waveform-bar:nth-child(3){animation-delay:0.5s}.waveform-bar:nth-child(4){animation-delay:0.2s}.waveform-bar:nth-child(5){animation-delay:0.4s}.waveform-bar:nth-child(6){animation-delay:0.1s}.waveform-bar:nth-child(7){animation-delay:0.3s}.waveform-bar:nth-child(8){animation-delay:0.5s}@keyframes waveform-animation{0%,100%{height:6px}50%{height:35px}}.recording-timer{font-size:14px;color:#595959;font-family:\'Courier New\', Courier, monospace}.finish-recording-btn{background-color:#16a34a;border:none;border-radius:50%;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);transition:background-color 0.3s,\r\n transform 0.2s}.finish-recording-btn:hover{background-color:#148a3f}.finish-recording-btn:active{transform:scale(0.95)}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes slideInUp{from{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}.status-indicator-text{display:flex;align-items:center;gap:8px;font-size:14px;color:#595959;width:100%;justify-content:center}.status-indicator-text.loading .loading-spinner-small{width:16px;height:16px;border:2px solid rgba(0, 0, 0, 0.1);border-top-color:#595959;border-radius:50%;animation:spin 0.8s linear infinite}.status-indicator-text.error{color:#ff4d4f}.status-indicator-text.ready{color:#16a34a}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.loading-spinner-small{width:20px;height:20px;border:2px solid #e5e7eb;border-top-color:#6b7280;border-radius:50%;animation:spin 0.8s 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}.recording-section{border-top:1px solid #eee;display:flex;flex-direction:column;align-items:center;padding:10px 20px 0px 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:14px;z-index:0}.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:16px;background-color:#0d75fb;border-radius:6px;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:16px}.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}.text-input-area{display:flex;flex-direction:column;width:100%;height:100%;padding:0px 16px 16px 16px;border-radius:8px;border:none;}.text-answer-input{flex:1;min-height:80px;padding:12px 12px 0px 12px;border:1px solid #ddd;border-radius:8px 8px 0 0;resize:none;font-size:16px;background-color:#fff;border-bottom:none;outline:none;}.input-toolbar{display:flex;justify-content:flex-end;align-items:center;padding:8px 12px;background-color:#fff;border:1px solid #ddd;border-top:none;border-radius:0 0 8px 8px}.text-answer-input:focus{border-color:rgb(74, 144, 226);border-bottom:none}.text-answer-input:focus+.input-toolbar{border-color:rgb(74, 144, 226);border-top:none}.toolbar-actions{width:32px;height:32px;display:flex;justify-content:center;align-items:center;margin-right:10px;border:1px solid #d9d9d9;border-radius:6px}.toolbar-actions:hover{background-color:#f0f0f0}.toolbar-button{background:transparent;border:none;color:#666;cursor:pointer;padding:0;margin:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.toolbar-button>div,.toolbar-button>svg{display:flex;justify-content:center;align-items:center}.submit-text-button{padding:6px 16px;background-color:#4a90e2;color:white;border:none;border-radius:4px;font-size:14px;font-weight:500;cursor:pointer;transition:background-color 0.2s}.submit-text-button:hover:not(.disabled){background-color:#3a7bc8}.submit-text-button.disabled{background-color:#b3b3b3;cursor:not-allowed}.toolbar-button.recording{background-color:rgba(255, 0, 0, 0.1);color:#ff3b30;animation:pulse 1.5s infinite}.toolbar-button.converting{background-color:rgba(0, 122, 255, 0.1);color:#007aff}.toolbar-button .recording-time{font-size:12px;margin-left:4px}.converting-indicator{display:flex;justify-content:center;align-items:center}.converting-indicator svg{animation:spin 1.5s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(255, 0, 0, 0.4)}70%{box-shadow:0 0 0 6px rgba(255, 0, 0, 0)}100%{box-shadow:0 0 0 0 rgba(255, 0, 0, 0)}}@media screen and (max-width: 768px){.pc-layout{width:95%}.modal-overlay{padding:0}.modal-container.fullscreen{width:100%;height:100%;max-height:100%;border-radius:16px 16px 0 0;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}}.workspace-section{width:100%;padding:0px 16px 16px}.workspace-toolbar{display:flex;justify-content:space-between;align-items:end;gap:12px;position:relative}.workspace-button{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #d9d9d9;border-radius:6px;background:white;color:#666;font-size:14px;cursor:pointer;transition:all 0.2s ease;box-shadow:0 1px 2px rgba(0, 0, 0, 0.05)}.workspace-button:hover{border-color:#4096ff;color:#4096ff;box-shadow:0 2px 4px rgba(64, 150, 255, 0.1)}.workspace-button svg{flex-shrink:0}.digital-human-wrapper{display:flex;align-items:center;justify-content:center;width:120px;height:80px;border:1px solid #d9d9d9;border-radius:8px;background:#fafafa;overflow:hidden;position:absolute;right:0px}.history-drawer-content{height:100%;display:flex;flex-direction:column}.conversation-list{flex:1;overflow-y:auto;padding:8px 0}.loading-conversations,.empty-conversations{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 20px;color:#999}.loading-conversations .loading-spinner-small{margin-bottom:12px}.conversation-item{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;margin:0 8px 4px 8px;border-radius:8px;cursor:pointer;transition:all 0.2s ease;border:1px solid transparent}.conversation-item:hover{background:#f5f5f5}.conversation-item.active{background:#e6f7ff;border-color:#1890ff}.conversation-info{flex:1;min-width:0}.conversation-title{font-size:14px;font-weight:500;color:#262626;margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.conversation-meta{display:flex;align-items:center;gap:8px;font-size:12px;color:#8c8c8c}.conversation-time{flex-shrink:0}.message-count{flex-shrink:0}.conversation-status{padding:2px 6px;border-radius:4px;font-size:11px;font-weight:500}.conversation-status.completed{background:#f6ffed;color:#52c41a}.conversation-status.running{background:#fff7e6;color:#fa8c16}.current-indicator{flex-shrink:0;color:#1890ff;margin-left:8px}.ai-message-item{box-sizing:border-box;margin:0 auto;animation:messageSlideIn 0.3s ease-out;width:100%;padding:40px}.ai-message-item.streaming{position:relative}@keyframes messageSlideIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.ai-message-content{box-sizing:border-box;color:#fff;padding:40px 48px;border-radius:32px;font-family:"Microsoft YaHei", "PingFang SC", sans-serif;font-size:32px;font-weight:500;line-height:1.6;word-wrap:break-word;backdrop-filter:blur(100px);border:1px solid rgba(255, 255, 255, 0.2);box-shadow:0 4px 20px rgba(0, 0, 0, 0.2);margin-bottom:16px;max-width:100%;text-align:left}.typing-indicator{display:flex;align-items:center;gap:8px;padding:16px 48px;margin-top:-16px}.typing-indicator span{width:16px;height:16px;border-radius:50%;background:#4facfe;animation:typingPulse 1.4s ease-in-out infinite;opacity:0.6}.typing-indicator span:nth-child(1){animation-delay:0s}.typing-indicator span:nth-child(2){animation-delay:0.2s}.typing-indicator span:nth-child(3){animation-delay:0.4s}@keyframes typingPulse{0%,60%,100%{transform:scale(1);opacity:0.4}30%{transform:scale(1.3);opacity:1}}@media screen and (max-width: 768px){.ai-message-item{padding:30px}.ai-message-content{padding:32px 40px;font-size:30px}.typing-indicator{padding:12px 40px}}@media screen and (max-width: 480px){.ai-message-item{padding:0}.ai-message-content{padding:28px 36px;font-size:28px;line-height:1.5}.typing-indicator{padding:10px 36px}.typing-indicator span{width:12px;height:12px}}.waveform-bar{width:3px;background:#4facfe;border-radius:2px;min-height:2px;animation:waveformAnimation 1.2s ease-in-out infinite alternate;transform-origin:bottom}@keyframes waveformAnimation{0%{transform:scaleY(0.2)}100%{transform:scaleY(1)}}.recording-timer{font-size:14px;color:#666;white-space:nowrap}.close-button{position:absolute;top:16px;left:16px;z-index:20;background:rgba(255, 255, 255, 0.9);backdrop-filter:blur(4px);border:1px solid rgba(0, 0, 0, 0.1);border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px rgba(0, 0, 0, 0.1)}.close-button:hover{background:rgba(255, 255, 255, 1);border-color:rgba(0, 0, 0, 0.15);box-shadow:0 4px 12px rgba(0, 0, 0, 0.15);transform:translateY(-1px)}.close-button:active{transform:translateY(0);box-shadow:0 2px 6px rgba(0, 0, 0, 0.1)}.close-button svg{color:#666;transition:color 0.2s ease}.close-button:hover svg{color:#333}.end-interview-button-container{display:flex;align-items:center;justify-content:flex-start;width:100%;max-width:400px;margin-bottom:4px;padding-left:0}.end-interview-button{padding:5px 10px;background-color:#ff4d4f;color:white;border:none;border-radius:20px;font-size:14px;font-weight:500;cursor:pointer;transition:all 0.3s ease;box-shadow:0 2px 8px rgba(255, 77, 79, 0.3);white-space:nowrap}.end-interview-button:hover{background-color:#ff7875;box-shadow:0 4px 12px rgba(255, 77, 79, 0.4);transform:translateY(-1px)}.end-interview-button:active{transform:translateY(0);box-shadow:0 2px 8px rgba(255, 77, 79, 0.3)}.end-interview-button:disabled{background-color:#f0f0f0;color:#bfbfbf;cursor:not-allowed;box-shadow:none;transform:none}';const u=":host{font-size:16px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;font-weight:normal;font-style:normal;font-variant:normal;line-height:1.5;letter-spacing:normal;word-spacing:normal;color:#333;text-align:left;text-indent:0;text-transform:none;white-space:normal;word-wrap:normal;word-break:normal;visibility:visible;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;border-collapse:separate;border-spacing:0;caption-side:top;empty-cells:show;table-layout:auto;quotes:auto;cursor:auto;direction:ltr;orphans:2;widows:2;page-break-inside:auto;text-decoration:none;text-shadow:none;box-sizing:border-box;writing-mode:horizontal-tb;text-orientation:mixed}";const x=class{constructor(i){t(this,i);this.streamComplete=e(this,"streamComplete");this.conversationStart=e(this,"conversationStart");this.interviewComplete=e(this,"interviewComplete");this.recordingError=e(this,"recordingError");this.recordingStatusChange=e(this,"recordingStatusChange");this.tokenInvalid=e(this,"tokenInvalid");this.modalClosed=e(this,"modalClosed")}token;isOpen=false;messages=[];zIndex;conversationId;isLoading=false;currentStreamingMessage=null;isLoadingHistory=false;get hostElement(){return i(this)}streamComplete;conversationStart;defaultQuery="你好!聘才猫";maxRecordingTime=120;countdownWarningTime=30;isRecording=false;recordingStream=null;recordedBlob=null;mediaRecorder=null;recordingTimeLeft=0;showRecordingUI=false;recordingTimer=null;recordingStartTime=0;waitingToRecord=false;waitingTimer=null;_visibilityChangeHandler=null;waitingTimeLeft=10;videoRef=null;currentQuestionNumber=0;interviewComplete;showCountdownWarning=false;fullscreen=false;isUploadingVideo=false;digitalHumanVideoUrl="";digitalHumanDefaultVideoUrl="";virtualmanKey="";isPlayingDigitalHumanVideo=false;digitalHumanVideoReady=false;digitalHumanOpeningContents=[];isPlayingWelcomeVideo=false;isGeneratingDigitalHumanVideo=false;pendingGeneratedVideoUrl="";preloadedVideos=new Set;preloadingVideos=new Map;waitingForDigitalHuman=false;digitalId;openingIndex=0;waitingTime=10;playbackRate=1;showEndInterviewButton=false;recordingError;recordingStatusChange;tokenInvalid;modalClosed;customInputs={};botId;agentLogo="";isTaskCompleted=false;tokenInvalidListener;deviceError=null;showConfirmModal=false;skipConfirmThisInterview=false;showCloseConfirmModal=false;showEndInterviewConfirmModal=false;isEndingInterview=false;isComponentActive=true;handleTokenChange(t){if(t&&t!==s.getToken()){s.setToken(t)}}async setComponentActive(t){this.isComponentActive=t}componentWillLoad(){if(this.zIndex){f.setItem("modal-zIndex",this.zIndex)}else{const t=f.getItem("modal-zIndex");if(t){this.zIndex=t}else{this.zIndex=1e3;f.setItem("modal-zIndex",1e3)}}if(this.token){s.setToken(this.token)}this.tokenInvalidListener=()=>{this.tokenInvalid.emit()};document.addEventListener("pcm-token-invalid",this.tokenInvalidListener);this._visibilityChangeHandler=()=>{if(document.visibilityState==="visible"){this.handlePageResume()}};document.addEventListener("visibilitychange",this._visibilityChangeHandler);if(!this.customInputs){this.customInputs={}}if(this.botId){this.fetchAgentLogo()}console.log("componentWillLoad - 数字人相关状态:",{digitalId:this.digitalId,isOpen:this.isOpen,conversationId:this.conversationId,virtualmanKey:this.virtualmanKey});if(this.isOpen){if(this.conversationId){setTimeout((()=>this.loadHistoryMessages()),0)}else{if(this.digitalId){this.initializeDigitalHuman()}setTimeout((()=>{this.sendMessageToAPI(this.defaultQuery)}),0)}}}async fetchAgentLogo(){if(!this.botId)return;try{const t=await n(this.botId);if(t&&t.logo){this.agentLogo=t.logo}}catch(t){g.captureError(t,{action:"fetchAgentLogo",component:"components-oem-virtual-chat-modal",title:"获取智能体信息失败"});p.emitError({error:t,message:"获取智能体信息失败"})}}async sendMessageToAPI(t,e){if(this.isTaskCompleted&&!this.isEndingInterview){return}this.waitingForDigitalHuman=false;this.digitalHumanVideoReady=false;this.isLoading=true;let i="";let o="";const s=new Date;const n=`${s.getHours()}:${s.getMinutes().toString().padStart(2,"0")}`;const a=t.trim()||"请开始";if(e){this.customInputs={...this.customInputs,video_url:e}}if(!this.customInputs.url_callback){this.customInputs={...this.customInputs,url_callback:"https://tagents.ylzhaopin.com/agents/api/test/callback"}}const l={id:`temp-${Date.now()}`,conversation_id:this.conversationId,inputs:this.customInputs||{},query:a,answer:"",message_files:[],feedback:{},retriever_resources:[],created_at:Math.floor(Date.now()/1e3).toString(),agent_thoughts:[],status:"normal",error:null,time:n,isStreaming:true};this.currentStreamingMessage=l;const d={response_mode:"streaming",conversation_id:this.conversationId,query:a,bot_id:this.botId};d.inputs={...this.customInputs};await r({url:"/sdk/v1/chat/chat-messages",method:"POST",data:d,onMessage:t=>{if(t.conversation_id&&!this.conversationId){this.conversationId=t.conversation_id;this.conversationStart.emit({conversation_id:t.conversation_id,event:t.event,message_id:t.message_id,id:t.id})}if(t.event==="node_finished"&&t.data.inputs&&t.data.inputs.LLMText){o=t.data.inputs.LLMText}if(t.event==="node_finished"&&t.data.title&&t.data.title.includes("聘才猫任务结束")){this.isTaskCompleted=true;const t=o||i||this.currentStreamingMessage?.answer||"";this.interviewComplete.emit({conversation_id:this.conversationId,current_question_number:this.currentQuestionNumber,ai_response:t})}if(t.event==="node_finished"&&t.data.title&&t.data.title.includes("聘才猫数字人题目")){const e=JSON.parse(t.data.process_data.digital_human_list);this.precreateDigitalHumanVideos(e)}if(t.event==="error"){const e=t.data?.message||t.message||"请求失败";this.messages=[...this.messages,{...l,answer:e,error:t.data,isStreaming:false}];this.currentStreamingMessage=null;this.isLoading=false;p.emitError({error:t.data,message:e});return}if(t.event==="message"){if(t.event==="agent_message"||t.event==="message"){if(t.answer){i+=t.answer;const e={...this.currentStreamingMessage,answer:i,id:t.message_id||this.currentStreamingMessage.id,isStreaming:true,retriever_resources:t.retriever_resources||this.currentStreamingMessage.retriever_resources,agent_thoughts:t.agent_thoughts||this.currentStreamingMessage.agent_thoughts};this.currentStreamingMessage=e}}}if(t.event==="message_end"){this.streamComplete.emit({conversation_id:t.conversation_id||"",event:t.event,message_id:t.message_id,id:t.id})}},onError:t=>{console.error("发生错误:",t);p.emitError({error:t,message:"消息发送失败,请稍后再试"});g.captureError(t,{action:"sendMessageToAPI",component:"components-oem-virtual-chat-modal",title:"消息发送失败"});this.messages=[...this.messages,{...l,answer:"消息发送失败,请检查网络。",error:t,isStreaming:false}];this.currentStreamingMessage=null;this.isLoading=false},onComplete:async()=>{this.isLoading=false;if(this.currentQuestionNumber===0){setTimeout((()=>{if(this.customInputs){delete this.customInputs.job_info;delete this.customInputs.file_url;delete this.customInputs.file_name}}),1e3)}const t=this.currentStreamingMessage;t.isStreaming=false;if(this.digitalId&&t&&t.answer){this.generateDigitalHumanVideo(t.answer)}this.currentStreamingMessage=null;this.messages=[...this.messages,t];this.currentQuestionNumber++;if(this.isTaskCompleted||this.isEndingInterview){return}if(this.digitalId){this.waitingForDigitalHuman=true}}})}async loadHistoryMessages(){if(!this.conversationId)return;this.isLoadingHistory=true;let t=false;this.digitalHumanVideoReady=true;try{const e=await a({url:`/sdk/v1/chat/conversation`,method:"GET",data:{conversation_id:this.conversationId}});if(e.success&&e.data&&e.data.run_status=="结束"){t=true}const i=await a({url:"/sdk/v1/chat/messages",method:"GET",data:{conversation_id:this.conversationId,bot_id:this.botId,limit:20}});if(i.success&&i.data){const t=i.data.data||[];const e=t.map((t=>{const e=new Date(parseInt(t.created_at)*1e3);const i=e.getHours().toString().padStart(2,"0");const o=e.getMinutes().toString().padStart(2,"0");const s=`${i}:${o}`;return{id:t.id,conversation_id:t.conversation_id,inputs:t.inputs||{},query:t.query||"",answer:t.answer||"",message_files:t.message_files||[],feedback:t.feedback||{},retriever_resources:t.retriever_resources||[],created_at:t.created_at,agent_thoughts:t.agent_thoughts||[],status:t.status||"normal",error:t.error,time:s,isStreaming:false}}));this.messages=e;this.currentQuestionNumber=e.length||0}}catch(t){console.error("加载历史消息或会话状态失败:",t);g.captureError(t,{action:"loadHistoryMessages",component:"components-oem-virtual-chat-modal",title:"加载历史消息失败"});p.emitError({error:t,message:"加载历史消息失败,请刷新重试"})}finally{this.isLoadingHistory=false;if(this.conversationId&&this.messages.length>0&&!t&&!this.isEndingInterview){this.isPlayingDigitalHumanVideo=false;this.isPlayingWelcomeVideo=false;this.digitalHumanVideoReady=true;this.initializeDigitalHuman().then((()=>{if(this.digitalHumanDefaultVideoUrl){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl}}));setTimeout((()=>{this.startWaitingToRecord()}),200)}else if(t){this.isTaskCompleted=true;if(this.digitalId){this.isPlayingDigitalHumanVideo=false;this.isPlayingWelcomeVideo=false;this.digitalHumanVideoReady=true;this.initializeDigitalHuman().then((()=>{if(this.digitalHumanDefaultVideoUrl){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl}}))}}}}startWaitingToRecord(){if(this.isTaskCompleted||this.isEndingInterview){return}if(this.waitingTimer){clearInterval(this.waitingTimer)}if(this.recordingTimer){clearInterval(this.recordingTimer)}this.waitingToRecord=true;this.waitingTimeLeft=this.waitingTime;this.waitingTimer=setInterval((()=>{this.waitingTimeLeft--;if(this.waitingTimeLeft<=0){clearInterval(this.waitingTimer);this.waitingTimer=null;this.waitingToRecord=false;this.startRecording()}}),1e3)}async startRecording(){if(this.isTaskCompleted||this.isEndingInterview){return}try{const t=await navigator.mediaDevices.getUserMedia({audio:true,video:{width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}}});this.deviceError=null;this.recordingStream=t;this.showRecordingUI=true;this.showCountdownWarning=false;this.videoRef=null;this.setupVideoPreview(t);const e=l();let i;try{i=new MediaRecorder(t,{mimeType:e,videoBitsPerSecond:8e5,audioBitsPerSecond:64e3})}catch(e){console.warn("指定的MIME类型不受支持,使用默认设置:",e);try{i=new MediaRecorder(t,{videoBitsPerSecond:8e5,audioBitsPerSecond:64e3})}catch(e){try{i=new MediaRecorder(t)}catch(t){this.recordingError.emit({type:"recorder_creation_failed",message:"无法创建媒体录制器,您的浏览器可能不支持此功能",details:t});this.showRecordingUI=false;return}}}this.mediaRecorder=i;const o=[];i.ondataavailable=t=>{if(t.data.size>0){o.push(t.data)}};i.onerror=t=>{this.recordingError.emit({type:"recording_error",message:"录制过程中发生错误",details:t});this.stopRecording()};i.onstop=()=>{try{const t=e||"video/mp4";const i=new Blob(o,{type:t});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(t){this.recordingError.emit({type:"processing_error",message:"处理录制视频时出错",details:t});this.showRecordingUI=false;g.captureError(t,{action:"uploadRecordedVideo",component:"pcm-hr-chat-modal",title:"处理录制视频时出错"})}};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(t){this.recordingError.emit({type:"start_failed",message:"开始录制失败,请检查您的设备权限",details:t});this.showRecordingUI=false;g.captureError(t,{action:"startRecording",component:"pcm-hr-chat-modal",title:"开始录制失败"});return}this.recordingTimer=setInterval((()=>{const t=Math.floor((Date.now()-this.recordingStartTime)/1e3);this.recordingTimeLeft=Math.max(0,this.maxRecordingTime-t);if(this.recordingTimeLeft<=this.countdownWarningTime&&!this.showCountdownWarning){this.showCountdownWarning=true}if(this.recordingTimeLeft<=0){this.stopRecording()}}),1e3)}catch(t){console.error("无法访问摄像头或麦克风:",t);let e="设备访问失败";if(t.name==="NotAllowedError"){e="请允许访问摄像头和麦克风权限"}else if(t.name==="NotFoundError"){e="未检测到摄像头或麦克风设备"}else if(t.name==="NotReadableError"){e="您的浏览器不支持视频录制,请切换到微信或Chrome、Edge使用"}else if(t.name==="OverconstrainedError"){e="摄像头不支持指定的配置"}else{e="无法访问摄像头或麦克风,请检查设备连接"}this.deviceError=e;this.showRecordingUI=false;p.emitError({error:t,message:e});g.captureError(t,{action:"startRecording",component:"components-oem-virtual-chat-modal",title:e})}}setupVideoPreview(t){setTimeout((()=>{const e=this.hostElement.shadowRoot?.querySelector(".user-video-preview");if(e&&t){try{e.srcObject=t;e.play().catch((t=>{console.error("视频播放失败:",t);g.captureError(t,{action:"setupVideoPreview",component:"components-oem-virtual-chat-modal",title:"视频播放失败"});p.emitError({error:t,message:"视频播放失败"})}))}catch(i){console.warn("设置srcObject失败,尝试替代方法:",i);try{const i=URL.createObjectURL(t);e.src=i;e.onended=()=>{URL.revokeObjectURL(i)}}catch(t){console.error("创建对象URL失败:",t);g.captureError(t,{action:"setupVideoPreview",component:"components-oem-virtual-chat-modal",title:"创建对象URL失败"});p.emitError({error:t,message:"创建对象URL失败"})}}}else{console.warn("未找到视频元素或媒体流无效")}}),100)}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((t=>t.stop()));this.recordingStream=null}this.videoRef=null}this.pendingGeneratedVideoUrl=""}handleStopRecording=()=>{if(this.skipConfirmThisInterview){this.stopRecording();return}this.showConfirmModal=true};handleSkipConfirmChange=t=>{const e=t.target;this.skipConfirmThisInterview=e.checked};handleConfirmModalCancel=()=>{this.showConfirmModal=false};handleConfirmModalOk=()=>{this.showConfirmModal=false;this.stopRecording()};handleConfirmModalCancelEvent=()=>{this.showConfirmModal=false};async uploadRecordedVideo(){if(!this.recordedBlob)return;try{this.isUploadingVideo=true;this.showRecordingUI=false;const t=this.recordedBlob.type.includes("webm")?"webm":"mp4";const e=`answer.${t}`;const i=new File([this.recordedBlob],e,{type:this.recordedBlob.type});const o=await d(i,{},{tags:["other"]});const s=await c(o.cos_key);if(this.isEndingInterview){await this.sendEndInterviewMessage()}else{this.sendMessageToAPI(s||"下一题",o.cos_key)}}catch(t){console.error("视频上传或处理错误:",t);this.isEndingInterview=false;g.captureError(t,{action:"uploadRecordedVideo",component:"components-oem-virtual-chat-modal",title:"视频上传或处理失败"});p.emitError({error:t,message:"视频上传或处理失败"})}finally{this.isUploadingVideo=false;this.showRecordingUI=false;this.recordedBlob=null}}handleCloseClick=()=>{this.showCloseConfirmModal=true};handleCloseConfirmOk=()=>{this.showCloseConfirmModal=false;this.stopRecording();this.modalClosed.emit()};handleCloseConfirmCancel=()=>{this.showCloseConfirmModal=false};disconnectedCallback(){document.removeEventListener("pcm-token-invalid",this.tokenInvalidListener);if(this._visibilityChangeHandler){document.removeEventListener("visibilitychange",this._visibilityChangeHandler);this._visibilityChangeHandler=null}if(this.waitingTimer){clearInterval(this.waitingTimer);this.waitingTimer=null}if(this.recordingTimer){clearInterval(this.recordingTimer);this.recordingTimer=null}this.stopRecording();this.preloadedVideos.clear();this.preloadingVideos.clear();this.pendingGeneratedVideoUrl=""}async precreateDigitalHumanVideos(t){if(!this.virtualmanKey){console.warn("VirtualmanKey尚未加载,无法预创建视频。");return}for(const e of t){if(!e||!e.trim())continue;try{await a({url:"/sdk/v1/virtual-human/create-video",method:"POST",data:{VirtualmanKey:this.virtualmanKey,InputSsml:e,SpeechParam:{Speed:1},VideoParam:{Format:"TransparentWebm"},DriverType:"Text"}})}catch(t){console.error(`为文本 "${e}" 创建视频任务失败:`,t);g.captureError(t,{action:"precreateDigitalHumanVideos",component:"components-oem-virtual-chat-modal",title:`为文本 "${e}" 创建视频任务失败`})}}}async initializeDigitalHuman(){if(!this.digitalId)return;try{const t=await a({url:"/sdk/v1/virtual-human/avatar-detail",method:"POST",data:{avatar_id:this.digitalId}});if(t.success){const{placeholder_video_url:e,virtualman_key:i,opening_contents:o}=t.data;if(e){this.digitalHumanDefaultVideoUrl=e;this.digitalHumanVideoUrl=e}if(i){this.virtualmanKey=i}if(o&&Array.isArray(o)&&o.length>0){this.digitalHumanOpeningContents=o;const t=Math.max(0,Math.min(2,this.openingIndex||0));const i=this.digitalHumanOpeningContents[t]||this.digitalHumanOpeningContents[0];const s=[];if(i.video_url){s.push(i.video_url)}if(e&&e!==i.video_url){s.push(e)}this.handleVideoUrlReceivedSequential(s,"数字人初始化(顺序)");if(i.video_url&&!this.digitalHumanVideoReady){this.playDigitalHumanVideo(i.video_url,true)}}else{if(e){this.handleVideoUrlReceivedSequential([e],"数字人初始化(仅默认视频)")}}}}catch(t){console.error("初始化数字人失败:",t);g.captureError(t,{action:"initializeDigitalHuman",component:"components-oem-virtual-chat-modal",title:"数字人初始化失败"})}}async generateDigitalHumanVideo(t){if(!this.isComponentActive){console.warn("组件已停用,跳过数字人视频生成");return}if(!t.trim()||!this.virtualmanKey){if(this.waitingForDigitalHuman&&!this.isTaskCompleted){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}return}this.isGeneratingDigitalHumanVideo=true;try{const e=await a({url:"/sdk/v1/virtual-human/create-video",method:"POST",data:{VirtualmanKey:this.virtualmanKey,InputSsml:t,SpeechParam:{Speed:1},VideoParam:{Format:"TransparentWebm"},DriverType:"Text"}});if(!e.success){h(e.message,"error");throw new Error(`创建视频任务失败: ${e.message}`)}const i=e.data.Payload.TaskId;const o=await this.pollVideoProgress(i);if(!this.isComponentActive){console.warn("组件已停用,跳过视频播放");return}if(o){await this.preloadVideo(o);if(!this.isComponentActive){console.warn("组件已停用,跳过视频播放");return}if(this.isPlayingWelcomeVideo){this.pendingGeneratedVideoUrl=o}else{await this.playDigitalHumanVideo(o)}}else{throw new Error("未能获取到数字人视频URL")}}catch(t){console.error("数字人视频生成失败:",t);g.captureError(t,{action:"generateDigitalHumanVideo",component:"components-oem-virtual-chat-modal",title:"数字人视频生成失败"});if(this.waitingForDigitalHuman&&!this.isTaskCompleted){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}finally{this.isGeneratingDigitalHumanVideo=false}}async pollVideoProgress(t){const e=45;const i=2e3;for(let o=0;o<e;o++){try{const e=await a({url:"/sdk/v1/virtual-human/query-progress",method:"POST",data:{TaskId:t}});if(!e.success){throw new Error(`查询进度失败: ${e.message}`)}const o=e.data.Payload;if(o.Status==="SUCCESS"&&o.Progress===100){return o.MediaUrl}else if(o.Status==="FAILED"){throw new Error(`视频生成失败: ${o.FailMessage}`)}await new Promise((t=>setTimeout(t,i)))}catch(t){console.error("轮询视频进度失败:",t);break}}throw new Error("视频生成超时")}async playDigitalHumanVideo(t,e=false){try{await this.preloadVideo(t);this.digitalHumanVideoUrl=t;this.isPlayingDigitalHumanVideo=true;this.digitalHumanVideoReady=true;this.isPlayingWelcomeVideo=e}catch(t){console.error("播放数字人视频失败:",t);if(this.waitingForDigitalHuman&&!this.isTaskCompleted){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}}async preloadVideo(t){if(!t||!t.trim()){return Promise.resolve()}const e=t.trim();const i=e.split("/").pop()||e;if(this.preloadedVideos.has(e)){return Promise.resolve()}if(this.preloadingVideos.has(e)){return this.preloadingVideos.get(e)}const o=this.executeVideoPreload(e);this.preloadingVideos.set(e,o);try{await o;this.preloadedVideos.add(e)}catch(t){console.error(`💥 视频预加载失败: ${i.substring(0,30)}${i.length>30?"...":""}`,t)}finally{this.preloadingVideos.delete(e)}}async executeVideoPreload(t){return new Promise(((e,i)=>{const o=document.createElement("video");o.preload="auto";o.src=t;o.muted=true;o.crossOrigin="anonymous";let s=false;const n=()=>{if(s)return;s=true;a();e()};const r=e=>{if(s)return;s=true;a();console.error("视频预加载失败:",t,e);i(new Error("视频预加载失败"))};const a=()=>{o.removeEventListener("canplaythrough",n);o.removeEventListener("loadeddata",n);o.removeEventListener("error",r);o.removeEventListener("abort",r);o.src=""};o.addEventListener("canplaythrough",n);o.addEventListener("loadeddata",n);o.addEventListener("error",r);o.addEventListener("abort",r);setTimeout((()=>{if(!s){console.warn("视频预加载超时:",t);r("timeout")}}),15e3);o.load()}))}async sequentialPreloadVideos(t){if(!t||t.length===0){return}const e=t.filter((t=>t&&t.trim()));if(e.length===0){return}e.forEach(((t,e)=>{t.split("/").pop()||t}));for(let t=0;t<e.length;t++){const i=e[t];const o=i.split("/").pop()||i;try{await this.preloadVideo(i)}catch(i){console.warn(`❌ [${t+1}/${e.length}] 预加载失败: ${o.substring(0,50)}${o.length>50?"...":""}`,i)}}}handleVideoUrlReceivedSequential(t,e=""){if(!t||t.length===0)return;const i=t.filter((t=>t&&t.trim()));if(i.length===0)return;this.sequentialPreloadVideos(i).catch((t=>{console.warn(`⚠️ 顺序预加载视频失败 (${e}):`,t)}))}handlePageResume(){if(this.isTaskCompleted||!this.isOpen||this.isEndingInterview){return}console.log("页面恢复可见,检查流程状态:",{waitingForDigitalHuman:this.waitingForDigitalHuman,isPlayingDigitalHumanVideo:this.isPlayingDigitalHumanVideo,waitingToRecord:this.waitingToRecord,isRecording:this.isRecording,showRecordingUI:this.showRecordingUI});if(this.isPlayingDigitalHumanVideo){const t=this.hostElement.shadowRoot?.querySelector(".digital-human-background-video");if(t){const e=t.play();if(e){e.catch((()=>{console.warn("恢复数字人视频播放失败,跳过视频");this.skipDigitalHumanVideo()}))}setTimeout((()=>{if(this.isPlayingDigitalHumanVideo){console.warn("数字人视频恢复后3秒仍未结束,强制跳过");this.skipDigitalHumanVideo()}}),3e3)}else{this.skipDigitalHumanVideo()}return}if(this.waitingForDigitalHuman&&!this.isPlayingDigitalHumanVideo){console.warn("检测到waitingForDigitalHuman卡住(视频未在播放),直接开始录制流程");this.waitingForDigitalHuman=false;this.startWaitingToRecord();return}if(this.isRecording&&this.recordingStream){const t=this.recordingStream.getTracks();const e=t.length>0&&t.every((t=>t.readyState==="ended"));if(e){console.warn("检测到录制的MediaStream已被系统回收,停止录制");this.deviceError="设备被系统中断,请重新录制";this.stopRecording()}}}skipDigitalHumanVideo(){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl;this.isPlayingDigitalHumanVideo=false;this.isPlayingWelcomeVideo=false;if(this.waitingForDigitalHuman&&!this.isTaskCompleted&&!this.isEndingInterview){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}handleVideoElementEnded=async()=>{if(this.isPlayingDigitalHumanVideo){this.digitalHumanVideoUrl=this.digitalHumanDefaultVideoUrl;this.isPlayingDigitalHumanVideo=false;const t=this.isPlayingWelcomeVideo;this.isPlayingWelcomeVideo=false;if(t&&this.pendingGeneratedVideoUrl){const t=this.pendingGeneratedVideoUrl;this.pendingGeneratedVideoUrl="";await this.playDigitalHumanVideo(t);return}if(this.waitingForDigitalHuman&&!this.isTaskCompleted&&!this.isEndingInterview&&!t){this.waitingForDigitalHuman=false;this.startWaitingToRecord()}}};handleInterviewEnd=()=>{if(this.isEndingInterview||this.isTaskCompleted){return}this.showEndInterviewConfirmModal=true};handleConfirmEndInterview=async()=>{try{this.showEndInterviewConfirmModal=false;this.isEndingInterview=true;if(this.waitingTimer){clearInterval(this.waitingTimer);this.waitingTimer=null}this.waitingToRecord=false;this.waitingForDigitalHuman=false;if(this.isRecording){this.stopRecording()}else{await this.sendEndInterviewMessage()}}catch(t){console.error("点击结束发送消息失败:",t);this.isEndingInterview=false;g.captureError(t,{action:"handleConfirmEndInterview",component:"components-oem-virtual-chat-modal",title:"点击结束发送消息失败"});p.emitError({error:t,message:"点击结束发送消息失败"})}};sendEndInterviewMessage=async()=>{try{const t="请结束面试";console.log("面试结束消息已发送:",{conversation_id:this.conversationId,message:t});await this.sendMessageToAPI(t);this.isEndingInterview=false}catch(t){console.error("发送结束面试消息失败:",t);this.isEndingInterview=false;throw t}};handleCancelEndInterview=()=>{this.showEndInterviewConfirmModal=false};getAnsweredQuestionCount=()=>this.messages.filter((t=>t.answer&&t.answer.trim())).length;renderChatHistory(){if(this.isPlayingWelcomeVideo){const t=Math.max(0,Math.min(2,this.openingIndex||0));const e=this.digitalHumanOpeningContents[t]||this.digitalHumanOpeningContents[0];const i=e.text;return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content"},i))}if(this.isGeneratingDigitalHumanVideo||this.isLoading){return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content"},"请稍等,我查看一下本次面试的信息..."))}if(this.currentStreamingMessage&&this.currentStreamingMessage.answer){return o("div",{class:"ai-message-item streaming"},o("div",{class:"ai-message-content",innerHTML:this.currentStreamingMessage.answer}),this.currentStreamingMessage.isStreaming&&o("div",{class:"typing-indicator"},o("span",null),o("span",null),o("span",null)))}const t=[...this.messages].reverse().find((t=>t.answer&&t.answer.trim()));if(t){return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content",innerHTML:t.answer}))}return o("div",{class:"ai-message-item"},o("div",{class:"ai-message-content"},"请稍等,我查看一下本次面试的信息..."))}render(){if(!this.isOpen)return null;const t={zIndex:String(this.zIndex)};const e={"modal-container":true,fullscreen:this.fullscreen,"digital-human-mode":!!this.digitalId};const i={"modal-overlay":true,"fullscreen-overlay":this.fullscreen};return o("div",{class:i,style:t},o("div",{class:e},o("button",{class:"close-button",onClick:this.handleCloseClick},o("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},o("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}))),this.digitalId&&this.digitalHumanVideoUrl&&o("div",{class:"digital-human-background"},o("video",{autoplay:true,playsinline:true,loop:!this.isPlayingDigitalHumanVideo,muted:!this.isPlayingDigitalHumanVideo,src:this.digitalHumanVideoUrl,class:"digital-human-background-video",onEnded:this.handleVideoElementEnded,onPlay:t=>{const e=t.target;const i=this.digitalHumanVideoUrl===this.digitalHumanDefaultVideoUrl;e.playbackRate=i?1:this.playbackRate},ref:t=>{if(t){const e=this.digitalHumanVideoUrl===this.digitalHumanDefaultVideoUrl;t.playbackRate=e?1:this.playbackRate;if(t.src&&t.readyState===0){t.load()}}}})),this.renderVideoPreview(),o("div",{class:"modal-content-layer"},o("div",{class:"main-content"},o("div",{class:"chat-history-section"},this.renderChatHistory()),this.showEndInterviewButton&&!this.isTaskCompleted&&this.conversationId&&o("div",{class:"end-interview-button-container"},o("button",{class:"end-interview-button",onClick:this.handleInterviewEnd,disabled:this.isEndingInterview||!this.isRecording,title:this.isEndingInterview?"正在结束面试...":!this.isRecording?"请在录制时点击":"结束面试"},this.isEndingInterview?"正在结束...":"结束面试")),this.renderRecordingStatusBar())),o("div",{style:{position:"relative",zIndex:"100"}},o("components-confirm-modal",{isOpen:this.showConfirmModal,modalTitle:"确认完成回答?",okText:"确认完成",cancelText:"继续录制",okType:"danger",onOk:this.handleConfirmModalOk,onCancel:this.handleConfirmModalCancelEvent,onClosed:this.handleConfirmModalCancel},o("div",{style:{marginBottom:"16px"}},o("div",{style:{fontSize:"14px",color:"#1890ff",fontWeight:"500",marginBottom:"16px",textAlign:"center"}},"当前录制时长:",(()=>{const t=this.recordingStartTime>0?Math.floor((Date.now()-this.recordingStartTime)/1e3):0;const e=Math.floor(t/60);const i=t%60;return`${e.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`})()),o("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",background:"#fff7e6",border:"1px solid #ffec99",borderRadius:"6px",color:"#d46b08",fontSize:"14px",marginBottom:"16px"}},o("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor"},o("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})),o("span",null,"注意:录制仍在进行中")),o("div",{style:{fontSize:"16px",color:"#595959",lineHeight:"1.5",marginBottom:"16px"}},'点击"确认完成"将结束本题回答'),o("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",padding:"8px 0",userSelect:"none"}},o("input",{type:"checkbox",style:{width:"16px",height:"16px",accentColor:"#1890ff",cursor:"pointer",margin:"0"},checked:this.skipConfirmThisInterview,onChange:this.handleSkipConfirmChange}),o("span",{style:{fontSize:"14px",color:"#595959",cursor:"pointer",lineHeight:"1.4"}},"本次面试不再提醒"))))),o("div",{style:{position:"relative",zIndex:"100"}},o("components-confirm-modal",{isOpen:this.showCloseConfirmModal,modalTitle:"确认关闭?",okText:"确认关闭",cancelText:"取消",okType:"danger",onOk:this.handleCloseConfirmOk,onCancel:this.handleCloseConfirmCancel,onClosed:this.handleCloseConfirmCancel},o("div",{style:{marginBottom:"16px"}},o("div",{style:{fontSize:"16px",color:"#595959",lineHeight:"1.5",marginBottom:"16px"}},this.isTaskCompleted?"面试已结束,确认要关闭吗?":"您的面试未完成,确认要关闭吗?")))),o("div",{style:{position:"relative",zIndex:"100"}},o("components-confirm-modal",{isOpen:this.showEndInterviewConfirmModal,modalTitle:"确认结束面试?",okText:"确认结束",cancelText:"取消",okType:"danger",onOk:this.handleConfirmEndInterview,onCancel:this.handleCancelEndInterview,onClosed:this.handleCancelEndInterview},o("div",{style:{marginBottom:"16px"}},(()=>{const t=this.getAnsweredQuestionCount();return o("div",null,o("div",{style:{fontSize:"14px",color:"#1890ff",fontWeight:"500",marginBottom:"16px",textAlign:"center"}},"当前第 ",t," 题"),t<3&&o("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"12px 16px",background:"#fff2e8",border:"1px solid #ffbb96",borderRadius:"6px",color:"#d4380d",fontSize:"14px",marginBottom:"16px"}},o("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",style:{flexShrink:"0",marginTop:"2px"}},o("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})),o("span",null,o("strong",null,"警告:"),"当前已回答题数小于 3 题,结束面试可能无法正常完成面试流程,建议继续完成更多题目后再结束面试。")),o("div",{style:{fontSize:"14px",color:"#595959",lineHeight:"1.6",textAlign:"center"}},"确认要结束面试吗?结束后将生成面试报告。"))})())))))}renderVideoPreview(){if(!this.showRecordingUI){return null}return o("div",{class:"recording-preview-top-right"},o("video",{class:"user-video-preview",autoPlay:true,playsInline:true,muted:true,style:{transform:"scaleX(-1)"},ref:t=>{if(t&&this.recordingStream&&!this.videoRef){this.videoRef=t}}}))}renderRecordingStatusBar(){if(this.showRecordingUI){const t=Math.floor(this.recordingTimeLeft/60).toString().padStart(2,"0");const e=(this.recordingTimeLeft%60).toString().padStart(2,"0");return o("div",{class:"recording-status-bar"},o("div",{class:"audio-waveform"},o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"}),o("div",{class:"waveform-bar"})),o("span",{class:"recording-timer"},t,":",e),o("button",{class:"finish-recording-btn",onClick:()=>this.handleStopRecording()},o("img",{src:"https://pcm-resource-1312611446.cos.ap-guangzhou.myqcloud.com/sdk/icon/gou.png",width:"16",height:"16",alt:"完成",style:{filter:"brightness(0) invert(1)"}})))}return o("div",{class:"recording-status-bar"},this.renderStatusIndicator())}renderStatusIndicator(){if(this.deviceError){return o("div",{class:"status-indicator-text error"},o("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},o("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})),o("span",null,this.deviceError))}if(this.isTaskCompleted){return o("div",{class:"status-indicator-text"},o("span",null,"面试已完成"))}if(this.waitingForDigitalHuman&&this.digitalId){return o("div",{class:"status-indicator-text loading"},o("div",{class:"loading-spinner-small"}),o("span",null,"面试官思考中..."))}if(this.isUploadingVideo){return o("div",{class:"status-indicator-text loading"},o("div",{class:"loading-spinner-small"}),o("span",null,"正在提交回答..."))}if(this.isLoading||this.currentStreamingMessage){return o("div",{class:"status-indicator-text loading"},o("div",{class:"loading-spinner-small"}),o("span",null,"题目生成中..."))}if(this.waitingToRecord){return o("div",{class:"status-indicator-text"},o("span",null,this.waitingTimeLeft," 秒后开始您的回答"))}return o("div",{class:"status-indicator-text ready"},o("img",{src:"https://pcm-resource-1312611446.cos.ap-guangzhou.myqcloud.com/sdk/icon/gou.png",width:"16",height:"16",alt:"准备就绪"}),o("span",null,"准备就绪"))}static get watchers(){return{token:["handleTokenChange"]}}};x.style=m+u;export{x as components_oem_virtual_chat_modal};
2
+ //# sourceMappingURL=p-75efc351.entry.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,c as t}from"./p-C7m_4Gmk.js";const o="https://api.pincaimao.com/agents/platform";const r="https://www.pincaimao.com";const{state:n,onChange:s}=e({token:localStorage.getItem("pcm-sdk-auth-token")||null});const a={getToken:()=>n.token,setToken:e=>{n.token=e;localStorage.setItem("pcm-sdk-auth-token",e)},clearToken:()=>{n.token=null;localStorage.removeItem("pcm-sdk-auth-token")}};s("token",(e=>{if(e){localStorage.setItem("pcm-sdk-auth-token",e)}else{localStorage.removeItem("pcm-sdk-auth-token")}}));const c="1.0.7";function i(e,t,o){return(e||"")+(t?` ${t}`:"")+(o?` ${o}`:"")}const l=()=>a.getToken()||"";const u=3*60*1e3;const d=async(e,t,o=u)=>{const r=new AbortController;const n=setTimeout((()=>r.abort()),o);try{const o=await fetch(e,{...t,signal:r.signal});clearTimeout(n);return o}catch(e){clearTimeout(n);if(e instanceof Error&&e.name==="AbortError"){throw new Error("请求超时,请检查网络连接后重试")}throw e}};const f=async(e,t=false)=>{const{url:r,method:n,headers:s={},data:a,onMessage:c,onError:i,onComplete:u}=e;try{const i=`${o}${r}`;if(!s["authorization"]&&!s["Authorization"]){const e=l();if(e){s["authorization"]=`Bearer ${e}`}}const w=await d(i,{method:n,headers:{Accept:"text/event-stream","Content-Type":"application/json",...s},body:a?JSON.stringify(a):undefined});if(w.status===401){h();if(!t){return f(e,true)}}if(!w.ok){console.error(`HTTP error! status: ${w.status}`)}const m=w.body?.getReader();if(!m)throw new Error("No reader available");const p=new TextDecoder;let y="";while(true){const{value:e,done:t}=await m.read();if(t)break;y+=p.decode(e,{stream:true});const o=y.split("\n");y=o.pop()||"";for(const e of o){if(e.startsWith("data:")){try{const t=e.substring(5).trim();if(!t)continue;const o=JSON.parse(t);c?.(o)}catch(t){console.error("解析 SSE 数据错误:",t,"原始数据:",e)}}}}u?.()}catch(o){console.error("SSE 请求错误:",o);if(!t){return f(e,true)}i?.(o)}};const h=()=>{const e=new CustomEvent("pcm-token-invalid",{bubbles:true,composed:true,detail:{timestamp:(new Date).getTime()}});document.dispatchEvent(e)};const w=async(e,t=true)=>{const{url:r,method:n="GET",headers:s={},params:a={},data:c,formData:i,onMessage:u}=e;try{const f=new URLSearchParams;Object.entries(a).forEach((([e,t])=>{if(t!==undefined&&t!==null){f.append(e,String(t))}}));let m=`${o}${r}${f.toString()?`?${f.toString()}`:""}`;if(s["authorization"]==undefined&&s["Authorization"]==undefined){const e=l();if(e){s["authorization"]=`Bearer ${e}`}}const p={method:n,headers:i?{...s}:{"Content-Type":"application/json",...s}};if(i){p.body=i}else if(n!=="GET"&&n!=="HEAD"&&c){p.body=JSON.stringify(c)}if(n==="GET"&&c){const e=new URLSearchParams;Object.entries(c).forEach((([t,o])=>{if(o!==undefined&&o!==null){e.append(t,String(o))}}));m+=(f.toString()?"&":"?")+e.toString()}const y=await d(m,p);if(y.status===401){h();if(t){return w(e,false)}}const k=await y.json();if(u){u(k)}if(!y.ok){console.error(`HTTP错误: ${y.status} ${y.statusText}`);return{success:false,message:k.message||`HTTP错误: ${y.status}`,error:k}}if(k.code!==0){console.error(`API错误: ${k.message}`);return{success:false,message:k.message,error:k}}return{success:true,data:k.data}}catch(o){console.error("HTTP请求错误:",o);if(t){return w(e,false)}if(e.onError){e.onError(o)}return{success:false,error:o,message:o instanceof Error?o.message:"未知错误"}}finally{if(e.onComplete){e.onComplete()}}};const m=async e=>{const o=await w({url:"/sdk/v1/user",method:"GET",headers:{Authorization:`Bearer ${e}`},data:{sdk_version:c}},false);if(!o.success&&o.error&&o.error.code===401){return false}else{t.setItem("pcm-sdk-CUser",`${o.data.user}(${o.data.chat_user})`);return o.success}};const p=async e=>{if(!e){throw new Error("智能体ID不能为空")}try{const t=await w({url:`/sdk/v1/agent/${e}/info`,method:"GET"});if(!t.success){throw new Error(t.message||"获取智能体信息失败")}return t.data}catch(e){console.error("获取智能体信息失败:",e);throw e}};var y;(function(e){e["Init"]="init";e["Uploading"]="uploading";e["Success"]="success";e["Failed"]="failed"})(y||(y={}));const k=async e=>new Promise(((t,o)=>{const r=new FileReader;r.onload=async e=>{try{const o=e.target?.result;const r=await crypto.subtle.digest("SHA-256",o);const n=Array.from(new Uint8Array(r));const s=n.map((e=>e.toString(16).padStart(2,"0"))).join("");t(s)}catch(e){o(e)}};r.onerror=()=>o(new Error("读取文件失败"));r.readAsArrayBuffer(e)}));const T=async(e,t,o="application/octet-stream",r=2)=>{let n=0;while(true){try{const r=await d(e,{method:"PUT",body:t,headers:{"Content-Type":o}});if(!r.ok){throw new Error(`文件上传失败: ${r.status} ${r.statusText}`)}return r}catch(e){n++;console.error(`文件上传错误(尝试 ${n}/${r}):`,e);if(n>=r){throw e}}}};const $=async(e,t,o)=>{try{const r=await k(e);const n=await w({url:"/sdk/v1/files/generate-upload-url",method:"POST",data:{...o,filename:e.name,filesize:e.size,sha256:r},headers:t});if(!n.success||!n.data){throw new Error(n.message||"获取上传URL失败")}const s=n.data;if(s.is_deleted!=1){const o=await T(s.upload_url,e,s.content_type||"application/octet-stream");if(!o.ok){throw new Error(`文件上传到腾讯云失败: ${o.status} ${o.statusText}`)}w({url:"/sdk/v1/files/mark-as-upload",method:"POST",data:{cos_key:s.cos.cos_key},headers:t})}return{cos_key:s.cos.cos_key,file_name:s.filename,file_size:s.filesize,ext:s.filetype}}catch(e){console.error("文件上传错误:",e);throw e}};const E=async(e,t,r=false)=>{const n=l();if(!n){throw new Error("API密钥不能为空")}try{const s=await d(`${o}/sdk/v1/tts/synthesize_audio`,{method:"POST",headers:{"Content-Type":"application/json",authorization:"Bearer "+n},body:JSON.stringify({text:e})});if(s.status===401){h();if(!r){return E(e,t,true)}}if(!s.ok){throw new Error("语音合成失败")}const a=await s.blob();return URL.createObjectURL(a)}catch(o){console.error("语音合成错误:",o);if(!r){return E(e,t,true)}throw o}};const g=async(e,t)=>{try{const o=await w({url:"/sdk/v1/files/presigned-url",method:"GET",params:{cos_key:e},headers:t});if(o.success&&o.data?.file_url){return o.data.file_url}return null}catch(e){console.error("获取预签名URL失败:",e);return null}};const v=async(e,t)=>{try{const o=await g(e,t);if(o){return`${o}${o.includes("?")?"&":"?"}ci-process=doc-preview&copyable=1&dstType=html`}return null}catch(e){console.error("获取预览URL失败:",e);return null}};const S=e=>{if(!e&&e!==0){return null}const t=Number(e);if(isNaN(t))return null;if(e<1024){return e+"B"}if(e<1024*1024){return(e/1024).toFixed(1)+"KB"}return(e/1024/1024).toFixed(1)+"MB"};const b=()=>{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)){return t}}catch(e){console.warn(`检查MIME类型支持时出错 ${t}:`,e)}}console.warn("没有找到支持的MIME类型,将使用浏览器默认值");return""};const P=()=>{const e=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg",""];if(!window.MediaRecorder){console.warn("MediaRecorder API不可用");return""}for(const t of e){if(!t)return"";try{if(MediaRecorder.isTypeSupported(t)){return t}}catch(e){console.warn(`检查音频MIME类型支持时出错 ${t}:`,e)}}console.warn("没有找到支持的音频MIME类型,将使用浏览器默认值");return""};const M=async e=>{try{const t=await w({url:"/sdk/v1/tts/audio_to_text",method:"POST",data:{cos_key:e}});if(t.success&&t.data&&t.data.text){return t.data.text}else{console.warn("音频转文字返回结果格式不正确");return null}}catch(e){console.error("音频转文字错误:",e);throw new Error("音频转文字失败")}};const _=async(e,t,o=0)=>{try{const r=await w({url:"/sdk/v1/verify_sms_code",method:"POST",params:{mobile:e,code:t,code_type:o}});return r}catch(e){console.error("校验短信验证码错误:",e);throw e}};const O=async e=>{const{oemId:t,page:o=1,pageSize:r=10,keyword:n}=e;try{const e=new URLSearchParams;e.append("page",o.toString());e.append("page_size",r.toString());if(n){e.append("keyword",n)}const s=await w({url:`/sdk/v1/oem/${t}/positions?${e.toString()}`,method:"GET"});return s}catch(e){console.error("获取OEM职位列表错误:",e);throw e}};const R=async(e,t)=>{try{const o=await w({url:"/sdk/v1/files/upload-by-url",method:"POST",data:e,headers:t});return o}catch(e){console.error("通过URL上传文件错误:",e);throw e}};export{y as F,r as P,a,f as b,E as c,M as d,_ as e,p as f,b as g,v as h,R as i,g as j,O as k,S as l,P as m,i as n,w as s,$ as u,m as v};
2
- //# sourceMappingURL=p-CcIrA6cr.js.map
1
+ import{a as e,c as t}from"./p-C7m_4Gmk.js";const o="https://api.pincaimao.com/agents/platform";const r="https://www.pincaimao.com";const{state:n,onChange:s}=e({token:localStorage.getItem("pcm-sdk-auth-token")||null});const a={getToken:()=>n.token,setToken:e=>{n.token=e;localStorage.setItem("pcm-sdk-auth-token",e)},clearToken:()=>{n.token=null;localStorage.removeItem("pcm-sdk-auth-token")}};s("token",(e=>{if(e){localStorage.setItem("pcm-sdk-auth-token",e)}else{localStorage.removeItem("pcm-sdk-auth-token")}}));const c="1.0.8";function i(e,t,o){return(e||"")+(t?` ${t}`:"")+(o?` ${o}`:"")}const l=()=>a.getToken()||"";const u=3*60*1e3;const d=async(e,t,o=u)=>{const r=new AbortController;const n=setTimeout((()=>r.abort()),o);try{const o=await fetch(e,{...t,signal:r.signal});clearTimeout(n);return o}catch(e){clearTimeout(n);if(e instanceof Error&&e.name==="AbortError"){throw new Error("请求超时,请检查网络连接后重试")}throw e}};const f=async(e,t=false)=>{const{url:r,method:n,headers:s={},data:a,onMessage:c,onError:i,onComplete:u}=e;try{const i=`${o}${r}`;if(!s["authorization"]&&!s["Authorization"]){const e=l();if(e){s["authorization"]=`Bearer ${e}`}}const w=await d(i,{method:n,headers:{Accept:"text/event-stream","Content-Type":"application/json",...s},body:a?JSON.stringify(a):undefined});if(w.status===401){h();if(!t){return f(e,true)}}if(!w.ok){console.error(`HTTP error! status: ${w.status}`)}const m=w.body?.getReader();if(!m)throw new Error("No reader available");const p=new TextDecoder;let y="";while(true){const{value:e,done:t}=await m.read();if(t)break;y+=p.decode(e,{stream:true});const o=y.split("\n");y=o.pop()||"";for(const e of o){if(e.startsWith("data:")){try{const t=e.substring(5).trim();if(!t)continue;const o=JSON.parse(t);c?.(o)}catch(t){console.error("解析 SSE 数据错误:",t,"原始数据:",e)}}}}u?.()}catch(o){console.error("SSE 请求错误:",o);if(!t){return f(e,true)}i?.(o)}};const h=()=>{const e=new CustomEvent("pcm-token-invalid",{bubbles:true,composed:true,detail:{timestamp:(new Date).getTime()}});document.dispatchEvent(e)};const w=async(e,t=true)=>{const{url:r,method:n="GET",headers:s={},params:a={},data:c,formData:i,onMessage:u}=e;try{const f=new URLSearchParams;Object.entries(a).forEach((([e,t])=>{if(t!==undefined&&t!==null){f.append(e,String(t))}}));let m=`${o}${r}${f.toString()?`?${f.toString()}`:""}`;if(s["authorization"]==undefined&&s["Authorization"]==undefined){const e=l();if(e){s["authorization"]=`Bearer ${e}`}}const p={method:n,headers:i?{...s}:{"Content-Type":"application/json",...s}};if(i){p.body=i}else if(n!=="GET"&&n!=="HEAD"&&c){p.body=JSON.stringify(c)}if(n==="GET"&&c){const e=new URLSearchParams;Object.entries(c).forEach((([t,o])=>{if(o!==undefined&&o!==null){e.append(t,String(o))}}));m+=(f.toString()?"&":"?")+e.toString()}const y=await d(m,p);if(y.status===401){h();if(t){return w(e,false)}}const k=await y.json();if(u){u(k)}if(!y.ok){console.error(`HTTP错误: ${y.status} ${y.statusText}`);return{success:false,message:k.message||`HTTP错误: ${y.status}`,error:k}}if(k.code!==0){console.error(`API错误: ${k.message}`);return{success:false,message:k.message,error:k}}return{success:true,data:k.data}}catch(o){console.error("HTTP请求错误:",o);if(t){return w(e,false)}if(e.onError){e.onError(o)}return{success:false,error:o,message:o instanceof Error?o.message:"未知错误"}}finally{if(e.onComplete){e.onComplete()}}};const m=async e=>{const o=await w({url:"/sdk/v1/user",method:"GET",headers:{Authorization:`Bearer ${e}`},data:{sdk_version:c}},false);if(!o.success&&o.error&&o.error.code===401){return false}else{t.setItem("pcm-sdk-CUser",`${o.data.user}(${o.data.chat_user})`);return o.success}};const p=async e=>{if(!e){throw new Error("智能体ID不能为空")}try{const t=await w({url:`/sdk/v1/agent/${e}/info`,method:"GET"});if(!t.success){throw new Error(t.message||"获取智能体信息失败")}return t.data}catch(e){console.error("获取智能体信息失败:",e);throw e}};var y;(function(e){e["Init"]="init";e["Uploading"]="uploading";e["Success"]="success";e["Failed"]="failed"})(y||(y={}));const k=async e=>new Promise(((t,o)=>{const r=new FileReader;r.onload=async e=>{try{const o=e.target?.result;const r=await crypto.subtle.digest("SHA-256",o);const n=Array.from(new Uint8Array(r));const s=n.map((e=>e.toString(16).padStart(2,"0"))).join("");t(s)}catch(e){o(e)}};r.onerror=()=>o(new Error("读取文件失败"));r.readAsArrayBuffer(e)}));const T=async(e,t,o="application/octet-stream",r=2)=>{let n=0;while(true){try{const r=await d(e,{method:"PUT",body:t,headers:{"Content-Type":o}});if(!r.ok){throw new Error(`文件上传失败: ${r.status} ${r.statusText}`)}return r}catch(e){n++;console.error(`文件上传错误(尝试 ${n}/${r}):`,e);if(n>=r){throw e}}}};const $=async(e,t,o)=>{try{const r=await k(e);const n=await w({url:"/sdk/v1/files/generate-upload-url",method:"POST",data:{...o,filename:e.name,filesize:e.size,sha256:r},headers:t});if(!n.success||!n.data){throw new Error(n.message||"获取上传URL失败")}const s=n.data;if(s.is_deleted!=1){const o=await T(s.upload_url,e,s.content_type||"application/octet-stream");if(!o.ok){throw new Error(`文件上传到腾讯云失败: ${o.status} ${o.statusText}`)}w({url:"/sdk/v1/files/mark-as-upload",method:"POST",data:{cos_key:s.cos.cos_key},headers:t})}return{cos_key:s.cos.cos_key,file_name:s.filename,file_size:s.filesize,ext:s.filetype}}catch(e){console.error("文件上传错误:",e);throw e}};const g=async(e,t,r=false)=>{const n=l();if(!n){throw new Error("API密钥不能为空")}try{const s=await d(`${o}/sdk/v1/tts/synthesize_audio`,{method:"POST",headers:{"Content-Type":"application/json",authorization:"Bearer "+n},body:JSON.stringify({text:e})});if(s.status===401){h();if(!r){return g(e,t,true)}}if(!s.ok){throw new Error("语音合成失败")}const a=await s.blob();return URL.createObjectURL(a)}catch(o){console.error("语音合成错误:",o);if(!r){return g(e,t,true)}throw o}};const E=async(e,t)=>{try{const o=await w({url:"/sdk/v1/files/presigned-url",method:"GET",params:{cos_key:e},headers:t});if(o.success&&o.data?.file_url){return o.data.file_url}return null}catch(e){console.error("获取预签名URL失败:",e);return null}};const v=async(e,t)=>{try{const o=await E(e,t);if(o){return`${o}${o.includes("?")?"&":"?"}ci-process=doc-preview&copyable=1&dstType=html`}return null}catch(e){console.error("获取预览URL失败:",e);return null}};const S=e=>{if(!e&&e!==0){return null}const t=Number(e);if(isNaN(t))return null;if(e<1024){return e+"B"}if(e<1024*1024){return(e/1024).toFixed(1)+"KB"}return(e/1024/1024).toFixed(1)+"MB"};const b=()=>{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)){return t}}catch(e){console.warn(`检查MIME类型支持时出错 ${t}:`,e)}}console.warn("没有找到支持的MIME类型,将使用浏览器默认值");return""};const P=()=>{const e=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg",""];if(!window.MediaRecorder){console.warn("MediaRecorder API不可用");return""}for(const t of e){if(!t)return"";try{if(MediaRecorder.isTypeSupported(t)){return t}}catch(e){console.warn(`检查音频MIME类型支持时出错 ${t}:`,e)}}console.warn("没有找到支持的音频MIME类型,将使用浏览器默认值");return""};const _=async e=>{try{const t=await w({url:"/sdk/v1/tts/audio_to_text",method:"POST",data:{cos_key:e}});if(t.success&&t.data&&t.data.text){return t.data.text}else{console.warn("音频转文字返回结果格式不正确");return null}}catch(e){console.error("音频转文字错误:",e);throw new Error("音频转文字失败")}};const M=async(e,t,o=0,r)=>{try{const n=await w({url:"/sdk/v1/verify_sms_code",method:"POST",params:{mobile:e,code:t,code_type:o,reg_source:4,reg_source_id:r}});return n}catch(e){console.error("校验短信验证码错误:",e);throw e}};const O=async e=>{const{oemId:t,page:o=1,pageSize:r=10,keyword:n}=e;try{const e=new URLSearchParams;e.append("page",o.toString());e.append("page_size",r.toString());if(n){e.append("keyword",n)}const s=await w({url:`/sdk/v1/oem/${t}/positions?${e.toString()}`,method:"GET"});return s}catch(e){console.error("获取OEM职位列表错误:",e);throw e}};const R=async(e,t)=>{try{const o=await w({url:"/sdk/v1/files/upload-by-url",method:"POST",data:e,headers:t});return o}catch(e){console.error("通过URL上传文件错误:",e);throw e}};export{y as F,r as P,a,f as b,g as c,_ as d,M as e,p as f,b as g,v as h,R as i,E as j,O as k,S as l,P as m,i as n,w as s,$ as u,m as v};
2
+ //# sourceMappingURL=p-B3osOuvR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"p-CcIrA6cr.js","sources":["src/utils/env.ts","store/auth.store.ts"],"sourcesContent":["// 默认 API 域名\r\nconst DEFAULT_API_DOMAIN = 'https://api.pincaimao.com/agents/platform';\r\nconst DEFAULT_PCM_DOMAIN = 'https://www.pincaimao.com';\r\n\r\n\r\n// 从环境变量获取 API 域名,如果未设置则使用默认值\r\nexport const API_DOMAIN = process.env.API_DOMAIN || DEFAULT_API_DOMAIN;\r\nexport const PCM_DOMAIN = process.env.PCM_DOMAIN || DEFAULT_PCM_DOMAIN;\r\n\r\n// 导出其他环境变量\r\nexport const ENV = {\r\n API_DOMAIN,\r\n PCM_DOMAIN,\r\n // 可以添加其他环境变量\r\n}; ","// src/store/auth.store.ts\r\nimport { createStore } from '@stencil/store';\r\n\r\nexport const { state: authState, onChange } = createStore({\r\n token: localStorage.getItem('pcm-sdk-auth-token') || null\r\n});\r\n\r\n// 添加一些辅助方法\r\nexport const authStore = {\r\n getToken: () => authState.token,\r\n setToken: (token: string) => {\r\n authState.token = token;\r\n localStorage.setItem('pcm-sdk-auth-token', token);\r\n },\r\n clearToken: () => {\r\n authState.token = null;\r\n localStorage.removeItem('pcm-sdk-auth-token');\r\n }\r\n};\r\n\r\n// 自动保存到localStorage\r\nonChange('token', value => {\r\n if (value) {\r\n localStorage.setItem('pcm-sdk-auth-token', value);\r\n } else {\r\n localStorage.removeItem('pcm-sdk-auth-token');\r\n }\r\n});"],"names":[],"mappings":";;AAAA;AAKA;AACO,MAAM,UAAU,GAAG,2CAA4C;AACzD,MAAA,UAAU,GAAG;;ACP1B;AAGO,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IACxD,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI;AACtD,CAAA,CAAC;AAEF;AACa,MAAA,SAAS,GAAG;AACvB,IAAA,QAAQ,EAAE,MAAM,SAAS,CAAC,KAAK;AAC/B,IAAA,QAAQ,EAAE,CAAC,KAAa,KAAI;AAC1B,QAAA,SAAS,CAAC,KAAK,GAAG,KAAK;AACvB,QAAA,YAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC;KAClD;IACD,UAAU,EAAE,MAAK;AACf,QAAA,SAAS,CAAC,KAAK,GAAG,IAAI;AACtB,QAAA,YAAY,CAAC,UAAU,CAAC,oBAAoB,CAAC;;;AAIjD;AACA,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAG;IACxB,IAAI,KAAK,EAAE;AACT,QAAA,YAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC;;SAC5C;AACL,QAAA,YAAY,CAAC,UAAU,CAAC,oBAAoB,CAAC;;AAEjD,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"p-B3osOuvR.js","sources":["src/utils/env.ts","store/auth.store.ts"],"sourcesContent":["// 默认 API 域名\r\nconst DEFAULT_API_DOMAIN = 'https://api.pincaimao.com/agents/platform';\r\nconst DEFAULT_PCM_DOMAIN = 'https://www.pincaimao.com';\r\n\r\n\r\n// 从环境变量获取 API 域名,如果未设置则使用默认值\r\nexport const API_DOMAIN = process.env.API_DOMAIN || DEFAULT_API_DOMAIN;\r\nexport const PCM_DOMAIN = process.env.PCM_DOMAIN || DEFAULT_PCM_DOMAIN;\r\n\r\n// 导出其他环境变量\r\nexport const ENV = {\r\n API_DOMAIN,\r\n PCM_DOMAIN,\r\n // 可以添加其他环境变量\r\n}; ","// src/store/auth.store.ts\r\nimport { createStore } from '@stencil/store';\r\n\r\nexport const { state: authState, onChange } = createStore({\r\n token: localStorage.getItem('pcm-sdk-auth-token') || null\r\n});\r\n\r\n// 添加一些辅助方法\r\nexport const authStore = {\r\n getToken: () => authState.token,\r\n setToken: (token: string) => {\r\n authState.token = token;\r\n localStorage.setItem('pcm-sdk-auth-token', token);\r\n },\r\n clearToken: () => {\r\n authState.token = null;\r\n localStorage.removeItem('pcm-sdk-auth-token');\r\n }\r\n};\r\n\r\n// 自动保存到localStorage\r\nonChange('token', value => {\r\n if (value) {\r\n localStorage.setItem('pcm-sdk-auth-token', value);\r\n } else {\r\n localStorage.removeItem('pcm-sdk-auth-token');\r\n }\r\n});"],"names":[],"mappings":";;AAAA;AAKA;AACO,MAAM,UAAU,GAAG,2CAA4C;AACzD,MAAA,UAAU,GAAG;;ACP1B;AAGO,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IACxD,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI;AACtD,CAAA,CAAC;AAEF;AACa,MAAA,SAAS,GAAG;AACvB,IAAA,QAAQ,EAAE,MAAM,SAAS,CAAC,KAAK;AAC/B,IAAA,QAAQ,EAAE,CAAC,KAAa,KAAI;AAC1B,QAAA,SAAS,CAAC,KAAK,GAAG,KAAK;AACvB,QAAA,YAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC;KAClD;IACD,UAAU,EAAE,MAAK;AACf,QAAA,SAAS,CAAC,KAAK,GAAG,IAAI;AACtB,QAAA,YAAY,CAAC,UAAU,CAAC,oBAAoB,CAAC;;;AAIjD;AACA,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAG;IACxB,IAAI,KAAK,EAAE;AACT,QAAA,YAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC;;SAC5C;AACL,QAAA,YAAY,CAAC,UAAU,CAAC,oBAAoB,CAAC;;AAEjD,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ import{s as t}from"./p-B3osOuvR.js";import{S as s}from"./p-B23366TU.js";import{E as e}from"./p-C0FYX2-Z.js";function r(t){try{const s=typeof t==="string"?parseInt(t,10):t;if(isNaN(s)||s<=0){return"未知时间"}const e=new Date(s*1e3);if(isNaN(e.getTime())){return"未知时间"}const r=new Date;const n=Math.floor((r.getTime()-e.getTime())/(1e3*60*60*24));const o=e.getHours().toString().padStart(2,"0");const a=e.getMinutes().toString().padStart(2,"0");const i=(e.getMonth()+1).toString().padStart(2,"0");const c=e.getDate().toString().padStart(2,"0");if(n===0){return`今天 ${o}:${a}`}if(n===1){return`昨天 ${o}:${a}`}if(n>1&&n<7){const t=["周日","周一","周二","周三","周四","周五","周六"];return`${t[e.getDay()]} ${o}:${a}`}return`${i}-${c} ${o}:${a}`}catch{return"时间解析失败"}}async function n(n,o,a="",i=20){try{const s=await t({url:"/sdk/v1/chat/conversations",method:"GET",data:{bot_id:n,last_id:a,limit:i}});if(s.success&&s.data){const t=s.data.data||s.data.items||[];const e=typeof s.data.has_more==="boolean"?s.data.has_more:t.length>i;const n=t.slice(0,i).map((t=>({id:t.id,name:t.name||"新会话",created_at:Number(t.created_at),updated_at:Number(t.updated_at),status:t.status,message_count:t.message_count||0,timeDisplay:r(t.created_at),inputs:t.inputs})));return{items:n,hasMore:e,nextCursor:n.length>0?n[n.length-1].id:""}}return{items:[],hasMore:false,nextCursor:""}}catch(t){console.error("获取历史会话失败:",t);s.captureError(t,{action:"fetchHistoryConversations",component:o,title:"获取历史会话失败"});e.emitError({error:t,message:"获取历史会话失败"});return{items:[],hasMore:false,nextCursor:""}}}export{n as f};
2
+ //# sourceMappingURL=p-CXe7oxeN.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"p-rR0ghCa0.js","sources":["src/utils/conversation-utils.ts"],"sourcesContent":["import { sendHttpRequest } from './utils';\r\nimport { SentryReporter } from './sentry-reporter';\r\nimport { ErrorEventBus } from './error-event';\r\nimport { ConversationItem, ConversationPageResult, ConversationDetail } from '../interfaces/chat';\r\n\r\ninterface ConversationApiItem {\r\n id: string;\r\n name?: string;\r\n created_at: number | string;\r\n updated_at: number | string;\r\n status?: string;\r\n message_count?: number;\r\n inputs?: any;\r\n}\r\n\r\ninterface ConversationApiData {\r\n data?: ConversationApiItem[];\r\n items?: ConversationApiItem[];\r\n has_more?: boolean;\r\n}\r\n\r\n/**\r\n * 格式化会话时间戳为可读字符串\r\n */\r\nfunction formatConversationTime(createdAt: number | string): string {\r\n try {\r\n const timestamp = typeof createdAt === 'string' ? parseInt(createdAt, 10) : createdAt;\r\n if (isNaN(timestamp) || timestamp <= 0) {\r\n return '未知时间';\r\n }\r\n\r\n const createdTime = new Date(timestamp * 1000);\r\n if (isNaN(createdTime.getTime())) {\r\n return '未知时间';\r\n }\r\n\r\n const now = new Date();\r\n const diffDays = Math.floor((now.getTime() - createdTime.getTime()) / (1000 * 60 * 60 * 24));\r\n const hh = createdTime.getHours().toString().padStart(2, '0');\r\n const mm = createdTime.getMinutes().toString().padStart(2, '0');\r\n const month = (createdTime.getMonth() + 1).toString().padStart(2, '0');\r\n const day = createdTime.getDate().toString().padStart(2, '0');\r\n\r\n if (diffDays === 0) {\r\n return `今天 ${hh}:${mm}`;\r\n }\r\n\r\n if (diffDays === 1) {\r\n return `昨天 ${hh}:${mm}`;\r\n }\r\n\r\n if (diffDays > 1 && diffDays < 7) {\r\n const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];\r\n return `${weekdays[createdTime.getDay()]} ${hh}:${mm}`;\r\n }\r\n\r\n return `${month}-${day} ${hh}:${mm}`;\r\n } catch {\r\n return '时间解析失败';\r\n }\r\n}\r\n\r\n/**\r\n * 获取历史会话列表\r\n * @param botId 机器人 ID\r\n * @param componentName 调用组件名称\r\n * @param lastId 上一页最后一条会话 ID,空字符串表示第一页\r\n * @param limit 每页数量\r\n * @returns 游标分页结果\r\n */\r\nexport async function fetchHistoryConversations(\r\n botId: string,\r\n componentName: string,\r\n lastId: string = '',\r\n limit: number = 20,\r\n): Promise<ConversationPageResult> {\r\n try {\r\n const result = await sendHttpRequest<ConversationApiData>({\r\n url: '/sdk/v1/chat/conversations',\r\n method: 'GET',\r\n data: {\r\n bot_id: botId,\r\n last_id: lastId,\r\n limit,\r\n },\r\n });\r\n\r\n if (result.success && result.data) {\r\n const rawConversations: ConversationApiItem[] = result.data.data || result.data.items || [];\r\n const hasMore = typeof result.data.has_more === 'boolean'\r\n ? result.data.has_more\r\n : rawConversations.length > limit;\r\n const conversations: ConversationItem[] = rawConversations.slice(0, limit).map((conv: ConversationApiItem) => ({\r\n id: conv.id,\r\n name: conv.name || '新会话',\r\n created_at: Number(conv.created_at),\r\n updated_at: Number(conv.updated_at),\r\n status: conv.status,\r\n message_count: conv.message_count || 0,\r\n timeDisplay: formatConversationTime(conv.created_at),\r\n inputs: conv.inputs,\r\n }));\r\n\r\n return {\r\n items: conversations,\r\n hasMore,\r\n nextCursor: conversations.length > 0 ? conversations[conversations.length - 1].id : '',\r\n };\r\n }\r\n\r\n return {\r\n items: [],\r\n hasMore: false,\r\n nextCursor: '',\r\n };\r\n } catch (error) {\r\n console.error('获取历史会话失败:', error);\r\n SentryReporter.captureError(error, {\r\n action: 'fetchHistoryConversations',\r\n component: componentName,\r\n title: '获取历史会话失败',\r\n });\r\n ErrorEventBus.emitError({ error, message: '获取历史会话失败' });\r\n\r\n return {\r\n items: [],\r\n hasMore: false,\r\n nextCursor: '',\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * 获取单个会话详情\r\n * @param conversationId 会话 ID\r\n * @param componentName 调用组件名称\r\n * @returns 会话详情\r\n */\r\nexport async function fetchConversationDetail(\r\n conversationId: string,\r\n componentName: string,\r\n): Promise<ConversationDetail | null> {\r\n try {\r\n const result = await sendHttpRequest<{ data: ConversationDetail }>({\r\n url: '/sdk/v1/chat/conversation',\r\n method: 'GET',\r\n data: {\r\n conversation_id: conversationId,\r\n },\r\n });\r\n\r\n if (result.success && result.data?.data) {\r\n return result.data.data;\r\n }\r\n\r\n return null;\r\n } catch (error) {\r\n console.error('获取会话详情失败:', error);\r\n SentryReporter.captureError(error, {\r\n action: 'fetchConversationDetail',\r\n component: componentName,\r\n title: '获取会话详情失败',\r\n });\r\n ErrorEventBus.emitError({ error, message: '获取会话详情失败' });\r\n\r\n return null;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAqBA;;AAEG;AACH,SAAS,sBAAsB,CAAC,SAA0B,EAAA;AACtD,IAAA,IAAI;AACA,QAAA,MAAM,SAAS,GAAG,OAAO,SAAS,KAAK,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS;QACrF,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE;AACpC,YAAA,OAAO,MAAM;;QAGjB,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC9C,IAAI,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE;AAC9B,YAAA,OAAO,MAAM;;AAGjB,QAAA,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE;AACtB,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AAC5F,QAAA,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC7D,QAAA,MAAM,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;QAC/D,MAAM,KAAK,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACtE,QAAA,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAE7D,QAAA,IAAI,QAAQ,KAAK,CAAC,EAAE;AAChB,YAAA,OAAO,CAAM,GAAA,EAAA,EAAE,CAAI,CAAA,EAAA,EAAE,EAAE;;AAG3B,QAAA,IAAI,QAAQ,KAAK,CAAC,EAAE;AAChB,YAAA,OAAO,CAAM,GAAA,EAAA,EAAE,CAAI,CAAA,EAAA,EAAE,EAAE;;QAG3B,IAAI,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE;AAC9B,YAAA,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAC3D,YAAA,OAAO,CAAG,EAAA,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAI,CAAA,EAAA,EAAE,CAAI,CAAA,EAAA,EAAE,EAAE;;QAG1D,OAAO,CAAA,EAAG,KAAK,CAAI,CAAA,EAAA,GAAG,IAAI,EAAE,CAAA,CAAA,EAAI,EAAE,CAAA,CAAE;;AACtC,IAAA,MAAM;AACJ,QAAA,OAAO,QAAQ;;AAEvB;AAEA;;;;;;;AAOG;AACI,eAAe,yBAAyB,CAC3C,KAAa,EACb,aAAqB,EACrB,MAAA,GAAiB,EAAE,EACnB,QAAgB,EAAE,EAAA;AAElB,IAAA,IAAI;AACA,QAAA,MAAM,MAAM,GAAG,MAAM,eAAe,CAAsB;AACtD,YAAA,GAAG,EAAE,4BAA4B;AACjC,YAAA,MAAM,EAAE,KAAK;AACb,YAAA,IAAI,EAAE;AACF,gBAAA,MAAM,EAAE,KAAK;AACb,gBAAA,OAAO,EAAE,MAAM;gBACf,KAAK;AACR,aAAA;AACJ,SAAA,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE;AAC/B,YAAA,MAAM,gBAAgB,GAA0B,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAC3F,MAAM,OAAO,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK;AAC5C,kBAAE,MAAM,CAAC,IAAI,CAAC;AACd,kBAAE,gBAAgB,CAAC,MAAM,GAAG,KAAK;AACrC,YAAA,MAAM,aAAa,GAAuB,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAyB,MAAM;gBAC3G,EAAE,EAAE,IAAI,CAAC,EAAE;AACX,gBAAA,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK;AACxB,gBAAA,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;AACnC,gBAAA,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;gBACnC,MAAM,EAAE,IAAI,CAAC,MAAM;AACnB,gBAAA,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,CAAC;AACtC,gBAAA,WAAW,EAAE,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC;gBACpD,MAAM,EAAE,IAAI,CAAC,MAAM;AACtB,aAAA,CAAC,CAAC;YAEH,OAAO;AACH,gBAAA,KAAK,EAAE,aAAa;gBACpB,OAAO;gBACP,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE;aACzF;;QAGL,OAAO;AACH,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,UAAU,EAAE,EAAE;SACjB;;IACH,OAAO,KAAK,EAAE;AACZ,QAAA,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC;AACjC,QAAA,cAAc,CAAC,YAAY,CAAC,KAAK,EAAE;AAC/B,YAAA,MAAM,EAAE,2BAA2B;AACnC,YAAA,SAAS,EAAE,aAAa;AACxB,YAAA,KAAK,EAAE,UAAU;AACpB,SAAA,CAAC;QACF,aAAa,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;QAEvD,OAAO;AACH,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,UAAU,EAAE,EAAE;SACjB;;AAET;;;;"}
1
+ {"version":3,"file":"p-CXe7oxeN.js","sources":["src/utils/conversation-utils.ts"],"sourcesContent":["import { sendHttpRequest } from './utils';\r\nimport { SentryReporter } from './sentry-reporter';\r\nimport { ErrorEventBus } from './error-event';\r\nimport { ConversationItem, ConversationPageResult, ConversationDetail } from '../interfaces/chat';\r\n\r\ninterface ConversationApiItem {\r\n id: string;\r\n name?: string;\r\n created_at: number | string;\r\n updated_at: number | string;\r\n status?: string;\r\n message_count?: number;\r\n inputs?: any;\r\n}\r\n\r\ninterface ConversationApiData {\r\n data?: ConversationApiItem[];\r\n items?: ConversationApiItem[];\r\n has_more?: boolean;\r\n}\r\n\r\n/**\r\n * 格式化会话时间戳为可读字符串\r\n */\r\nfunction formatConversationTime(createdAt: number | string): string {\r\n try {\r\n const timestamp = typeof createdAt === 'string' ? parseInt(createdAt, 10) : createdAt;\r\n if (isNaN(timestamp) || timestamp <= 0) {\r\n return '未知时间';\r\n }\r\n\r\n const createdTime = new Date(timestamp * 1000);\r\n if (isNaN(createdTime.getTime())) {\r\n return '未知时间';\r\n }\r\n\r\n const now = new Date();\r\n const diffDays = Math.floor((now.getTime() - createdTime.getTime()) / (1000 * 60 * 60 * 24));\r\n const hh = createdTime.getHours().toString().padStart(2, '0');\r\n const mm = createdTime.getMinutes().toString().padStart(2, '0');\r\n const month = (createdTime.getMonth() + 1).toString().padStart(2, '0');\r\n const day = createdTime.getDate().toString().padStart(2, '0');\r\n\r\n if (diffDays === 0) {\r\n return `今天 ${hh}:${mm}`;\r\n }\r\n\r\n if (diffDays === 1) {\r\n return `昨天 ${hh}:${mm}`;\r\n }\r\n\r\n if (diffDays > 1 && diffDays < 7) {\r\n const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];\r\n return `${weekdays[createdTime.getDay()]} ${hh}:${mm}`;\r\n }\r\n\r\n return `${month}-${day} ${hh}:${mm}`;\r\n } catch {\r\n return '时间解析失败';\r\n }\r\n}\r\n\r\n/**\r\n * 获取历史会话列表\r\n * @param botId 机器人 ID\r\n * @param componentName 调用组件名称\r\n * @param lastId 上一页最后一条会话 ID,空字符串表示第一页\r\n * @param limit 每页数量\r\n * @returns 游标分页结果\r\n */\r\nexport async function fetchHistoryConversations(\r\n botId: string,\r\n componentName: string,\r\n lastId: string = '',\r\n limit: number = 20,\r\n): Promise<ConversationPageResult> {\r\n try {\r\n const result = await sendHttpRequest<ConversationApiData>({\r\n url: '/sdk/v1/chat/conversations',\r\n method: 'GET',\r\n data: {\r\n bot_id: botId,\r\n last_id: lastId,\r\n limit,\r\n },\r\n });\r\n\r\n if (result.success && result.data) {\r\n const rawConversations: ConversationApiItem[] = result.data.data || result.data.items || [];\r\n const hasMore = typeof result.data.has_more === 'boolean'\r\n ? result.data.has_more\r\n : rawConversations.length > limit;\r\n const conversations: ConversationItem[] = rawConversations.slice(0, limit).map((conv: ConversationApiItem) => ({\r\n id: conv.id,\r\n name: conv.name || '新会话',\r\n created_at: Number(conv.created_at),\r\n updated_at: Number(conv.updated_at),\r\n status: conv.status,\r\n message_count: conv.message_count || 0,\r\n timeDisplay: formatConversationTime(conv.created_at),\r\n inputs: conv.inputs,\r\n }));\r\n\r\n return {\r\n items: conversations,\r\n hasMore,\r\n nextCursor: conversations.length > 0 ? conversations[conversations.length - 1].id : '',\r\n };\r\n }\r\n\r\n return {\r\n items: [],\r\n hasMore: false,\r\n nextCursor: '',\r\n };\r\n } catch (error) {\r\n console.error('获取历史会话失败:', error);\r\n SentryReporter.captureError(error, {\r\n action: 'fetchHistoryConversations',\r\n component: componentName,\r\n title: '获取历史会话失败',\r\n });\r\n ErrorEventBus.emitError({ error, message: '获取历史会话失败' });\r\n\r\n return {\r\n items: [],\r\n hasMore: false,\r\n nextCursor: '',\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * 获取单个会话详情\r\n * @param conversationId 会话 ID\r\n * @param componentName 调用组件名称\r\n * @returns 会话详情\r\n */\r\nexport async function fetchConversationDetail(\r\n conversationId: string,\r\n componentName: string,\r\n): Promise<ConversationDetail | null> {\r\n try {\r\n const result = await sendHttpRequest<{ data: ConversationDetail }>({\r\n url: '/sdk/v1/chat/conversation',\r\n method: 'GET',\r\n data: {\r\n conversation_id: conversationId,\r\n },\r\n });\r\n\r\n if (result.success && result.data?.data) {\r\n return result.data.data;\r\n }\r\n\r\n return null;\r\n } catch (error) {\r\n console.error('获取会话详情失败:', error);\r\n SentryReporter.captureError(error, {\r\n action: 'fetchConversationDetail',\r\n component: componentName,\r\n title: '获取会话详情失败',\r\n });\r\n ErrorEventBus.emitError({ error, message: '获取会话详情失败' });\r\n\r\n return null;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAqBA;;AAEG;AACH,SAAS,sBAAsB,CAAC,SAA0B,EAAA;AACtD,IAAA,IAAI;AACA,QAAA,MAAM,SAAS,GAAG,OAAO,SAAS,KAAK,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS;QACrF,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE;AACpC,YAAA,OAAO,MAAM;;QAGjB,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC9C,IAAI,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE;AAC9B,YAAA,OAAO,MAAM;;AAGjB,QAAA,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE;AACtB,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AAC5F,QAAA,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC7D,QAAA,MAAM,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;QAC/D,MAAM,KAAK,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACtE,QAAA,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAE7D,QAAA,IAAI,QAAQ,KAAK,CAAC,EAAE;AAChB,YAAA,OAAO,CAAM,GAAA,EAAA,EAAE,CAAI,CAAA,EAAA,EAAE,EAAE;;AAG3B,QAAA,IAAI,QAAQ,KAAK,CAAC,EAAE;AAChB,YAAA,OAAO,CAAM,GAAA,EAAA,EAAE,CAAI,CAAA,EAAA,EAAE,EAAE;;QAG3B,IAAI,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE;AAC9B,YAAA,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAC3D,YAAA,OAAO,CAAG,EAAA,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAI,CAAA,EAAA,EAAE,CAAI,CAAA,EAAA,EAAE,EAAE;;QAG1D,OAAO,CAAA,EAAG,KAAK,CAAI,CAAA,EAAA,GAAG,IAAI,EAAE,CAAA,CAAA,EAAI,EAAE,CAAA,CAAE;;AACtC,IAAA,MAAM;AACJ,QAAA,OAAO,QAAQ;;AAEvB;AAEA;;;;;;;AAOG;AACI,eAAe,yBAAyB,CAC3C,KAAa,EACb,aAAqB,EACrB,MAAA,GAAiB,EAAE,EACnB,QAAgB,EAAE,EAAA;AAElB,IAAA,IAAI;AACA,QAAA,MAAM,MAAM,GAAG,MAAM,eAAe,CAAsB;AACtD,YAAA,GAAG,EAAE,4BAA4B;AACjC,YAAA,MAAM,EAAE,KAAK;AACb,YAAA,IAAI,EAAE;AACF,gBAAA,MAAM,EAAE,KAAK;AACb,gBAAA,OAAO,EAAE,MAAM;gBACf,KAAK;AACR,aAAA;AACJ,SAAA,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE;AAC/B,YAAA,MAAM,gBAAgB,GAA0B,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAC3F,MAAM,OAAO,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK;AAC5C,kBAAE,MAAM,CAAC,IAAI,CAAC;AACd,kBAAE,gBAAgB,CAAC,MAAM,GAAG,KAAK;AACrC,YAAA,MAAM,aAAa,GAAuB,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAyB,MAAM;gBAC3G,EAAE,EAAE,IAAI,CAAC,EAAE;AACX,gBAAA,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK;AACxB,gBAAA,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;AACnC,gBAAA,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;gBACnC,MAAM,EAAE,IAAI,CAAC,MAAM;AACnB,gBAAA,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,CAAC;AACtC,gBAAA,WAAW,EAAE,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC;gBACpD,MAAM,EAAE,IAAI,CAAC,MAAM;AACtB,aAAA,CAAC,CAAC;YAEH,OAAO;AACH,gBAAA,KAAK,EAAE,aAAa;gBACpB,OAAO;gBACP,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE;aACzF;;QAGL,OAAO;AACH,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,UAAU,EAAE,EAAE;SACjB;;IACH,OAAO,KAAK,EAAE;AACZ,QAAA,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC;AACjC,QAAA,cAAc,CAAC,YAAY,CAAC,KAAK,EAAE;AAC/B,YAAA,MAAM,EAAE,2BAA2B;AACnC,YAAA,SAAS,EAAE,aAAa;AACxB,YAAA,KAAK,EAAE,UAAU;AACpB,SAAA,CAAC;QACF,aAAa,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;QAEvD,OAAO;AACH,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,UAAU,EAAE,EAAE;SACjB;;AAET;;;;"}