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,616 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { uploadFileToBackend, sendHttpRequest } from "../../utils/utils";
|
|
3
|
+
export class JlpxModal {
|
|
4
|
+
/**
|
|
5
|
+
* 模态框标题
|
|
6
|
+
*/
|
|
7
|
+
modalTitle = '简历剖析助手';
|
|
8
|
+
/**
|
|
9
|
+
* API鉴权密钥
|
|
10
|
+
*/
|
|
11
|
+
token = '';
|
|
12
|
+
/**
|
|
13
|
+
* 是否显示聊天模态框
|
|
14
|
+
*/
|
|
15
|
+
isOpen = false;
|
|
16
|
+
/**
|
|
17
|
+
* 当点击模态框关闭时触发
|
|
18
|
+
*/
|
|
19
|
+
modalClosed;
|
|
20
|
+
/**
|
|
21
|
+
* 应用图标URL
|
|
22
|
+
*/
|
|
23
|
+
icon;
|
|
24
|
+
/**
|
|
25
|
+
* 聊天框的页面层级
|
|
26
|
+
*/
|
|
27
|
+
zIndex = 1000;
|
|
28
|
+
/**
|
|
29
|
+
* 是否展示顶部标题栏
|
|
30
|
+
*/
|
|
31
|
+
isShowHeader = true;
|
|
32
|
+
/**
|
|
33
|
+
* 是否展示右上角的关闭按钮
|
|
34
|
+
*/
|
|
35
|
+
isNeedClose = true;
|
|
36
|
+
/**
|
|
37
|
+
* 会话ID,传入继续对话,否则创建新会话
|
|
38
|
+
*/
|
|
39
|
+
conversationId;
|
|
40
|
+
/**
|
|
41
|
+
* 默认查询文本
|
|
42
|
+
*/
|
|
43
|
+
defaultQuery = '';
|
|
44
|
+
/**
|
|
45
|
+
* 是否以全屏模式打开,移动端建议设置为true
|
|
46
|
+
*/
|
|
47
|
+
fullscreen = false;
|
|
48
|
+
/**
|
|
49
|
+
* 自定义输入参数,传入job_info时,会隐藏JD输入区域
|
|
50
|
+
*/
|
|
51
|
+
customInputs = {};
|
|
52
|
+
/**
|
|
53
|
+
* 上传成功事件
|
|
54
|
+
*/
|
|
55
|
+
uploadSuccess;
|
|
56
|
+
/**
|
|
57
|
+
* 流式输出完成事件
|
|
58
|
+
*/
|
|
59
|
+
streamComplete;
|
|
60
|
+
/**
|
|
61
|
+
* 新会话开始的回调,只会在一轮对话开始时触发一次
|
|
62
|
+
*/
|
|
63
|
+
conversationStart;
|
|
64
|
+
/**
|
|
65
|
+
* 当聊天完成时触发
|
|
66
|
+
*/
|
|
67
|
+
interviewComplete;
|
|
68
|
+
/**
|
|
69
|
+
* API密钥验证失败事件
|
|
70
|
+
*/
|
|
71
|
+
apiKeyInvalid;
|
|
72
|
+
selectedFile = null;
|
|
73
|
+
isUploading = false;
|
|
74
|
+
uploadedFileInfo = null;
|
|
75
|
+
showChatModal = false;
|
|
76
|
+
jobDescription = '';
|
|
77
|
+
isSubmitting = false;
|
|
78
|
+
// 添加新的状态来控制过渡动画
|
|
79
|
+
isTransitioning = false;
|
|
80
|
+
transitionTimer = null;
|
|
81
|
+
// 使用 @Element 装饰器获取组件的 host 元素
|
|
82
|
+
hostElement;
|
|
83
|
+
handleClose = () => {
|
|
84
|
+
this.isOpen = false;
|
|
85
|
+
this.modalClosed.emit();
|
|
86
|
+
};
|
|
87
|
+
handleFileChange = (event) => {
|
|
88
|
+
const input = event.target;
|
|
89
|
+
if (input.files && input.files.length > 0) {
|
|
90
|
+
this.selectedFile = input.files[0];
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
handleUploadClick = () => {
|
|
94
|
+
const fileInput = this.hostElement.shadowRoot?.querySelector('.file-input');
|
|
95
|
+
fileInput?.click();
|
|
96
|
+
};
|
|
97
|
+
clearSelectedFile = () => {
|
|
98
|
+
this.selectedFile = null;
|
|
99
|
+
this.uploadedFileInfo = null;
|
|
100
|
+
const fileInput = this.hostElement.shadowRoot?.querySelector('.file-input');
|
|
101
|
+
if (fileInput) {
|
|
102
|
+
fileInput.value = '';
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
handleJobDescriptionChange = (event) => {
|
|
106
|
+
const textarea = event.target;
|
|
107
|
+
this.jobDescription = textarea.value;
|
|
108
|
+
};
|
|
109
|
+
async uploadFile() {
|
|
110
|
+
if (!this.selectedFile)
|
|
111
|
+
return;
|
|
112
|
+
this.isUploading = true;
|
|
113
|
+
try {
|
|
114
|
+
const result = await uploadFileToBackend(this.selectedFile, {
|
|
115
|
+
'authorization': 'Bearer ' + this.token
|
|
116
|
+
});
|
|
117
|
+
this.uploadedFileInfo = result;
|
|
118
|
+
// 触发上传成功事件
|
|
119
|
+
this.uploadSuccess.emit(result);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
console.error('文件上传错误:', error);
|
|
123
|
+
this.clearSelectedFile();
|
|
124
|
+
alert(error instanceof Error ? error.message : '文件上传失败,请重试');
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
this.isUploading = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
handleStartAnalysis = async () => {
|
|
131
|
+
if (!this.selectedFile) {
|
|
132
|
+
alert('请上传简历');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// 如果没有预设的job_info,则需要检查用户输入
|
|
136
|
+
if (!this.customInputs?.job_info && !this.jobDescription.trim()) {
|
|
137
|
+
alert('请输入职位描述');
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
this.isSubmitting = true;
|
|
141
|
+
try {
|
|
142
|
+
// 如果还没上传,先上传文件
|
|
143
|
+
if (!this.uploadedFileInfo) {
|
|
144
|
+
await this.uploadFile();
|
|
145
|
+
if (!this.uploadedFileInfo) {
|
|
146
|
+
this.isSubmitting = false;
|
|
147
|
+
return; // 上传失败
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// 使用预设的job_info或用户输入的jobDescription
|
|
151
|
+
const jobInfo = this.customInputs?.job_info || this.jobDescription;
|
|
152
|
+
console.log('传递的customInputs:', {
|
|
153
|
+
...this.customInputs,
|
|
154
|
+
file_url: this.uploadedFileInfo.cos_key,
|
|
155
|
+
job_info: jobInfo
|
|
156
|
+
});
|
|
157
|
+
// 直接显示聊天模态框
|
|
158
|
+
this.showChatModal = true;
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error('开始分析时出错:', error);
|
|
162
|
+
alert('开始分析时出错,请重试');
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
this.isSubmitting = false;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
handleIsOpenChange(newValue) {
|
|
169
|
+
if (!newValue) {
|
|
170
|
+
// 重置状态
|
|
171
|
+
this.clearSelectedFile();
|
|
172
|
+
this.showChatModal = false;
|
|
173
|
+
this.jobDescription = '';
|
|
174
|
+
// 清除可能存在的计时器
|
|
175
|
+
if (this.transitionTimer) {
|
|
176
|
+
clearTimeout(this.transitionTimer);
|
|
177
|
+
this.transitionTimer = null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
// 当模态框打开时,验证API密钥
|
|
182
|
+
this.verifyApiKey();
|
|
183
|
+
if (this.conversationId) {
|
|
184
|
+
// 如果有会话ID,直接显示聊天模态框
|
|
185
|
+
this.showChatModal = true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 验证API密钥
|
|
191
|
+
*/
|
|
192
|
+
async verifyApiKey() {
|
|
193
|
+
if (!this.token) {
|
|
194
|
+
this.apiKeyInvalid.emit();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const response = await sendHttpRequest({
|
|
199
|
+
url: '/sdk/v1/user',
|
|
200
|
+
method: 'GET',
|
|
201
|
+
headers: {
|
|
202
|
+
'Authorization': `Bearer ${this.token}`
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
if (!response.success) {
|
|
206
|
+
throw new Error(response.message || 'API密钥验证失败');
|
|
207
|
+
}
|
|
208
|
+
// 验证成功,继续正常流程
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
console.error('API密钥验证错误:', error);
|
|
212
|
+
// 通知父组件API密钥无效
|
|
213
|
+
this.apiKeyInvalid.emit();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
componentWillLoad() {
|
|
217
|
+
// 检查 customInputs 中是否有 job_info
|
|
218
|
+
if (this.customInputs && this.customInputs.job_info) {
|
|
219
|
+
this.jobDescription = this.customInputs.job_info;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// 处理流式输出完成事件
|
|
223
|
+
handleStreamComplete = (event) => {
|
|
224
|
+
// 将事件转发出去
|
|
225
|
+
this.streamComplete.emit(event.detail);
|
|
226
|
+
};
|
|
227
|
+
// 处理会话开始事件
|
|
228
|
+
handleConversationStart = (event) => {
|
|
229
|
+
this.conversationStart.emit(event.detail);
|
|
230
|
+
};
|
|
231
|
+
// 处理面试完成事件
|
|
232
|
+
handleInterviewComplete = (event) => {
|
|
233
|
+
this.interviewComplete.emit(event.detail);
|
|
234
|
+
};
|
|
235
|
+
render() {
|
|
236
|
+
if (!this.isOpen)
|
|
237
|
+
return null;
|
|
238
|
+
const modalStyle = {
|
|
239
|
+
zIndex: String(this.zIndex)
|
|
240
|
+
};
|
|
241
|
+
const containerClass = {
|
|
242
|
+
'modal-container': true,
|
|
243
|
+
'fullscreen': this.fullscreen,
|
|
244
|
+
'pc-layout': true,
|
|
245
|
+
};
|
|
246
|
+
const overlayClass = {
|
|
247
|
+
'modal-overlay': true,
|
|
248
|
+
'fullscreen-overlay': this.fullscreen
|
|
249
|
+
};
|
|
250
|
+
// 检查是否有会话ID,如果有则直接显示聊天模态框
|
|
251
|
+
if (this.conversationId && !this.showChatModal) {
|
|
252
|
+
this.showChatModal = true;
|
|
253
|
+
}
|
|
254
|
+
// 修正这里的逻辑,确保当 customInputs.job_info 存在时,hideJdInput 为 true
|
|
255
|
+
const hideJdInput = Boolean(this.customInputs && this.customInputs.job_info);
|
|
256
|
+
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) => {
|
|
257
|
+
e.stopPropagation();
|
|
258
|
+
this.clearSelectedFile();
|
|
259
|
+
} }, "\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 : {
|
|
260
|
+
...this.customInputs,
|
|
261
|
+
file_url: this.uploadedFileInfo?.cos_key,
|
|
262
|
+
job_info: this.customInputs?.job_info || this.jobDescription
|
|
263
|
+
}, interviewMode: "text", onModalClosed: this.handleClose, onStreamComplete: this.handleStreamComplete, onConversationStart: this.handleConversationStart, onInterviewComplete: this.handleInterviewComplete }))))));
|
|
264
|
+
}
|
|
265
|
+
static get is() { return "pcm-jlpx-modal"; }
|
|
266
|
+
static get encapsulation() { return "shadow"; }
|
|
267
|
+
static get originalStyleUrls() {
|
|
268
|
+
return {
|
|
269
|
+
"$": ["pcm-jlpx-modal.css", "../../global/global.css"]
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
static get styleUrls() {
|
|
273
|
+
return {
|
|
274
|
+
"$": ["pcm-jlpx-modal.css", "../../global/global.css"]
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
static get properties() {
|
|
278
|
+
return {
|
|
279
|
+
"modalTitle": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"mutable": false,
|
|
282
|
+
"complexType": {
|
|
283
|
+
"original": "string",
|
|
284
|
+
"resolved": "string",
|
|
285
|
+
"references": {}
|
|
286
|
+
},
|
|
287
|
+
"required": false,
|
|
288
|
+
"optional": false,
|
|
289
|
+
"docs": {
|
|
290
|
+
"tags": [],
|
|
291
|
+
"text": "\u6A21\u6001\u6846\u6807\u9898"
|
|
292
|
+
},
|
|
293
|
+
"getter": false,
|
|
294
|
+
"setter": false,
|
|
295
|
+
"attribute": "modal-title",
|
|
296
|
+
"reflect": false,
|
|
297
|
+
"defaultValue": "'\u7B80\u5386\u5256\u6790\u52A9\u624B'"
|
|
298
|
+
},
|
|
299
|
+
"token": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"mutable": false,
|
|
302
|
+
"complexType": {
|
|
303
|
+
"original": "string",
|
|
304
|
+
"resolved": "string",
|
|
305
|
+
"references": {}
|
|
306
|
+
},
|
|
307
|
+
"required": false,
|
|
308
|
+
"optional": false,
|
|
309
|
+
"docs": {
|
|
310
|
+
"tags": [],
|
|
311
|
+
"text": "API\u9274\u6743\u5BC6\u94A5"
|
|
312
|
+
},
|
|
313
|
+
"getter": false,
|
|
314
|
+
"setter": false,
|
|
315
|
+
"attribute": "token",
|
|
316
|
+
"reflect": false,
|
|
317
|
+
"defaultValue": "''"
|
|
318
|
+
},
|
|
319
|
+
"isOpen": {
|
|
320
|
+
"type": "boolean",
|
|
321
|
+
"mutable": true,
|
|
322
|
+
"complexType": {
|
|
323
|
+
"original": "boolean",
|
|
324
|
+
"resolved": "boolean",
|
|
325
|
+
"references": {}
|
|
326
|
+
},
|
|
327
|
+
"required": false,
|
|
328
|
+
"optional": false,
|
|
329
|
+
"docs": {
|
|
330
|
+
"tags": [],
|
|
331
|
+
"text": "\u662F\u5426\u663E\u793A\u804A\u5929\u6A21\u6001\u6846"
|
|
332
|
+
},
|
|
333
|
+
"getter": false,
|
|
334
|
+
"setter": false,
|
|
335
|
+
"attribute": "is-open",
|
|
336
|
+
"reflect": false,
|
|
337
|
+
"defaultValue": "false"
|
|
338
|
+
},
|
|
339
|
+
"icon": {
|
|
340
|
+
"type": "string",
|
|
341
|
+
"mutable": false,
|
|
342
|
+
"complexType": {
|
|
343
|
+
"original": "string",
|
|
344
|
+
"resolved": "string",
|
|
345
|
+
"references": {}
|
|
346
|
+
},
|
|
347
|
+
"required": false,
|
|
348
|
+
"optional": true,
|
|
349
|
+
"docs": {
|
|
350
|
+
"tags": [],
|
|
351
|
+
"text": "\u5E94\u7528\u56FE\u6807URL"
|
|
352
|
+
},
|
|
353
|
+
"getter": false,
|
|
354
|
+
"setter": false,
|
|
355
|
+
"attribute": "icon",
|
|
356
|
+
"reflect": false
|
|
357
|
+
},
|
|
358
|
+
"zIndex": {
|
|
359
|
+
"type": "number",
|
|
360
|
+
"mutable": false,
|
|
361
|
+
"complexType": {
|
|
362
|
+
"original": "number",
|
|
363
|
+
"resolved": "number",
|
|
364
|
+
"references": {}
|
|
365
|
+
},
|
|
366
|
+
"required": false,
|
|
367
|
+
"optional": true,
|
|
368
|
+
"docs": {
|
|
369
|
+
"tags": [],
|
|
370
|
+
"text": "\u804A\u5929\u6846\u7684\u9875\u9762\u5C42\u7EA7"
|
|
371
|
+
},
|
|
372
|
+
"getter": false,
|
|
373
|
+
"setter": false,
|
|
374
|
+
"attribute": "z-index",
|
|
375
|
+
"reflect": false,
|
|
376
|
+
"defaultValue": "1000"
|
|
377
|
+
},
|
|
378
|
+
"isShowHeader": {
|
|
379
|
+
"type": "boolean",
|
|
380
|
+
"mutable": false,
|
|
381
|
+
"complexType": {
|
|
382
|
+
"original": "boolean",
|
|
383
|
+
"resolved": "boolean",
|
|
384
|
+
"references": {}
|
|
385
|
+
},
|
|
386
|
+
"required": false,
|
|
387
|
+
"optional": false,
|
|
388
|
+
"docs": {
|
|
389
|
+
"tags": [],
|
|
390
|
+
"text": "\u662F\u5426\u5C55\u793A\u9876\u90E8\u6807\u9898\u680F"
|
|
391
|
+
},
|
|
392
|
+
"getter": false,
|
|
393
|
+
"setter": false,
|
|
394
|
+
"attribute": "is-show-header",
|
|
395
|
+
"reflect": false,
|
|
396
|
+
"defaultValue": "true"
|
|
397
|
+
},
|
|
398
|
+
"isNeedClose": {
|
|
399
|
+
"type": "boolean",
|
|
400
|
+
"mutable": false,
|
|
401
|
+
"complexType": {
|
|
402
|
+
"original": "boolean",
|
|
403
|
+
"resolved": "boolean",
|
|
404
|
+
"references": {}
|
|
405
|
+
},
|
|
406
|
+
"required": false,
|
|
407
|
+
"optional": false,
|
|
408
|
+
"docs": {
|
|
409
|
+
"tags": [],
|
|
410
|
+
"text": "\u662F\u5426\u5C55\u793A\u53F3\u4E0A\u89D2\u7684\u5173\u95ED\u6309\u94AE"
|
|
411
|
+
},
|
|
412
|
+
"getter": false,
|
|
413
|
+
"setter": false,
|
|
414
|
+
"attribute": "is-need-close",
|
|
415
|
+
"reflect": false,
|
|
416
|
+
"defaultValue": "true"
|
|
417
|
+
},
|
|
418
|
+
"conversationId": {
|
|
419
|
+
"type": "string",
|
|
420
|
+
"mutable": true,
|
|
421
|
+
"complexType": {
|
|
422
|
+
"original": "string",
|
|
423
|
+
"resolved": "string",
|
|
424
|
+
"references": {}
|
|
425
|
+
},
|
|
426
|
+
"required": false,
|
|
427
|
+
"optional": true,
|
|
428
|
+
"docs": {
|
|
429
|
+
"tags": [],
|
|
430
|
+
"text": "\u4F1A\u8BDDID\uFF0C\u4F20\u5165\u7EE7\u7EED\u5BF9\u8BDD\uFF0C\u5426\u5219\u521B\u5EFA\u65B0\u4F1A\u8BDD"
|
|
431
|
+
},
|
|
432
|
+
"getter": false,
|
|
433
|
+
"setter": false,
|
|
434
|
+
"attribute": "conversation-id",
|
|
435
|
+
"reflect": false
|
|
436
|
+
},
|
|
437
|
+
"defaultQuery": {
|
|
438
|
+
"type": "string",
|
|
439
|
+
"mutable": false,
|
|
440
|
+
"complexType": {
|
|
441
|
+
"original": "string",
|
|
442
|
+
"resolved": "string",
|
|
443
|
+
"references": {}
|
|
444
|
+
},
|
|
445
|
+
"required": false,
|
|
446
|
+
"optional": false,
|
|
447
|
+
"docs": {
|
|
448
|
+
"tags": [],
|
|
449
|
+
"text": "\u9ED8\u8BA4\u67E5\u8BE2\u6587\u672C"
|
|
450
|
+
},
|
|
451
|
+
"getter": false,
|
|
452
|
+
"setter": false,
|
|
453
|
+
"attribute": "default-query",
|
|
454
|
+
"reflect": false,
|
|
455
|
+
"defaultValue": "''"
|
|
456
|
+
},
|
|
457
|
+
"fullscreen": {
|
|
458
|
+
"type": "boolean",
|
|
459
|
+
"mutable": false,
|
|
460
|
+
"complexType": {
|
|
461
|
+
"original": "boolean",
|
|
462
|
+
"resolved": "boolean",
|
|
463
|
+
"references": {}
|
|
464
|
+
},
|
|
465
|
+
"required": false,
|
|
466
|
+
"optional": false,
|
|
467
|
+
"docs": {
|
|
468
|
+
"tags": [],
|
|
469
|
+
"text": "\u662F\u5426\u4EE5\u5168\u5C4F\u6A21\u5F0F\u6253\u5F00\uFF0C\u79FB\u52A8\u7AEF\u5EFA\u8BAE\u8BBE\u7F6E\u4E3Atrue"
|
|
470
|
+
},
|
|
471
|
+
"getter": false,
|
|
472
|
+
"setter": false,
|
|
473
|
+
"attribute": "fullscreen",
|
|
474
|
+
"reflect": false,
|
|
475
|
+
"defaultValue": "false"
|
|
476
|
+
},
|
|
477
|
+
"customInputs": {
|
|
478
|
+
"type": "unknown",
|
|
479
|
+
"mutable": false,
|
|
480
|
+
"complexType": {
|
|
481
|
+
"original": "{ [key: string]: any }",
|
|
482
|
+
"resolved": "{ [key: string]: any; }",
|
|
483
|
+
"references": {}
|
|
484
|
+
},
|
|
485
|
+
"required": false,
|
|
486
|
+
"optional": false,
|
|
487
|
+
"docs": {
|
|
488
|
+
"tags": [],
|
|
489
|
+
"text": "\u81EA\u5B9A\u4E49\u8F93\u5165\u53C2\u6570\uFF0C\u4F20\u5165job_info\u65F6\uFF0C\u4F1A\u9690\u85CFJD\u8F93\u5165\u533A\u57DF"
|
|
490
|
+
},
|
|
491
|
+
"getter": false,
|
|
492
|
+
"setter": false,
|
|
493
|
+
"defaultValue": "{}"
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
static get states() {
|
|
498
|
+
return {
|
|
499
|
+
"selectedFile": {},
|
|
500
|
+
"isUploading": {},
|
|
501
|
+
"uploadedFileInfo": {},
|
|
502
|
+
"showChatModal": {},
|
|
503
|
+
"jobDescription": {},
|
|
504
|
+
"isSubmitting": {},
|
|
505
|
+
"isTransitioning": {},
|
|
506
|
+
"transitionTimer": {}
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
static get events() {
|
|
510
|
+
return [{
|
|
511
|
+
"method": "modalClosed",
|
|
512
|
+
"name": "modalClosed",
|
|
513
|
+
"bubbles": true,
|
|
514
|
+
"cancelable": true,
|
|
515
|
+
"composed": true,
|
|
516
|
+
"docs": {
|
|
517
|
+
"tags": [],
|
|
518
|
+
"text": "\u5F53\u70B9\u51FB\u6A21\u6001\u6846\u5173\u95ED\u65F6\u89E6\u53D1"
|
|
519
|
+
},
|
|
520
|
+
"complexType": {
|
|
521
|
+
"original": "void",
|
|
522
|
+
"resolved": "void",
|
|
523
|
+
"references": {}
|
|
524
|
+
}
|
|
525
|
+
}, {
|
|
526
|
+
"method": "uploadSuccess",
|
|
527
|
+
"name": "uploadSuccess",
|
|
528
|
+
"bubbles": true,
|
|
529
|
+
"cancelable": true,
|
|
530
|
+
"composed": true,
|
|
531
|
+
"docs": {
|
|
532
|
+
"tags": [],
|
|
533
|
+
"text": "\u4E0A\u4F20\u6210\u529F\u4E8B\u4EF6"
|
|
534
|
+
},
|
|
535
|
+
"complexType": {
|
|
536
|
+
"original": "FileUploadResponse",
|
|
537
|
+
"resolved": "FileUploadResponse",
|
|
538
|
+
"references": {
|
|
539
|
+
"FileUploadResponse": {
|
|
540
|
+
"location": "import",
|
|
541
|
+
"path": "../../utils/utils",
|
|
542
|
+
"id": "src/utils/utils.ts::FileUploadResponse"
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}, {
|
|
547
|
+
"method": "streamComplete",
|
|
548
|
+
"name": "streamComplete",
|
|
549
|
+
"bubbles": true,
|
|
550
|
+
"cancelable": true,
|
|
551
|
+
"composed": true,
|
|
552
|
+
"docs": {
|
|
553
|
+
"tags": [],
|
|
554
|
+
"text": "\u6D41\u5F0F\u8F93\u51FA\u5B8C\u6210\u4E8B\u4EF6"
|
|
555
|
+
},
|
|
556
|
+
"complexType": {
|
|
557
|
+
"original": "{\r\n conversation_id: string;\r\n event: string;\r\n message_id: string;\r\n id: string;\r\n }",
|
|
558
|
+
"resolved": "{ conversation_id: string; event: string; message_id: string; id: string; }",
|
|
559
|
+
"references": {}
|
|
560
|
+
}
|
|
561
|
+
}, {
|
|
562
|
+
"method": "conversationStart",
|
|
563
|
+
"name": "conversationStart",
|
|
564
|
+
"bubbles": true,
|
|
565
|
+
"cancelable": true,
|
|
566
|
+
"composed": true,
|
|
567
|
+
"docs": {
|
|
568
|
+
"tags": [],
|
|
569
|
+
"text": "\u65B0\u4F1A\u8BDD\u5F00\u59CB\u7684\u56DE\u8C03\uFF0C\u53EA\u4F1A\u5728\u4E00\u8F6E\u5BF9\u8BDD\u5F00\u59CB\u65F6\u89E6\u53D1\u4E00\u6B21"
|
|
570
|
+
},
|
|
571
|
+
"complexType": {
|
|
572
|
+
"original": "{\r\n conversation_id: string;\r\n event: string;\r\n message_id: string;\r\n id: string;\r\n }",
|
|
573
|
+
"resolved": "{ conversation_id: string; event: string; message_id: string; id: string; }",
|
|
574
|
+
"references": {}
|
|
575
|
+
}
|
|
576
|
+
}, {
|
|
577
|
+
"method": "interviewComplete",
|
|
578
|
+
"name": "interviewComplete",
|
|
579
|
+
"bubbles": true,
|
|
580
|
+
"cancelable": true,
|
|
581
|
+
"composed": true,
|
|
582
|
+
"docs": {
|
|
583
|
+
"tags": [],
|
|
584
|
+
"text": "\u5F53\u804A\u5929\u5B8C\u6210\u65F6\u89E6\u53D1"
|
|
585
|
+
},
|
|
586
|
+
"complexType": {
|
|
587
|
+
"original": "{\r\n conversation_id: string;\r\n total_questions: number;\r\n }",
|
|
588
|
+
"resolved": "{ conversation_id: string; total_questions: number; }",
|
|
589
|
+
"references": {}
|
|
590
|
+
}
|
|
591
|
+
}, {
|
|
592
|
+
"method": "apiKeyInvalid",
|
|
593
|
+
"name": "apiKeyInvalid",
|
|
594
|
+
"bubbles": true,
|
|
595
|
+
"cancelable": true,
|
|
596
|
+
"composed": true,
|
|
597
|
+
"docs": {
|
|
598
|
+
"tags": [],
|
|
599
|
+
"text": "API\u5BC6\u94A5\u9A8C\u8BC1\u5931\u8D25\u4E8B\u4EF6"
|
|
600
|
+
},
|
|
601
|
+
"complexType": {
|
|
602
|
+
"original": "void",
|
|
603
|
+
"resolved": "void",
|
|
604
|
+
"references": {}
|
|
605
|
+
}
|
|
606
|
+
}];
|
|
607
|
+
}
|
|
608
|
+
static get elementRef() { return "hostElement"; }
|
|
609
|
+
static get watchers() {
|
|
610
|
+
return [{
|
|
611
|
+
"propName": "isOpen",
|
|
612
|
+
"methodName": "handleIsOpenChange"
|
|
613
|
+
}];
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
//# sourceMappingURL=pcm-jlpx-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pcm-jlpx-modal.js","sourceRoot":"","sources":["../../../src/components/pcm-jlpx-modal/pcm-jlpx-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAsB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAO7F,MAAM,OAAO,SAAS;IAClB;;OAEG;IACK,UAAU,GAAW,QAAQ,CAAC;IAEtC;;OAEG;IAC2B,KAAK,GAAW,EAAE,CAAC;IAEjD;;OAEG;IACsB,MAAM,GAAY,KAAK,CAAC;IAEjD;;OAEG;IACM,WAAW,CAAqB;IAEzC;;OAEG;IACK,IAAI,CAAU;IAEtB;;OAEG;IACK,MAAM,GAAY,IAAI,CAAC;IAE/B;;OAEG;IACK,YAAY,GAAY,IAAI,CAAC;IAErC;;OAEG;IACK,WAAW,GAAY,IAAI,CAAC;IAEpC;;OAEG;IACsB,cAAc,CAAU;IAEjD;;OAEG;IACK,YAAY,GAAW,EAAE,CAAC;IAElC;;OAEG;IACK,UAAU,GAAY,KAAK,CAAC;IAGpC;;OAEG;IACK,YAAY,GAA2B,EA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I,CAAC,YAAY,EAC/B,SAAS,EAAE,KAAK,EAChB,WAAW,EAAE,KAAK,EAClB,KAAK,EAAC,kBAAkB,EACxB,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;4BAC5C,GAAG,IAAI,CAAC,YAAY;4BACpB,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO;4BACxC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,IAAI,IAAI,CAAC,cAAc;yBAC/D,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,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["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} "]}
|