pcm-agents 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/cjs/index-BFPEnLbS.js +195 -0
- package/dist/cjs/index-BFPEnLbS.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/my-component.cjs.entry.js +2 -2
- package/dist/cjs/my-component.cjs.entry.js.map +1 -1
- package/dist/cjs/my-component.entry.cjs.js.map +1 -1
- package/dist/cjs/pcm-agents.cjs.js +1 -1
- package/dist/cjs/pcm-app-chat-modal.pcm-chat-message.pcm-hr-chat-modal.pcm-jlpx-modal.pcm-mnms-modal.pcm-video-chat-modal.pcm-zygh-modal.entry.cjs.js.map +1 -0
- package/dist/cjs/pcm-app-chat-modal_7.cjs.entry.js +6560 -0
- package/dist/cjs/pcm-app-chat-modal_7.cjs.entry.js.map +1 -0
- package/dist/cjs/pcm-chat-modal.cjs.entry.js +17 -32
- package/dist/cjs/pcm-chat-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/pcm-chat-modal.entry.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/my-component/my-component.css +3 -3
- package/dist/collection/components/my-component/my-component.js +1 -1
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.css +2 -1
- package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js +137 -159
- package/dist/collection/components/pcm-app-chat-modal/pcm-app-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-chat-message/pcm-chat-message.css +66 -12
- package/dist/collection/components/pcm-chat-message/pcm-chat-message.js +106 -13
- package/dist/collection/components/pcm-chat-message/pcm-chat-message.js.map +1 -1
- package/dist/collection/components/pcm-chat-modal/pcm-chat-modal.js +39 -34
- package/dist/collection/components/pcm-chat-modal/pcm-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-hr-chat-modal/pcm-hr-chat-modal.js +76 -105
- package/dist/collection/components/pcm-hr-chat-modal/pcm-hr-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-jlpx-modal/pcm-jlpx-modal.css +162 -0
- package/dist/collection/components/pcm-jlpx-modal/pcm-jlpx-modal.js +616 -0
- package/dist/collection/components/pcm-jlpx-modal/pcm-jlpx-modal.js.map +1 -0
- package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.css +0 -79
- package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js +133 -81
- package/dist/collection/components/pcm-mnms-modal/pcm-mnms-modal.js.map +1 -1
- package/dist/collection/components/pcm-video-chat-modal/pcm-video-chat-modal.js +77 -101
- package/dist/collection/components/pcm-video-chat-modal/pcm-video-chat-modal.js.map +1 -1
- package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.css +273 -0
- package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js +613 -0
- package/dist/collection/components/pcm-zygh-modal/pcm-zygh-modal.js.map +1 -0
- package/dist/collection/global/global.css +324 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/interfaces/chat.js.map +1 -1
- package/dist/collection/utils/utils.js +54 -113
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/index.js +1298 -11280
- package/dist/components/index.js.map +1 -1
- package/dist/components/my-component.js +2 -3
- package/dist/components/my-component.js.map +1 -1
- package/dist/components/{p-C4l_DOnx.js → p-BctfuDvG.js} +106 -147
- package/dist/components/p-BctfuDvG.js.map +1 -0
- package/dist/components/{p-D0s1Q-3O.js → p-LkDC0SN2.js} +343 -16
- package/dist/components/p-LkDC0SN2.js.map +1 -0
- package/dist/components/pcm-app-chat-modal.js +1 -1
- package/dist/components/pcm-chat-message.js +1 -1
- package/dist/components/pcm-chat-modal.js +19 -34
- package/dist/components/pcm-chat-modal.js.map +1 -1
- package/dist/components/pcm-hr-chat-modal.js +70 -100
- package/dist/components/pcm-hr-chat-modal.js.map +1 -1
- package/dist/components/pcm-jlpx-modal.d.ts +11 -0
- package/dist/components/pcm-jlpx-modal.js +339 -0
- package/dist/components/pcm-jlpx-modal.js.map +1 -0
- package/dist/components/pcm-mnms-modal.js +109 -57
- package/dist/components/pcm-mnms-modal.js.map +1 -1
- package/dist/components/pcm-video-chat-modal.js +74 -99
- package/dist/components/pcm-video-chat-modal.js.map +1 -1
- package/dist/components/pcm-zygh-modal.d.ts +11 -0
- package/dist/components/pcm-zygh-modal.js +330 -0
- package/dist/components/pcm-zygh-modal.js.map +1 -0
- package/dist/esm/index-nVjZGfA8.js +189 -0
- package/dist/esm/index-nVjZGfA8.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/my-component.entry.js +2 -2
- package/dist/esm/my-component.entry.js.map +1 -1
- package/dist/esm/pcm-agents.js +1 -1
- package/dist/esm/pcm-app-chat-modal.pcm-chat-message.pcm-hr-chat-modal.pcm-jlpx-modal.pcm-mnms-modal.pcm-video-chat-modal.pcm-zygh-modal.entry.js.map +1 -0
- package/dist/esm/pcm-app-chat-modal_7.entry.js +6552 -0
- package/dist/esm/pcm-app-chat-modal_7.entry.js.map +1 -0
- package/dist/esm/pcm-chat-modal.entry.js +17 -32
- package/dist/esm/pcm-chat-modal.entry.js.map +1 -1
- package/dist/pcm-agents/index.esm.js +1 -1
- package/dist/pcm-agents/my-component.entry.esm.js.map +1 -1
- package/dist/pcm-agents/p-55417392.entry.js +2 -0
- package/dist/pcm-agents/p-55417392.entry.js.map +1 -0
- package/dist/pcm-agents/p-a698b59f.entry.js +2 -0
- package/dist/pcm-agents/p-a698b59f.entry.js.map +1 -0
- package/dist/pcm-agents/p-f3ca99b4.entry.js +2 -0
- package/dist/pcm-agents/p-f3ca99b4.entry.js.map +1 -0
- package/dist/pcm-agents/p-nVjZGfA8.js +2 -0
- package/dist/pcm-agents/p-nVjZGfA8.js.map +1 -0
- package/dist/pcm-agents/pcm-agents.esm.js +1 -1
- package/dist/pcm-agents/pcm-app-chat-modal.pcm-chat-message.pcm-hr-chat-modal.pcm-jlpx-modal.pcm-mnms-modal.pcm-video-chat-modal.pcm-zygh-modal.entry.esm.js.map +1 -0
- package/dist/pcm-agents/pcm-chat-modal.entry.esm.js.map +1 -1
- package/dist/types/components/pcm-app-chat-modal/pcm-app-chat-modal.d.ts +13 -8
- package/dist/types/components/pcm-chat-message/pcm-chat-message.d.ts +5 -0
- package/dist/types/components/pcm-chat-modal/pcm-chat-modal.d.ts +8 -8
- package/dist/types/components/pcm-hr-chat-modal/pcm-hr-chat-modal.d.ts +6 -12
- package/dist/types/components/pcm-jlpx-modal/pcm-jlpx-modal.d.ts +113 -0
- package/dist/types/components/pcm-mnms-modal/pcm-mnms-modal.d.ts +19 -20
- package/dist/types/components/pcm-video-chat-modal/pcm-video-chat-modal.d.ts +4 -4
- package/dist/types/components/pcm-zygh-modal/pcm-zygh-modal.d.ts +117 -0
- package/dist/types/components.d.ts +429 -80
- package/dist/types/interfaces/chat.d.ts +0 -4
- package/dist/types/utils/utils.d.ts +29 -83
- package/package.json +61 -60
- package/readme.md +307 -307
- package/dist/cjs/index-DfIUl99H.js +0 -11413
- package/dist/cjs/index-DfIUl99H.js.map +0 -1
- package/dist/cjs/pcm-app-chat-modal.pcm-chat-message.pcm-mnms-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/pcm-app-chat-modal_3.cjs.entry.js +0 -3734
- package/dist/cjs/pcm-app-chat-modal_3.cjs.entry.js.map +0 -1
- package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js +0 -1078
- package/dist/cjs/pcm-hr-chat-modal.cjs.entry.js.map +0 -1
- package/dist/cjs/pcm-hr-chat-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/pcm-video-chat-modal.cjs.entry.js +0 -927
- package/dist/cjs/pcm-video-chat-modal.cjs.entry.js.map +0 -1
- package/dist/cjs/pcm-video-chat-modal.entry.cjs.js.map +0 -1
- package/dist/components/p-C4l_DOnx.js.map +0 -1
- package/dist/components/p-CgDy4pJp.js +0 -1244
- package/dist/components/p-CgDy4pJp.js.map +0 -1
- package/dist/components/p-D0s1Q-3O.js.map +0 -1
- package/dist/esm/index-B2EtEi7v.js +0 -11409
- package/dist/esm/index-B2EtEi7v.js.map +0 -1
- package/dist/esm/pcm-app-chat-modal.pcm-chat-message.pcm-mnms-modal.entry.js.map +0 -1
- package/dist/esm/pcm-app-chat-modal_3.entry.js +0 -3730
- package/dist/esm/pcm-app-chat-modal_3.entry.js.map +0 -1
- package/dist/esm/pcm-hr-chat-modal.entry.js +0 -1076
- package/dist/esm/pcm-hr-chat-modal.entry.js.map +0 -1
- package/dist/esm/pcm-video-chat-modal.entry.js +0 -925
- package/dist/esm/pcm-video-chat-modal.entry.js.map +0 -1
- package/dist/pcm-agents/p-0ddd5c47.entry.js +0 -2
- package/dist/pcm-agents/p-0ddd5c47.entry.js.map +0 -1
- package/dist/pcm-agents/p-5f624943.entry.js +0 -2
- package/dist/pcm-agents/p-5f624943.entry.js.map +0 -1
- package/dist/pcm-agents/p-6c07f155.entry.js +0 -2
- package/dist/pcm-agents/p-6c07f155.entry.js.map +0 -1
- package/dist/pcm-agents/p-9a1fb6ca.entry.js +0 -2
- package/dist/pcm-agents/p-9a1fb6ca.entry.js.map +0 -1
- package/dist/pcm-agents/p-B2EtEi7v.js +0 -146
- package/dist/pcm-agents/p-B2EtEi7v.js.map +0 -1
- package/dist/pcm-agents/p-e21bc169.entry.js +0 -2
- package/dist/pcm-agents/p-e21bc169.entry.js.map +0 -1
- package/dist/pcm-agents/pcm-app-chat-modal.pcm-chat-message.pcm-mnms-modal.entry.esm.js.map +0 -1
- package/dist/pcm-agents/pcm-hr-chat-modal.entry.esm.js.map +0 -1
- package/dist/pcm-agents/pcm-video-chat-modal.entry.esm.js.map +0 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, u as uploadFileToBackend, a as sendHttpRequest, h } from './index.js';
|
|
2
|
+
import { d as defineCustomElement$3 } from './p-BctfuDvG.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './p-LkDC0SN2.js';
|
|
4
|
+
|
|
5
|
+
const pcmJlpxModalCss = ":host{display:block}.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;overflow-y:auto;padding:20px;z-index:1000}.fullscreen-overlay{padding:0}.modal-container{background:white;border-radius:8px;width:100%;max-width:500px;display:flex;flex-direction:column;position:relative;margin:auto;transition:all 0.3s ease-out;overflow:hidden}.modal-container.fullscreen{width:100vw;max-width:none;height:100%;border-radius:0;margin:0;display:flex;flex-direction:column;height:100vh;max-height:100vh}.pc-layout{width:80%;max-width:500px;min-width:320px}.mobile-layout{width:100%;height:100%;border-radius:0}@media screen and (max-width: 768px){.pc-layout{width:95%}.modal-overlay{padding:0}.modal-container.fullscreen{height:-webkit-fill-available;max-height:-webkit-fill-available;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);margin-top:40px;height:calc(100% - 40px);max-height:calc(100% - 40px);border-radius:16px 16px 0 0}.modal-container.mobile-layout{width:100%;height:100vh;max-height:100vh;min-height:100vh;border-radius:0;margin:0;display:flex;flex-direction:column}}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:4px 16px;height:50px;border-bottom:1px solid #e8e8e8;flex-shrink:0;}.header-left{display:flex;align-items:center;gap:8px}.header-icon{width:24px;height:24px}.close-button{background:transparent;border:none;cursor:pointer;padding:8px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:4px}.close-button:hover{background-color:rgba(0, 0, 0, 0.04)}.close-button span{font-size:24px;line-height:1;color:#999}.close-button:hover span{color:#666}.file-input{display:none}.chat-modal-container{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column}";
|
|
6
|
+
|
|
7
|
+
const globalCss = ".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;z-index:1000;overflow-y:auto;padding:20px}.fullscreen-overlay{padding:0;background-color:rgba(0, 0, 0, 0.7)}.modal-container{background-color:#fff;border-radius:8px;width:100%;display:flex;flex-direction:column;position:relative;margin:auto;transition:all 0.3s ease-out;overflow:hidden}.modal-container.fullscreen{width:100vw;max-width:none;height:100%;border-radius:0;margin:0;display:flex;flex-direction:column;height:100vh;max-height:100vh}.pc-layout{width:80%;max-width:500px;min-width:320px}.mobile-layout{width:100%;height:100%;border-radius:0}@media screen and (max-width: 768px){.pc-layout{width:95%}.modal-overlay{padding:0}.modal-container.fullscreen{height:-webkit-fill-available;max-height:-webkit-fill-available;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);margin-top:40px;height:calc(100% - 40px);max-height:calc(100% - 40px);border-radius:16px 16px 0 0}.modal-container.mobile-layout{width:100%;height:100vh;max-height:100vh;min-height:100vh;border-radius:0;margin:0;display:flex;flex-direction:column}}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:4px 16px;height:50px;border-bottom:1px solid #e8e8e8;flex-shrink:0}.header-left{display:flex;align-items:center;gap:8px}.header-icon{width:24px;height:24px}.close-button{background:transparent;border:none;cursor:pointer;padding:8px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:4px}.close-button:hover{background-color:rgba(0, 0, 0, 0.04)}.close-button span{font-size:24px;line-height:1;color:#999}.close-button:hover span{color:#666}.upload-area{border:2px dashed #ddd;border-radius:8px;cursor:pointer;transition:all 0.3s ease;margin-bottom:20px;width:100%}.upload-area:hover{border-color:#1890ff;background-color:rgba(24, 144, 255, 0.05)}.upload-placeholder{display:flex;flex-direction:column;align-items:center;color:#666}.upload-placeholder svg{color:#1890ff;margin-bottom:8px}.upload-placeholder p{margin:4px 0}.upload-hint{font-size:0.8rem;color:#999;margin-top:0.5rem}.file-info{display:flex;align-items:center;justify-content:space-between;padding:8px;background:#f9f9f9;border:1px solid #e8e8e8;border-radius:4px}.file-info span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 30px)}.remove-file{background:transparent;border:none;color:#999;cursor:pointer;padding:4px 8px;font-size:16px;line-height:1;border-radius:4px;transition:all 0.2s}.remove-file:hover{background-color:#f0f0f0;color:#666}.file-input{display:none}.input-container{padding:20px;display:flex;flex-direction:column;height:calc(100% - 50px);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:100%;border:1px solid #ddd;border-radius:4px;resize:vertical;font-family:inherit;font-size:14px;line-height:1.5;transition:border-color 0.3s}.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;align-items:center}.resume-upload-section label{display:block;margin-bottom:8px;font-weight:500;color:#333;align-self:flex-start}.submit-button{margin-top:10px;padding:10px 30px;background:#1890ff;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:disabled{background:#ccc;cursor:not-allowed}.submit-button:hover:not(:disabled){background:#40a9ff}.chat-modal-container{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column}";
|
|
8
|
+
|
|
9
|
+
const JlpxModal = /*@__PURE__*/ proxyCustomElement(class JlpxModal extends H {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.modalClosed = createEvent(this, "modalClosed");
|
|
15
|
+
this.uploadSuccess = createEvent(this, "uploadSuccess");
|
|
16
|
+
this.streamComplete = createEvent(this, "streamComplete");
|
|
17
|
+
this.conversationStart = createEvent(this, "conversationStart");
|
|
18
|
+
this.interviewComplete = createEvent(this, "interviewComplete");
|
|
19
|
+
this.apiKeyInvalid = createEvent(this, "apiKeyInvalid");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 模态框标题
|
|
23
|
+
*/
|
|
24
|
+
modalTitle = '简历剖析助手';
|
|
25
|
+
/**
|
|
26
|
+
* API鉴权密钥
|
|
27
|
+
*/
|
|
28
|
+
token = '';
|
|
29
|
+
/**
|
|
30
|
+
* 是否显示聊天模态框
|
|
31
|
+
*/
|
|
32
|
+
isOpen = false;
|
|
33
|
+
/**
|
|
34
|
+
* 当点击模态框关闭时触发
|
|
35
|
+
*/
|
|
36
|
+
modalClosed;
|
|
37
|
+
/**
|
|
38
|
+
* 应用图标URL
|
|
39
|
+
*/
|
|
40
|
+
icon;
|
|
41
|
+
/**
|
|
42
|
+
* 聊天框的页面层级
|
|
43
|
+
*/
|
|
44
|
+
zIndex = 1000;
|
|
45
|
+
/**
|
|
46
|
+
* 是否展示顶部标题栏
|
|
47
|
+
*/
|
|
48
|
+
isShowHeader = true;
|
|
49
|
+
/**
|
|
50
|
+
* 是否展示右上角的关闭按钮
|
|
51
|
+
*/
|
|
52
|
+
isNeedClose = true;
|
|
53
|
+
/**
|
|
54
|
+
* 会话ID,传入继续对话,否则创建新会话
|
|
55
|
+
*/
|
|
56
|
+
conversationId;
|
|
57
|
+
/**
|
|
58
|
+
* 默认查询文本
|
|
59
|
+
*/
|
|
60
|
+
defaultQuery = '';
|
|
61
|
+
/**
|
|
62
|
+
* 是否以全屏模式打开,移动端建议设置为true
|
|
63
|
+
*/
|
|
64
|
+
fullscreen = false;
|
|
65
|
+
/**
|
|
66
|
+
* 自定义输入参数,传入job_info时,会隐藏JD输入区域
|
|
67
|
+
*/
|
|
68
|
+
customInputs = {};
|
|
69
|
+
/**
|
|
70
|
+
* 上传成功事件
|
|
71
|
+
*/
|
|
72
|
+
uploadSuccess;
|
|
73
|
+
/**
|
|
74
|
+
* 流式输出完成事件
|
|
75
|
+
*/
|
|
76
|
+
streamComplete;
|
|
77
|
+
/**
|
|
78
|
+
* 新会话开始的回调,只会在一轮对话开始时触发一次
|
|
79
|
+
*/
|
|
80
|
+
conversationStart;
|
|
81
|
+
/**
|
|
82
|
+
* 当聊天完成时触发
|
|
83
|
+
*/
|
|
84
|
+
interviewComplete;
|
|
85
|
+
/**
|
|
86
|
+
* API密钥验证失败事件
|
|
87
|
+
*/
|
|
88
|
+
apiKeyInvalid;
|
|
89
|
+
selectedFile = null;
|
|
90
|
+
isUploading = false;
|
|
91
|
+
uploadedFileInfo = null;
|
|
92
|
+
showChatModal = false;
|
|
93
|
+
jobDescription = '';
|
|
94
|
+
isSubmitting = false;
|
|
95
|
+
// 添加新的状态来控制过渡动画
|
|
96
|
+
isTransitioning = false;
|
|
97
|
+
transitionTimer = null;
|
|
98
|
+
get hostElement() { return this; }
|
|
99
|
+
handleClose = () => {
|
|
100
|
+
this.isOpen = false;
|
|
101
|
+
this.modalClosed.emit();
|
|
102
|
+
};
|
|
103
|
+
handleFileChange = (event) => {
|
|
104
|
+
const input = event.target;
|
|
105
|
+
if (input.files && input.files.length > 0) {
|
|
106
|
+
this.selectedFile = input.files[0];
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
handleUploadClick = () => {
|
|
110
|
+
const fileInput = this.hostElement.shadowRoot?.querySelector('.file-input');
|
|
111
|
+
fileInput?.click();
|
|
112
|
+
};
|
|
113
|
+
clearSelectedFile = () => {
|
|
114
|
+
this.selectedFile = null;
|
|
115
|
+
this.uploadedFileInfo = null;
|
|
116
|
+
const fileInput = this.hostElement.shadowRoot?.querySelector('.file-input');
|
|
117
|
+
if (fileInput) {
|
|
118
|
+
fileInput.value = '';
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
handleJobDescriptionChange = (event) => {
|
|
122
|
+
const textarea = event.target;
|
|
123
|
+
this.jobDescription = textarea.value;
|
|
124
|
+
};
|
|
125
|
+
async uploadFile() {
|
|
126
|
+
if (!this.selectedFile)
|
|
127
|
+
return;
|
|
128
|
+
this.isUploading = true;
|
|
129
|
+
try {
|
|
130
|
+
const result = await uploadFileToBackend(this.selectedFile, {
|
|
131
|
+
'authorization': 'Bearer ' + this.token
|
|
132
|
+
});
|
|
133
|
+
this.uploadedFileInfo = result;
|
|
134
|
+
// 触发上传成功事件
|
|
135
|
+
this.uploadSuccess.emit(result);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
console.error('文件上传错误:', error);
|
|
139
|
+
this.clearSelectedFile();
|
|
140
|
+
alert(error instanceof Error ? error.message : '文件上传失败,请重试');
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
this.isUploading = false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
handleStartAnalysis = async () => {
|
|
147
|
+
if (!this.selectedFile) {
|
|
148
|
+
alert('请上传简历');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// 如果没有预设的job_info,则需要检查用户输入
|
|
152
|
+
if (!this.customInputs?.job_info && !this.jobDescription.trim()) {
|
|
153
|
+
alert('请输入职位描述');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.isSubmitting = true;
|
|
157
|
+
try {
|
|
158
|
+
// 如果还没上传,先上传文件
|
|
159
|
+
if (!this.uploadedFileInfo) {
|
|
160
|
+
await this.uploadFile();
|
|
161
|
+
if (!this.uploadedFileInfo) {
|
|
162
|
+
this.isSubmitting = false;
|
|
163
|
+
return; // 上传失败
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// 使用预设的job_info或用户输入的jobDescription
|
|
167
|
+
const jobInfo = this.customInputs?.job_info || this.jobDescription;
|
|
168
|
+
console.log('传递的customInputs:', {
|
|
169
|
+
...this.customInputs,
|
|
170
|
+
file_url: this.uploadedFileInfo.cos_key,
|
|
171
|
+
job_info: jobInfo
|
|
172
|
+
});
|
|
173
|
+
// 直接显示聊天模态框
|
|
174
|
+
this.showChatModal = true;
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
console.error('开始分析时出错:', error);
|
|
178
|
+
alert('开始分析时出错,请重试');
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
this.isSubmitting = false;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
handleIsOpenChange(newValue) {
|
|
185
|
+
if (!newValue) {
|
|
186
|
+
// 重置状态
|
|
187
|
+
this.clearSelectedFile();
|
|
188
|
+
this.showChatModal = false;
|
|
189
|
+
this.jobDescription = '';
|
|
190
|
+
// 清除可能存在的计时器
|
|
191
|
+
if (this.transitionTimer) {
|
|
192
|
+
clearTimeout(this.transitionTimer);
|
|
193
|
+
this.transitionTimer = null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// 当模态框打开时,验证API密钥
|
|
198
|
+
this.verifyApiKey();
|
|
199
|
+
if (this.conversationId) {
|
|
200
|
+
// 如果有会话ID,直接显示聊天模态框
|
|
201
|
+
this.showChatModal = true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 验证API密钥
|
|
207
|
+
*/
|
|
208
|
+
async verifyApiKey() {
|
|
209
|
+
if (!this.token) {
|
|
210
|
+
this.apiKeyInvalid.emit();
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const response = await sendHttpRequest({
|
|
215
|
+
url: '/sdk/v1/user',
|
|
216
|
+
method: 'GET',
|
|
217
|
+
headers: {
|
|
218
|
+
'Authorization': `Bearer ${this.token}`
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
if (!response.success) {
|
|
222
|
+
throw new Error(response.message || 'API密钥验证失败');
|
|
223
|
+
}
|
|
224
|
+
// 验证成功,继续正常流程
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
console.error('API密钥验证错误:', error);
|
|
228
|
+
// 通知父组件API密钥无效
|
|
229
|
+
this.apiKeyInvalid.emit();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
componentWillLoad() {
|
|
233
|
+
// 检查 customInputs 中是否有 job_info
|
|
234
|
+
if (this.customInputs && this.customInputs.job_info) {
|
|
235
|
+
this.jobDescription = this.customInputs.job_info;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
// 处理流式输出完成事件
|
|
239
|
+
handleStreamComplete = (event) => {
|
|
240
|
+
// 将事件转发出去
|
|
241
|
+
this.streamComplete.emit(event.detail);
|
|
242
|
+
};
|
|
243
|
+
// 处理会话开始事件
|
|
244
|
+
handleConversationStart = (event) => {
|
|
245
|
+
this.conversationStart.emit(event.detail);
|
|
246
|
+
};
|
|
247
|
+
// 处理面试完成事件
|
|
248
|
+
handleInterviewComplete = (event) => {
|
|
249
|
+
this.interviewComplete.emit(event.detail);
|
|
250
|
+
};
|
|
251
|
+
render() {
|
|
252
|
+
if (!this.isOpen)
|
|
253
|
+
return null;
|
|
254
|
+
const modalStyle = {
|
|
255
|
+
zIndex: String(this.zIndex)
|
|
256
|
+
};
|
|
257
|
+
const containerClass = {
|
|
258
|
+
'modal-container': true,
|
|
259
|
+
'fullscreen': this.fullscreen,
|
|
260
|
+
'pc-layout': true,
|
|
261
|
+
};
|
|
262
|
+
const overlayClass = {
|
|
263
|
+
'modal-overlay': true,
|
|
264
|
+
'fullscreen-overlay': this.fullscreen
|
|
265
|
+
};
|
|
266
|
+
// 检查是否有会话ID,如果有则直接显示聊天模态框
|
|
267
|
+
if (this.conversationId && !this.showChatModal) {
|
|
268
|
+
this.showChatModal = true;
|
|
269
|
+
}
|
|
270
|
+
// 修正这里的逻辑,确保当 customInputs.job_info 存在时,hideJdInput 为 true
|
|
271
|
+
const hideJdInput = Boolean(this.customInputs && this.customInputs.job_info);
|
|
272
|
+
return (h("div", { class: overlayClass, style: modalStyle }, h("div", { class: containerClass }, this.isShowHeader && (h("div", { class: "modal-header" }, h("div", { class: "header-left" }, this.icon && h("img", { src: this.icon, class: "header-icon", alt: "\u5E94\u7528\u56FE\u6807" }), h("div", null, this.modalTitle)), this.isNeedClose && (h("button", { class: "close-button", onClick: this.handleClose }, h("span", null, "\u00D7"))))), !this.showChatModal && !this.conversationId && (h("div", { class: "input-container" }, !hideJdInput && (h("div", { class: "jd-input-section" }, h("label", { htmlFor: "job-description" }, "\u8BF7\u8F93\u5165\u804C\u4F4D\u63CF\u8FF0 (JD)"), h("textarea", { id: "job-description", class: "job-description-textarea", placeholder: "\u8BF7\u8F93\u5165\u804C\u4F4D\u63CF\u8FF0\uFF0C\u5305\u62EC\u804C\u8D23\u3001\u8981\u6C42\u7B49\u4FE1\u606F...", rows: 6, value: this.jobDescription, onInput: this.handleJobDescriptionChange }))), h("div", { class: "resume-upload-section" }, h("label", null, "\u4E0A\u4F20\u7B80\u5386"), h("div", { class: "upload-area", onClick: this.handleUploadClick }, this.selectedFile ? (h("div", { class: "file-info" }, h("span", null, this.selectedFile.name), h("button", { class: "remove-file", onClick: (e) => {
|
|
273
|
+
e.stopPropagation();
|
|
274
|
+
this.clearSelectedFile();
|
|
275
|
+
} }, "\u00D7"))) : (h("div", { class: "upload-placeholder" }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", width: "48", height: "48" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M12 4v16m0-16l-4 4m4-4l4 4" })), h("p", null, "\u70B9\u51FB\u4E0A\u4F20\u7B80\u5386"), h("p", { class: "upload-hint" }, "\u652F\u6301 txt\u3001markdown\u3001pdf\u3001docx\u3001md \u683C\u5F0F"))))), h("button", { class: "submit-button", disabled: !this.selectedFile || (!hideJdInput && !this.jobDescription.trim()) || this.isUploading || this.isSubmitting, onClick: this.handleStartAnalysis }, this.isUploading ? '上传中...' : this.isSubmitting ? '处理中...' : '开始分析'), h("input", { type: "file", class: "file-input", onChange: this.handleFileChange, accept: ".pdf,.doc,.docx,.txt,.md" }))), this.showChatModal && (h("div", { class: "chat-modal-container" }, h("pcm-app-chat-modal", { isOpen: true, modalTitle: this.modalTitle, icon: this.icon, token: this.token, isShowHeader: this.isShowHeader, isNeedClose: this.isShowHeader, zIndex: this.zIndex, fullscreen: this.fullscreen, conversationId: this.conversationId, defaultQuery: this.defaultQuery, enableTTS: false, enableVoice: false, botId: "3022316191018881", customInputs: this.conversationId ? undefined : {
|
|
276
|
+
...this.customInputs,
|
|
277
|
+
file_url: this.uploadedFileInfo?.cos_key,
|
|
278
|
+
job_info: this.customInputs?.job_info || this.jobDescription
|
|
279
|
+
}, interviewMode: "text", onModalClosed: this.handleClose, onStreamComplete: this.handleStreamComplete, onConversationStart: this.handleConversationStart, onInterviewComplete: this.handleInterviewComplete }))))));
|
|
280
|
+
}
|
|
281
|
+
static get watchers() { return {
|
|
282
|
+
"isOpen": ["handleIsOpenChange"]
|
|
283
|
+
}; }
|
|
284
|
+
static get style() { return pcmJlpxModalCss + globalCss; }
|
|
285
|
+
}, [1, "pcm-jlpx-modal", {
|
|
286
|
+
"modalTitle": [1, "modal-title"],
|
|
287
|
+
"token": [1],
|
|
288
|
+
"isOpen": [1028, "is-open"],
|
|
289
|
+
"icon": [1],
|
|
290
|
+
"zIndex": [2, "z-index"],
|
|
291
|
+
"isShowHeader": [4, "is-show-header"],
|
|
292
|
+
"isNeedClose": [4, "is-need-close"],
|
|
293
|
+
"conversationId": [1025, "conversation-id"],
|
|
294
|
+
"defaultQuery": [1, "default-query"],
|
|
295
|
+
"fullscreen": [4],
|
|
296
|
+
"customInputs": [16],
|
|
297
|
+
"selectedFile": [32],
|
|
298
|
+
"isUploading": [32],
|
|
299
|
+
"uploadedFileInfo": [32],
|
|
300
|
+
"showChatModal": [32],
|
|
301
|
+
"jobDescription": [32],
|
|
302
|
+
"isSubmitting": [32],
|
|
303
|
+
"isTransitioning": [32],
|
|
304
|
+
"transitionTimer": [32]
|
|
305
|
+
}, undefined, {
|
|
306
|
+
"isOpen": ["handleIsOpenChange"]
|
|
307
|
+
}]);
|
|
308
|
+
function defineCustomElement$1() {
|
|
309
|
+
if (typeof customElements === "undefined") {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const components = ["pcm-jlpx-modal", "pcm-app-chat-modal", "pcm-chat-message"];
|
|
313
|
+
components.forEach(tagName => { switch (tagName) {
|
|
314
|
+
case "pcm-jlpx-modal":
|
|
315
|
+
if (!customElements.get(tagName)) {
|
|
316
|
+
customElements.define(tagName, JlpxModal);
|
|
317
|
+
}
|
|
318
|
+
break;
|
|
319
|
+
case "pcm-app-chat-modal":
|
|
320
|
+
if (!customElements.get(tagName)) {
|
|
321
|
+
defineCustomElement$3();
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
case "pcm-chat-message":
|
|
325
|
+
if (!customElements.get(tagName)) {
|
|
326
|
+
defineCustomElement$2();
|
|
327
|
+
}
|
|
328
|
+
break;
|
|
329
|
+
} });
|
|
330
|
+
}
|
|
331
|
+
defineCustomElement$1();
|
|
332
|
+
|
|
333
|
+
const PcmJlpxModal = JlpxModal;
|
|
334
|
+
const defineCustomElement = defineCustomElement$1;
|
|
335
|
+
|
|
336
|
+
export { PcmJlpxModal, defineCustomElement };
|
|
337
|
+
//# sourceMappingURL=pcm-jlpx-modal.js.map
|
|
338
|
+
|
|
339
|
+
//# sourceMappingURL=pcm-jlpx-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"pcm-jlpx-modal.js","mappings":";;;;AAAA,MAAM,eAAe,GAAG,u1DAAu1D;;ACA/2D,MAAM,SAAS,GAAG,61HAA61H;;MCQl2H,SAAS,iBAAAA,kBAAA,CAAA,MAAA,SAAA,SAAAC,CAAA,CAAA;;;;;;;;;;;;AAClB;;AAEG;IACK,UAAU,GAAW,QAAQ;AAErC;;AAEG;IAC2B,KAAK,GAAW,EAAE;AAEhD;;AAEG;IACsB,MAAM,GAAY,KAAK;AAEhD;;AAEG;AACM,IAAA,WAAW;AAEpB;;AAEG;AACK,IAAA,IAAI;AAEZ;;AAEG;IACK,MAAM,GAAY,IAAI;AAE9B;;AAEG;IACK,YAAY,GAAY,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,YAAY,EAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,KAAK,EAChB,WAAW,EAAE,KAAK,EAClB,KAAK,EAAC,kBAAkB,EACxB,YAAY,EAAE,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG;gBAC5C,GAAG,IAAI,CAAC,YAAY;AACpB,gBAAA,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO;gBACxC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,IAAI,IAAI,CAAC;AACjD,aAAA,EACD,aAAa,EAAC,MAAM,EACpB,aAAa,EAAE,IAAI,CAAC,WAAW,EAC/B,gBAAgB,EAAE,IAAI,CAAC,oBAAoB,EAC3C,mBAAmB,EAAE,IAAI,CAAC,uBAAuB,EACjD,mBAAmB,EAAE,IAAI,CAAC,uBAAuB,GAC/B,CACpB,CACT,CACC,CACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/pcm-jlpx-modal/pcm-jlpx-modal.css?tag=pcm-jlpx-modal&encapsulation=shadow","src/global/global.css?tag=pcm-jlpx-modal&encapsulation=shadow","src/components/pcm-jlpx-modal/pcm-jlpx-modal.tsx"],"sourcesContent":[":host {\r\n display: block;\r\n}\r\n\r\n.modal-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n overflow-y: auto;\r\n padding: 20px;\r\n z-index: 1000;\r\n}\r\n\r\n/* 全屏模式下取消 padding */\r\n.fullscreen-overlay {\r\n padding: 0;\r\n}\r\n\r\n.modal-container {\r\n background: white;\r\n border-radius: 8px;\r\n width: 100%;\r\n max-width: 500px;\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n margin: auto;\r\n transition: all 0.3s ease-out;\r\n overflow: hidden;\r\n}\r\n\r\n/* 全屏模式样式 */\r\n.modal-container.fullscreen {\r\n width: 100vw;\r\n max-width: none;\r\n height: 100%;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n height: 100vh;\r\n max-height: 100vh;\r\n}\r\n\r\n/* PC端布局 */\r\n.pc-layout {\r\n width: 80%;\r\n max-width: 500px;\r\n min-width: 320px;\r\n}\r\n\r\n/* 移动端布局 */\r\n.mobile-layout {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 0;\r\n}\r\n\r\n/* 响应式布局 */\r\n@media screen and (max-width: 768px) {\r\n .pc-layout {\r\n width: 95%;\r\n }\r\n\r\n .modal-overlay {\r\n padding: 0;\r\n }\r\n\r\n .modal-container.fullscreen {\r\n /* 支持 iOS Safari */\r\n height: -webkit-fill-available;\r\n max-height: -webkit-fill-available;\r\n /* 确保内容不会被顶部状态栏和底部工具栏遮挡 */\r\n padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);\r\n margin-top: 40px;\r\n height: calc(100% - 40px);\r\n max-height: calc(100% - 40px);\r\n border-radius: 16px 16px 0 0;\r\n }\r\n\r\n .modal-container.mobile-layout {\r\n width: 100%;\r\n height: 100vh;\r\n max-height: 100vh;\r\n min-height: 100vh;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n}\r\n\r\n.modal-header {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n padding: 4px 16px;\r\n height: 50px;\r\n border-bottom: 1px solid #e8e8e8;\r\n flex-shrink: 0; /* 防止头部被压缩 */\r\n}\r\n\r\n.header-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n}\r\n\r\n.header-icon {\r\n width: 24px;\r\n height: 24px;\r\n}\r\n\r\n.close-button {\r\n background: transparent;\r\n border: none;\r\n cursor: pointer;\r\n padding: 8px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 32px;\r\n height: 32px;\r\n border-radius: 4px;\r\n}\r\n\r\n.close-button:hover {\r\n background-color: rgba(0, 0, 0, 0.04);\r\n}\r\n\r\n.close-button span {\r\n font-size: 24px;\r\n line-height: 1;\r\n color: #999;\r\n}\r\n\r\n.close-button:hover span {\r\n color: #666;\r\n}\r\n\r\n\r\n\r\n.file-input {\r\n display: none;\r\n}\r\n\r\n/* 聊天模态框容器 */\r\n.chat-modal-container {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n display: flex;\r\n flex-direction: column;\r\n} ","/* 模态框基础样式 */\r\n.modal-overlay {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n overflow-y: auto;\r\n padding: 20px;\r\n}\r\n\r\n/* 全屏模式下取消 padding */\r\n.fullscreen-overlay {\r\n padding: 0;\r\n background-color: rgba(0, 0, 0, 0.7);\r\n}\r\n\r\n.modal-container {\r\n background-color: #fff;\r\n border-radius: 8px;\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n margin: auto;\r\n transition: all 0.3s ease-out;\r\n overflow: hidden;\r\n}\r\n\r\n/* 全屏模式样式 */\r\n.modal-container.fullscreen {\r\n width: 100vw;\r\n max-width: none;\r\n height: 100%;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n height: 100vh;\r\n max-height: 100vh;\r\n}\r\n\r\n/* PC端布局 */\r\n.pc-layout {\r\n width: 80%;\r\n max-width: 500px;\r\n min-width: 320px;\r\n}\r\n\r\n/* 移动端布局 */\r\n.mobile-layout {\r\n width: 100%;\r\n height: 100%;\r\n border-radius: 0;\r\n}\r\n\r\n/* 响应式布局 */\r\n@media screen and (max-width: 768px) {\r\n .pc-layout {\r\n width: 95%;\r\n }\r\n\r\n .modal-overlay {\r\n padding: 0;\r\n }\r\n\r\n .modal-container.fullscreen {\r\n /* 支持 iOS Safari */\r\n height: -webkit-fill-available;\r\n max-height: -webkit-fill-available;\r\n /* 确保内容不会被顶部状态栏和底部工具栏遮挡 */\r\n padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);\r\n margin-top: 40px;\r\n height: calc(100% - 40px);\r\n max-height: calc(100% - 40px);\r\n border-radius: 16px 16px 0 0;\r\n }\r\n\r\n .modal-container.mobile-layout {\r\n width: 100%;\r\n height: 100vh;\r\n max-height: 100vh;\r\n min-height: 100vh;\r\n border-radius: 0;\r\n margin: 0;\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n}\r\n\r\n/* 模态框头部样式 */\r\n.modal-header {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n padding: 4px 16px;\r\n height: 50px;\r\n border-bottom: 1px solid #e8e8e8;\r\n flex-shrink: 0;\r\n}\r\n\r\n.header-left {\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n}\r\n\r\n.header-icon {\r\n width: 24px;\r\n height: 24px;\r\n}\r\n\r\n.close-button {\r\n background: transparent;\r\n border: none;\r\n cursor: pointer;\r\n padding: 8px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 32px;\r\n height: 32px;\r\n border-radius: 4px;\r\n}\r\n\r\n.close-button:hover {\r\n background-color: rgba(0, 0, 0, 0.04);\r\n}\r\n\r\n.close-button span {\r\n font-size: 24px;\r\n line-height: 1;\r\n color: #999;\r\n}\r\n\r\n.close-button:hover span {\r\n color: #666;\r\n}\r\n\r\n\r\n/* 文件上传区域通用样式 */\r\n.upload-area {\r\n border: 2px dashed #ddd;\r\n border-radius: 8px;\r\n cursor: pointer;\r\n transition: all 0.3s ease;\r\n margin-bottom: 20px;\r\n width: 100%;\r\n}\r\n\r\n.upload-area:hover {\r\n border-color: #1890ff;\r\n background-color: rgba(24, 144, 255, 0.05);\r\n}\r\n\r\n\r\n.upload-placeholder {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n color: #666;\r\n}\r\n\r\n.upload-placeholder svg {\r\n color: #1890ff;\r\n margin-bottom: 8px;\r\n}\r\n\r\n.upload-placeholder p {\r\n margin: 4px 0;\r\n}\r\n\r\n.upload-hint {\r\n font-size: 0.8rem;\r\n color: #999;\r\n margin-top: 0.5rem;\r\n}\r\n\r\n.file-info {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n padding: 8px;\r\n background: #f9f9f9;\r\n border: 1px solid #e8e8e8;\r\n border-radius: 4px;\r\n}\r\n\r\n.file-info span {\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n max-width: calc(100% - 30px);\r\n}\r\n\r\n.remove-file {\r\n background: transparent;\r\n border: none;\r\n color: #999;\r\n cursor: pointer;\r\n padding: 4px 8px;\r\n font-size: 16px;\r\n line-height: 1;\r\n border-radius: 4px;\r\n transition: all 0.2s;\r\n}\r\n\r\n.remove-file:hover {\r\n background-color: #f0f0f0;\r\n color: #666;\r\n}\r\n\r\n.file-input {\r\n display: none;\r\n}\r\n\r\n\r\n\r\n/* 输入容器样式 */\r\n.input-container {\r\n padding: 20px;\r\n display: flex;\r\n flex-direction: column;\r\n height: calc(100% - 50px);\r\n /* 减去header高度 */\r\n overflow-y: auto;\r\n}\r\n\r\n.input-container h3 {\r\n margin-top: 0;\r\n margin-bottom: 20px;\r\n font-size: 18px;\r\n color: #333;\r\n text-align: center;\r\n}\r\n\r\n/* JD输入区域样式 */\r\n.jd-input-section {\r\n margin-bottom: 20px;\r\n}\r\n\r\n.jd-input-section label {\r\n display: block;\r\n margin-bottom: 8px;\r\n font-weight: 500;\r\n color: #333;\r\n}\r\n\r\n.job-description-textarea {\r\n width: 100%;\r\n border: 1px solid #ddd;\r\n border-radius: 4px;\r\n resize: vertical;\r\n font-family: inherit;\r\n font-size: 14px;\r\n line-height: 1.5;\r\n transition: border-color 0.3s;\r\n}\r\n\r\n.job-description-textarea:focus {\r\n outline: none;\r\n border-color: #1890ff;\r\n box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);\r\n}\r\n\r\n/* 简历上传区域样式 */\r\n.resume-upload-section {\r\n margin-bottom: 20px;\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n}\r\n\r\n.resume-upload-section label {\r\n display: block;\r\n margin-bottom: 8px;\r\n font-weight: 500;\r\n color: #333;\r\n align-self: flex-start;\r\n}\r\n\r\n\r\n/* 提交按钮通用样式 */\r\n.submit-button {\r\n margin-top: 10px;\r\n padding: 10px 30px;\r\n background: #1890ff;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n font-size: 16px;\r\n cursor: pointer;\r\n transition: all 0.3s ease;\r\n width: 100%;\r\n max-width: 400px;\r\n align-self: center;\r\n /* 确保按钮居中 */\r\n}\r\n\r\n.submit-button:disabled {\r\n background: #ccc;\r\n cursor: not-allowed;\r\n}\r\n\r\n.submit-button:hover:not(:disabled) {\r\n background: #40a9ff;\r\n}\r\n\r\n/* 聊天模态框容器 */\r\n.chat-modal-container {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n display: flex;\r\n flex-direction: column;\r\n}","import { Component, Prop, h, State, Element, Event, EventEmitter, Watch } from '@stencil/core';\r\nimport { uploadFileToBackend, FileUploadResponse, sendHttpRequest } from '../../utils/utils';\r\n\r\n@Component({\r\n tag: 'pcm-jlpx-modal',\r\n styleUrls: ['pcm-jlpx-modal.css','../../global/global.css'],\r\n shadow: true,\r\n})\r\nexport class JlpxModal {\r\n /**\r\n * 模态框标题\r\n */\r\n @Prop() modalTitle: string = '简历剖析助手';\r\n\r\n /**\r\n * API鉴权密钥\r\n */\r\n @Prop({ attribute: 'token' }) token: string = '';\r\n\r\n /**\r\n * 是否显示聊天模态框\r\n */\r\n @Prop({ mutable: true }) isOpen: boolean = false;\r\n\r\n /**\r\n * 当点击模态框关闭时触发\r\n */\r\n @Event() modalClosed: EventEmitter<void>;\r\n\r\n /**\r\n * 应用图标URL\r\n */\r\n @Prop() icon?: string;\r\n\r\n /**\r\n * 聊天框的页面层级\r\n */\r\n @Prop() zIndex?: number = 1000;\r\n\r\n /**\r\n * 是否展示顶部标题栏\r\n */\r\n @Prop() isShowHeader: boolean = true;\r\n\r\n /**\r\n * 是否展示右上角的关闭按钮\r\n */\r\n @Prop() isNeedClose: boolean = true;\r\n\r\n /**\r\n * 会话ID,传入继续对话,否则创建新会话\r\n */\r\n @Prop({ mutable: true }) conversationId?: string;\r\n\r\n /**\r\n * 默认查询文本\r\n */\r\n @Prop() defaultQuery: string = '';\r\n\r\n /**\r\n * 是否以全屏模式打开,移动端建议设置为true\r\n */\r\n @Prop() fullscreen: boolean = false;\r\n\r\n\r\n /**\r\n * 自定义输入参数,传入job_info时,会隐藏JD输入区域\r\n */\r\n @Prop() customInputs: { [key: string]: any } = {};\r\n\r\n /**\r\n * 上传成功事件\r\n */\r\n @Event() uploadSuccess: EventEmitter<FileUploadResponse>;\r\n\r\n /**\r\n * 流式输出完成事件\r\n */\r\n @Event() streamComplete: EventEmitter<{\r\n conversation_id: string;\r\n event: string;\r\n message_id: string;\r\n id: string;\r\n }>;\r\n\r\n /**\r\n * 新会话开始的回调,只会在一轮对话开始时触发一次\r\n */\r\n @Event() conversationStart: EventEmitter<{\r\n conversation_id: string;\r\n event: string;\r\n message_id: string;\r\n id: string;\r\n }>;\r\n\r\n /**\r\n * 当聊天完成时触发\r\n */\r\n @Event() interviewComplete: EventEmitter<{\r\n conversation_id: string;\r\n total_questions: number;\r\n }>;\r\n\r\n /**\r\n * API密钥验证失败事件\r\n */\r\n @Event() apiKeyInvalid: EventEmitter<void>;\r\n\r\n @State() selectedFile: File | null = null;\r\n @State() isUploading: boolean = false;\r\n @State() uploadedFileInfo: FileUploadResponse | null = null;\r\n @State() showChatModal: boolean = false;\r\n @State() jobDescription: string = '';\r\n @State() isSubmitting: boolean = false;\r\n\r\n // 添加新的状态来控制过渡动画\r\n @State() isTransitioning: boolean = false;\r\n @State() transitionTimer: any = null;\r\n\r\n // 使用 @Element 装饰器获取组件的 host 元素\r\n @Element() hostElement: HTMLElement;\r\n\r\n private handleClose = () => {\r\n this.isOpen = false;\r\n this.modalClosed.emit();\r\n };\r\n\r\n private handleFileChange = (event: Event) => {\r\n const input = event.target as HTMLInputElement;\r\n if (input.files && input.files.length > 0) {\r\n this.selectedFile = input.files[0];\r\n }\r\n };\r\n\r\n private handleUploadClick = () => {\r\n const fileInput = this.hostElement.shadowRoot?.querySelector('.file-input') as HTMLInputElement;\r\n fileInput?.click();\r\n };\r\n\r\n private clearSelectedFile = () => {\r\n this.selectedFile = null;\r\n this.uploadedFileInfo = null;\r\n const fileInput = this.hostElement.shadowRoot?.querySelector('.file-input') as HTMLInputElement;\r\n if (fileInput) {\r\n fileInput.value = '';\r\n }\r\n };\r\n\r\n private handleJobDescriptionChange = (event: Event) => {\r\n const textarea = event.target as HTMLTextAreaElement;\r\n this.jobDescription = textarea.value;\r\n };\r\n\r\n private async uploadFile() {\r\n if (!this.selectedFile) return;\r\n\r\n this.isUploading = true;\r\n\r\n try {\r\n const result = await uploadFileToBackend(this.selectedFile, {\r\n 'authorization': 'Bearer ' + this.token\r\n });\r\n\r\n this.uploadedFileInfo = result;\r\n // 触发上传成功事件\r\n this.uploadSuccess.emit(result);\r\n } catch (error) {\r\n console.error('文件上传错误:', error);\r\n this.clearSelectedFile();\r\n alert(error instanceof Error ? error.message : '文件上传失败,请重试');\r\n } finally {\r\n this.isUploading = false;\r\n }\r\n }\r\n\r\n private handleStartAnalysis = async () => {\r\n if (!this.selectedFile) {\r\n alert('请上传简历');\r\n return;\r\n }\r\n\r\n // 如果没有预设的job_info,则需要检查用户输入\r\n if (!this.customInputs?.job_info && !this.jobDescription.trim()) {\r\n alert('请输入职位描述');\r\n return;\r\n }\r\n\r\n this.isSubmitting = true;\r\n\r\n try {\r\n // 如果还没上传,先上传文件\r\n if (!this.uploadedFileInfo) {\r\n await this.uploadFile();\r\n if (!this.uploadedFileInfo) {\r\n this.isSubmitting = false;\r\n return; // 上传失败\r\n }\r\n }\r\n\r\n // 使用预设的job_info或用户输入的jobDescription\r\n const jobInfo = this.customInputs?.job_info || this.jobDescription;\r\n\r\n console.log('传递的customInputs:', {\r\n ...this.customInputs,\r\n file_url: this.uploadedFileInfo.cos_key,\r\n job_info: jobInfo\r\n });\r\n\r\n // 直接显示聊天模态框\r\n this.showChatModal = true;\r\n } catch (error) {\r\n console.error('开始分析时出错:', error);\r\n alert('开始分析时出错,请重试');\r\n } finally {\r\n this.isSubmitting = false;\r\n }\r\n };\r\n\r\n @Watch('isOpen')\r\n handleIsOpenChange(newValue: boolean) {\r\n if (!newValue) {\r\n // 重置状态\r\n this.clearSelectedFile();\r\n this.showChatModal = false;\r\n this.jobDescription = '';\r\n \r\n // 清除可能存在的计时器\r\n if (this.transitionTimer) {\r\n clearTimeout(this.transitionTimer);\r\n this.transitionTimer = null;\r\n }\r\n } else {\r\n // 当模态框打开时,验证API密钥\r\n this.verifyApiKey();\r\n \r\n if (this.conversationId) {\r\n // 如果有会话ID,直接显示聊天模态框\r\n this.showChatModal = true;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 验证API密钥\r\n */\r\n private async verifyApiKey() {\r\n if (!this.token) {\r\n this.apiKeyInvalid.emit();\r\n return;\r\n }\r\n try {\r\n const response = await sendHttpRequest({\r\n url: '/sdk/v1/user',\r\n method: 'GET',\r\n headers: {\r\n 'Authorization': `Bearer ${this.token}`\r\n }\r\n });\r\n\r\n if (!response.success) {\r\n throw new Error(response.message || 'API密钥验证失败');\r\n }\r\n \r\n // 验证成功,继续正常流程\r\n } catch (error) {\r\n console.error('API密钥验证错误:', error);\r\n // 通知父组件API密钥无效\r\n this.apiKeyInvalid.emit();\r\n } \r\n }\r\n\r\n componentWillLoad() {\r\n // 检查 customInputs 中是否有 job_info\r\n if (this.customInputs && this.customInputs.job_info) {\r\n this.jobDescription = this.customInputs.job_info;\r\n }\r\n }\r\n\r\n // 处理流式输出完成事件\r\n private handleStreamComplete = (event: CustomEvent) => {\r\n // 将事件转发出去\r\n this.streamComplete.emit(event.detail);\r\n };\r\n\r\n // 处理会话开始事件\r\n private handleConversationStart = (event: CustomEvent) => {\r\n this.conversationStart.emit(event.detail);\r\n };\r\n\r\n // 处理面试完成事件\r\n private handleInterviewComplete = (event: CustomEvent) => {\r\n this.interviewComplete.emit(event.detail);\r\n };\r\n\r\n render() {\r\n if (!this.isOpen) return null;\r\n\r\n const modalStyle = {\r\n zIndex: String(this.zIndex)\r\n };\r\n\r\n const containerClass = {\r\n 'modal-container': true,\r\n 'fullscreen': this.fullscreen,\r\n 'pc-layout': true,\r\n };\r\n \r\n const overlayClass = {\r\n 'modal-overlay': true,\r\n 'fullscreen-overlay': this.fullscreen\r\n };\r\n\r\n // 检查是否有会话ID,如果有则直接显示聊天模态框\r\n if (this.conversationId && !this.showChatModal) {\r\n this.showChatModal = true;\r\n }\r\n\r\n // 修正这里的逻辑,确保当 customInputs.job_info 存在时,hideJdInput 为 true\r\n const hideJdInput = Boolean(this.customInputs && this.customInputs.job_info);\r\n\r\n return (\r\n <div class={overlayClass} style={modalStyle}>\r\n <div class={containerClass}>\r\n {this.isShowHeader && (\r\n <div class=\"modal-header\">\r\n <div class=\"header-left\">\r\n {this.icon && <img src={this.icon} class=\"header-icon\" alt=\"应用图标\" />}\r\n <div>{this.modalTitle}</div>\r\n </div>\r\n {this.isNeedClose && (\r\n <button class=\"close-button\" onClick={this.handleClose}>\r\n <span>×</span>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n\r\n {/* 输入界面 - 仅在不显示聊天模态框且没有会话ID时显示 */}\r\n {!this.showChatModal && !this.conversationId && (\r\n <div class=\"input-container\">\r\n {/* JD输入区域 - 仅在没有customInputs.job_info时显示 */}\r\n {!hideJdInput && (\r\n <div class=\"jd-input-section\">\r\n <label htmlFor=\"job-description\">请输入职位描述 (JD)</label>\r\n <textarea \r\n id=\"job-description\"\r\n class=\"job-description-textarea\"\r\n placeholder=\"请输入职位描述,包括职责、要求等信息...\"\r\n rows={6}\r\n value={this.jobDescription}\r\n onInput={this.handleJobDescriptionChange}\r\n ></textarea>\r\n </div>\r\n )}\r\n \r\n {/* 简历上传区域 */}\r\n <div class=\"resume-upload-section\">\r\n <label>上传简历</label>\r\n <div class=\"upload-area\" onClick={this.handleUploadClick}>\r\n {this.selectedFile ? (\r\n <div class=\"file-info\">\r\n <span>{this.selectedFile.name}</span>\r\n <button class=\"remove-file\" onClick={(e) => {\r\n e.stopPropagation();\r\n this.clearSelectedFile();\r\n }}>×</button>\r\n </div>\r\n ) : (\r\n <div class=\"upload-placeholder\">\r\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" width=\"48\" height=\"48\">\r\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 4v16m0-16l-4 4m4-4l4 4\" />\r\n </svg>\r\n <p>点击上传简历</p>\r\n <p class=\"upload-hint\">支持 txt、markdown、pdf、docx、md 格式</p>\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n\r\n <button\r\n class=\"submit-button\"\r\n disabled={!this.selectedFile || (!hideJdInput && !this.jobDescription.trim()) || this.isUploading || this.isSubmitting}\r\n onClick={this.handleStartAnalysis}\r\n >\r\n {this.isUploading ? '上传中...' : this.isSubmitting ? '处理中...' : '开始分析'}\r\n </button>\r\n\r\n <input\r\n type=\"file\"\r\n class=\"file-input\"\r\n onChange={this.handleFileChange}\r\n accept=\".pdf,.doc,.docx,.txt,.md\"\r\n />\r\n </div>\r\n )}\r\n\r\n {/* 聊天界面 - 在显示聊天模态框时显示 */}\r\n {this.showChatModal && (\r\n <div class=\"chat-modal-container\">\r\n <pcm-app-chat-modal\r\n isOpen={true}\r\n modalTitle={this.modalTitle}\r\n icon={this.icon}\r\n token={this.token}\r\n isShowHeader={this.isShowHeader} \r\n isNeedClose={this.isShowHeader} \r\n zIndex={this.zIndex}\r\n fullscreen={this.fullscreen}\r\n conversationId={this.conversationId}\r\n defaultQuery={this.defaultQuery}\r\n enableTTS={false}\r\n enableVoice={false}\r\n botId=\"3022316191018881\"\r\n customInputs={this.conversationId ? undefined : {\r\n ...this.customInputs,\r\n file_url: this.uploadedFileInfo?.cos_key,\r\n job_info: this.customInputs?.job_info || this.jobDescription\r\n }}\r\n interviewMode=\"text\"\r\n onModalClosed={this.handleClose}\r\n onStreamComplete={this.handleStreamComplete}\r\n onConversationStart={this.handleConversationStart}\r\n onInterviewComplete={this.handleInterviewComplete}\r\n ></pcm-app-chat-modal>\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n );\r\n }\r\n} "],"version":3}
|