@sim-design/training 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +33 -0
  2. package/dist/ArrowLeftOutlined-CiSQq3bL.js +12 -0
  3. package/dist/AssessmentPlugin-Bx4VrBdV.js +607 -0
  4. package/dist/CaseAnalysisPlugin-CQvF9_zr.js +416 -0
  5. package/dist/CharacterDialoguePanel-Bvdab3qj.js +776 -0
  6. package/dist/CheckCircleFilled-Byo8CDfW.js +12 -0
  7. package/dist/CustomLayoutRenderer--rnQrqQ2.js +122524 -0
  8. package/dist/DecisionSelectPlugin-DtQ2KV34.js +863 -0
  9. package/dist/DecisionShared-Dh9oeQFT.js +65 -0
  10. package/dist/DialogueFormPlugin-C9ssnVMr.js +959 -0
  11. package/dist/DialoguePlugin-DU00QpmQ.js +416 -0
  12. package/dist/DocumentReviewPlugin-HNOZY1T4.js +977 -0
  13. package/dist/EyeOutlined-XvOAKlLs.js +12 -0
  14. package/dist/FormFillingPlugin-DURWsioi.js +445 -0
  15. package/dist/ModelEditor-BPJsPR0S.js +8264 -0
  16. package/dist/PluginHeader-B-GESJmT.js +87 -0
  17. package/dist/ProcessOperationPlugin-IijngDlX.js +88 -0
  18. package/dist/QAPlugin-Bh_UjK1N.js +184 -0
  19. package/dist/RadarChart-C5ZM0kWt.js +24963 -0
  20. package/dist/ReloadOutlined-Daor2m11.js +12 -0
  21. package/dist/SettingOutlined-CLEOgXB-.js +92 -0
  22. package/dist/StrategyLabPlugin-DGeZsr_7.js +14361 -0
  23. package/dist/ThunderboltOutlined-nH_FO_4A.js +44 -0
  24. package/dist/ToolOutlined-DtuNJDB2.js +28 -0
  25. package/dist/TrainingModelContainer-DpW-uB8O.js +11883 -0
  26. package/dist/UndoOutlined-ChUQYUul.js +84 -0
  27. package/dist/WarningFilled-1Rc4hr0C.js +12 -0
  28. package/dist/WarningOutlined-5g1d66hO.js +164 -0
  29. package/dist/adapters-D1FFZFoA.js +51 -0
  30. package/dist/analysisTools-CXyOvSZT.js +237 -0
  31. package/dist/creator.js +5 -0
  32. package/dist/index-CYjdXPgc.js +6568 -0
  33. package/dist/index-XuBVjlmu.js +44651 -0
  34. package/dist/index.js +11 -0
  35. package/dist/judgement-D_9i7x9S.js +20 -0
  36. package/dist/runtime.js +4 -0
  37. package/dist/types.js +8 -0
  38. package/dist/useDialogueLogic-IHELcN3X.js +368 -0
  39. package/dist-types/client/src/lib/adapters.d.ts +10 -0
  40. package/dist-types/client/src/lib/creator.d.ts +3 -0
  41. package/dist-types/client/src/lib/creatorIntegrationContext.d.ts +8 -0
  42. package/dist-types/client/src/lib/index.d.ts +5 -0
  43. package/dist-types/client/src/lib/public-types.d.ts +2 -0
  44. package/dist-types/client/src/lib/runtime.d.ts +3 -0
  45. package/dist-types/client/src/lib/types.d.ts +301 -0
  46. package/package.json +83 -0
@@ -0,0 +1,959 @@
1
+ import { c as he, j as o, e as ue, i as be, a as xe, r as le } from "./RadarChart-C5ZM0kWt.js";
2
+ import { useRef as W, useState as P, useEffect as H, useMemo as A } from "react";
3
+ import { Tag as D, Card as ye, Input as se, Button as ee, Form as re, InputNumber as Ce, Select as ne, message as B } from "antd";
4
+ import { u as ve } from "./useDialogueLogic-IHELcN3X.js";
5
+ import { C as je, u as we } from "./CustomLayoutRenderer--rnQrqQ2.js";
6
+ import { a as Se } from "./judgement-D_9i7x9S.js";
7
+ import { P as $e } from "./PluginHeader-B-GESJmT.js";
8
+ const { TextArea: oe } = se, { Option: ke } = ne, Fe = {
9
+ happy: { emoji: "😊", label: "开心", color: "#52c41a" },
10
+ confused: { emoji: "😕", label: "困惑", color: "#faad14" },
11
+ angry: { emoji: "😠", label: "不满", color: "#ff4d4f" }
12
+ };
13
+ function Ie(e) {
14
+ const d = new Date(e);
15
+ return `${d.getHours().toString().padStart(2, "0")}:${d.getMinutes().toString().padStart(2, "0")}`;
16
+ }
17
+ const Te = ({
18
+ messages: e,
19
+ input: d,
20
+ aiResponding: v,
21
+ aiError: t,
22
+ scenario: m,
23
+ objectives: j,
24
+ tellerRoleName: S,
25
+ customerRoleName: $,
26
+ formTemplate: y,
27
+ formData: c,
28
+ validationErrors: s,
29
+ highlightedFields: k,
30
+ formInstance: C,
31
+ uiConfig: p,
32
+ stableFormData: z,
33
+ stableOnValueChange: u,
34
+ forceRenderKey: E,
35
+ onInputChange: N,
36
+ onSend: F,
37
+ onFieldChange: L,
38
+ onComplete: b
39
+ }) => {
40
+ var G, K, U, X, Q, Z;
41
+ const r = he(p.theme), g = p.layout || "horizontal", h = p.dialogueWidth || "500px", i = ((G = p.dialogueConfig) == null ? void 0 : G.showAvatar) !== !1;
42
+ (K = p.dialogueConfig) != null && K.chatBubbleStyle;
43
+ const w = ((U = p.dialogueConfig) == null ? void 0 : U.showTimestamp) !== !1, I = ((X = p.formConfig) == null ? void 0 : X.showTitle) !== !1, O = ((Q = p.formConfig) == null ? void 0 : Q.showDescription) !== !1, M = ((Z = p.formConfig) == null ? void 0 : Z.labelAlign) || "top", a = r.borderRadius, V = W(null), R = W(null), Y = W(null), [q, J] = P(!1), [te, ae] = P(8);
44
+ H(() => {
45
+ const l = R.current, x = Y.current;
46
+ if (!l || !x) return;
47
+ const n = () => {
48
+ const _ = l.scrollWidth, pe = x.clientWidth;
49
+ _ > pe ? (J(!0), ae(Math.max(12, _ / 100 * 3))) : J(!1);
50
+ }, f = requestAnimationFrame(n), T = new ResizeObserver(n);
51
+ return T.observe(x), () => {
52
+ cancelAnimationFrame(f), T.disconnect();
53
+ };
54
+ }, [j]), H(() => {
55
+ var l;
56
+ (l = V.current) == null || l.scrollIntoView({ behavior: "smooth" });
57
+ }, [e, v]);
58
+ const de = () => /* @__PURE__ */ o.jsxs(
59
+ "div",
60
+ {
61
+ style: {
62
+ display: "flex",
63
+ flexDirection: "column",
64
+ height: "100%",
65
+ // 占满父容器高度
66
+ overflow: "hidden"
67
+ // 防止溢出
68
+ },
69
+ children: [
70
+ /* @__PURE__ */ o.jsxs(
71
+ "div",
72
+ {
73
+ className: "dialogue-form-chat-area",
74
+ style: {
75
+ flex: 1,
76
+ minHeight: 0,
77
+ // 关键:允许滚动容器收缩
78
+ borderRadius: a,
79
+ overflowY: "auto",
80
+ marginBottom: 12,
81
+ padding: 16,
82
+ backgroundColor: r.surfaceColor,
83
+ border: `1px solid ${r.borderColor}`
84
+ },
85
+ children: [
86
+ e.map((l, x) => {
87
+ const n = l.role === "teller", f = l.emotion && l.emotion !== "neutral" ? Fe[l.emotion] : null;
88
+ return /* @__PURE__ */ o.jsxs(
89
+ "div",
90
+ {
91
+ style: {
92
+ marginBottom: 16,
93
+ display: "flex",
94
+ flexDirection: n ? "row-reverse" : "row",
95
+ alignItems: "flex-start",
96
+ gap: 10
97
+ },
98
+ children: [
99
+ i && /* @__PURE__ */ o.jsx(
100
+ "div",
101
+ {
102
+ style: {
103
+ width: 36,
104
+ height: 36,
105
+ borderRadius: "50%",
106
+ backgroundColor: n ? r.primaryColor : "#bfbfbf",
107
+ color: "#fff",
108
+ display: "flex",
109
+ alignItems: "center",
110
+ justifyContent: "center",
111
+ fontSize: 14,
112
+ fontWeight: 600,
113
+ flexShrink: 0
114
+ },
115
+ children: n ? S[0] : $[0]
116
+ }
117
+ ),
118
+ /* @__PURE__ */ o.jsxs("div", { style: { maxWidth: "70%" }, children: [
119
+ /* @__PURE__ */ o.jsxs(
120
+ "div",
121
+ {
122
+ style: {
123
+ fontSize: 12,
124
+ color: "#8c8c8c",
125
+ marginBottom: 4,
126
+ textAlign: n ? "right" : "left",
127
+ fontFamily: "'Inter', sans-serif",
128
+ fontWeight: 500,
129
+ letterSpacing: "0.3px"
130
+ },
131
+ children: [
132
+ n ? S : $,
133
+ f && /* @__PURE__ */ o.jsxs(
134
+ D,
135
+ {
136
+ color: f.color,
137
+ style: {
138
+ marginLeft: 6,
139
+ fontSize: 11,
140
+ lineHeight: "18px",
141
+ padding: "0 6px"
142
+ },
143
+ children: [
144
+ f.emoji,
145
+ " ",
146
+ f.label
147
+ ]
148
+ }
149
+ )
150
+ ]
151
+ }
152
+ ),
153
+ /* @__PURE__ */ o.jsx(
154
+ "div",
155
+ {
156
+ style: {
157
+ padding: "12px 16px",
158
+ borderRadius: n ? `${a}px 2px ${a}px ${a}px` : `2px ${a}px ${a}px ${a}px`,
159
+ backgroundColor: n ? r.primaryColor : r.surfaceLightColor,
160
+ color: n ? "#fff" : "#262626",
161
+ boxShadow: n ? "0 2px 8px rgba(0,0,0,0.12)" : "0 1px 4px rgba(0,0,0,0.08)",
162
+ border: n ? void 0 : `1px solid ${r.borderColor}`,
163
+ lineHeight: 1.65,
164
+ fontSize: 14,
165
+ fontFamily: "'Inter', sans-serif",
166
+ letterSpacing: "0.2px"
167
+ },
168
+ children: l.content
169
+ }
170
+ ),
171
+ w && /* @__PURE__ */ o.jsx(
172
+ "div",
173
+ {
174
+ style: {
175
+ fontSize: 11,
176
+ color: "#bfbfbf",
177
+ marginTop: 4,
178
+ textAlign: n ? "right" : "left"
179
+ },
180
+ children: Ie(l.timestamp)
181
+ }
182
+ )
183
+ ] })
184
+ ]
185
+ },
186
+ x
187
+ );
188
+ }),
189
+ v && /* @__PURE__ */ o.jsxs(
190
+ "div",
191
+ {
192
+ style: {
193
+ display: "flex",
194
+ alignItems: "flex-start",
195
+ gap: 10,
196
+ marginBottom: 16
197
+ },
198
+ children: [
199
+ i && /* @__PURE__ */ o.jsx(
200
+ "div",
201
+ {
202
+ style: {
203
+ width: 36,
204
+ height: 36,
205
+ borderRadius: "50%",
206
+ backgroundColor: "#bfbfbf",
207
+ color: "#fff",
208
+ display: "flex",
209
+ alignItems: "center",
210
+ justifyContent: "center",
211
+ fontSize: 14,
212
+ fontWeight: 600,
213
+ flexShrink: 0
214
+ },
215
+ children: $[0]
216
+ }
217
+ ),
218
+ /* @__PURE__ */ o.jsx(
219
+ "div",
220
+ {
221
+ style: {
222
+ padding: "12px 18px",
223
+ borderRadius: `2px ${a}px ${a}px ${a}px`,
224
+ backgroundColor: r.surfaceLightColor,
225
+ border: `1px solid ${r.borderColor}`,
226
+ boxShadow: "0 1px 4px rgba(0,0,0,0.08)"
227
+ },
228
+ children: /* @__PURE__ */ o.jsx("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [0, 1, 2].map((l) => /* @__PURE__ */ o.jsx(
229
+ "span",
230
+ {
231
+ style: {
232
+ width: 7,
233
+ height: 7,
234
+ borderRadius: "50%",
235
+ backgroundColor: r.primaryColor,
236
+ opacity: 0.4,
237
+ display: "inline-block",
238
+ animation: `dialogueFormTyping 1.4s infinite ${l * 0.2}s`
239
+ }
240
+ },
241
+ l
242
+ )) })
243
+ }
244
+ )
245
+ ]
246
+ }
247
+ ),
248
+ /* @__PURE__ */ o.jsx("div", { ref: V })
249
+ ]
250
+ }
251
+ ),
252
+ j && j.length > 0 && (() => {
253
+ const l = {
254
+ borderColor: r.primaryColor,
255
+ color: r.primaryColor,
256
+ borderRadius: 20,
257
+ padding: "4px 14px",
258
+ fontSize: 12,
259
+ background: `${r.primaryColor}08`,
260
+ border: `1.5px solid ${r.primaryColor}`,
261
+ fontFamily: "'Inter', sans-serif",
262
+ fontWeight: 500,
263
+ letterSpacing: "0.2px",
264
+ cursor: "default",
265
+ marginRight: 0
266
+ }, x = () => j.map((n, f) => /* @__PURE__ */ o.jsxs(D, { style: l, children: [
267
+ f + 1,
268
+ ". ",
269
+ n
270
+ ] }, f));
271
+ return /* @__PURE__ */ o.jsxs(
272
+ "div",
273
+ {
274
+ className: "dialogue-objectives-bar",
275
+ style: {
276
+ flexShrink: 0,
277
+ marginBottom: 12,
278
+ padding: "8px 14px",
279
+ backgroundColor: r.surfaceLightColor,
280
+ borderRadius: a,
281
+ border: `1px solid ${r.borderColor}`,
282
+ display: "flex",
283
+ alignItems: "center",
284
+ gap: 10,
285
+ overflow: "hidden"
286
+ },
287
+ children: [
288
+ /* @__PURE__ */ o.jsx(
289
+ "span",
290
+ {
291
+ style: {
292
+ fontSize: 13,
293
+ fontWeight: 600,
294
+ color: r.headerColor,
295
+ fontFamily: "'Crimson Pro', serif",
296
+ letterSpacing: "0.3px",
297
+ whiteSpace: "nowrap",
298
+ flexShrink: 0
299
+ },
300
+ children: "对话目标:"
301
+ }
302
+ ),
303
+ /* @__PURE__ */ o.jsxs(
304
+ "div",
305
+ {
306
+ ref: Y,
307
+ className: "objectives-scroll-container",
308
+ style: {
309
+ flex: 1,
310
+ overflow: "hidden",
311
+ position: "relative"
312
+ },
313
+ children: [
314
+ /* @__PURE__ */ o.jsx(
315
+ "div",
316
+ {
317
+ ref: R,
318
+ style: { position: "absolute", visibility: "hidden", pointerEvents: "none", display: "inline-flex", gap: 8, whiteSpace: "nowrap" },
319
+ children: x()
320
+ }
321
+ ),
322
+ /* @__PURE__ */ o.jsxs(
323
+ "div",
324
+ {
325
+ className: q ? "objectives-scroll-track scrolling" : "objectives-scroll-track",
326
+ style: {
327
+ display: "inline-flex",
328
+ gap: 8,
329
+ whiteSpace: "nowrap",
330
+ alignItems: "center",
331
+ animationDuration: `${te}s`
332
+ },
333
+ children: [
334
+ x(),
335
+ q && /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
336
+ /* @__PURE__ */ o.jsx("span", { style: { display: "inline-block", width: 60, flexShrink: 0 } }),
337
+ x()
338
+ ] })
339
+ ]
340
+ }
341
+ )
342
+ ]
343
+ }
344
+ )
345
+ ]
346
+ }
347
+ );
348
+ })(),
349
+ t && /* @__PURE__ */ o.jsxs(
350
+ ye,
351
+ {
352
+ size: "small",
353
+ style: {
354
+ flexShrink: 0,
355
+ // 不允许收缩
356
+ marginBottom: 12,
357
+ backgroundColor: "#fff2e8",
358
+ borderColor: "#ffbb96",
359
+ borderRadius: a
360
+ },
361
+ children: [
362
+ /* @__PURE__ */ o.jsx("span", { style: { fontWeight: 600 }, children: "⚠️ AI服务异常:" }),
363
+ t
364
+ ]
365
+ }
366
+ ),
367
+ /* @__PURE__ */ o.jsxs(
368
+ "div",
369
+ {
370
+ style: {
371
+ flexShrink: 0,
372
+ // 不允许收缩
373
+ display: "flex",
374
+ gap: 10,
375
+ padding: 14,
376
+ backgroundColor: r.surfaceLightColor,
377
+ borderRadius: a,
378
+ border: `1.5px solid ${r.borderColor}`,
379
+ boxShadow: "0 2px 8px rgba(0,0,0,0.06)",
380
+ transition: "all 0.2s ease"
381
+ },
382
+ onMouseEnter: (l) => {
383
+ l.currentTarget.style.borderColor = r.primaryColor, l.currentTarget.style.boxShadow = `0 2px 12px ${r.primaryColor}20`;
384
+ },
385
+ onMouseLeave: (l) => {
386
+ l.currentTarget.style.borderColor = r.borderColor, l.currentTarget.style.boxShadow = "0 2px 8px rgba(0,0,0,0.06)";
387
+ },
388
+ children: [
389
+ /* @__PURE__ */ o.jsx(
390
+ oe,
391
+ {
392
+ value: d,
393
+ onChange: (l) => N(l.target.value),
394
+ onPressEnter: (l) => {
395
+ l.shiftKey || (l.preventDefault(), F());
396
+ },
397
+ placeholder: "输入您的话术... (Shift+Enter换行,Enter发送)",
398
+ autoSize: { minRows: 2, maxRows: 4 },
399
+ style: {
400
+ flex: 1,
401
+ border: "none",
402
+ boxShadow: "none",
403
+ resize: "none",
404
+ backgroundColor: r.surfaceLightColor,
405
+ fontFamily: "'Inter', sans-serif",
406
+ fontSize: 14,
407
+ lineHeight: 1.6
408
+ },
409
+ disabled: v
410
+ }
411
+ ),
412
+ /* @__PURE__ */ o.jsx(
413
+ ee,
414
+ {
415
+ type: "primary",
416
+ icon: /* @__PURE__ */ o.jsx(ue, {}),
417
+ onClick: F,
418
+ disabled: !d.trim() || v,
419
+ loading: v,
420
+ style: {
421
+ alignSelf: "center",
422
+ borderRadius: a,
423
+ backgroundColor: r.primaryColor,
424
+ borderColor: r.primaryColor,
425
+ fontFamily: "'Inter', sans-serif",
426
+ fontWeight: 500,
427
+ height: 38,
428
+ paddingLeft: 20,
429
+ paddingRight: 20,
430
+ boxShadow: `0 2px 8px ${r.primaryColor}30`,
431
+ transition: "all 0.2s ease"
432
+ },
433
+ onMouseEnter: (l) => {
434
+ !d.trim() || v || (l.currentTarget.style.transform = "translateY(-1px)", l.currentTarget.style.boxShadow = `0 4px 12px ${r.primaryColor}40`);
435
+ },
436
+ onMouseLeave: (l) => {
437
+ l.currentTarget.style.transform = "translateY(0)", l.currentTarget.style.boxShadow = `0 2px 8px ${r.primaryColor}30`;
438
+ },
439
+ children: "发送"
440
+ }
441
+ )
442
+ ]
443
+ }
444
+ )
445
+ ]
446
+ }
447
+ ), ce = () => {
448
+ if (!y)
449
+ return /* @__PURE__ */ o.jsx(
450
+ "div",
451
+ {
452
+ style: {
453
+ height: "100%",
454
+ display: "flex",
455
+ alignItems: "center",
456
+ justifyContent: "center",
457
+ padding: 20,
458
+ textAlign: "center",
459
+ color: "#8c8c8c",
460
+ backgroundColor: r.surfaceColor,
461
+ borderRadius: a,
462
+ border: `1px solid ${r.borderColor}`
463
+ },
464
+ children: "表单模板未配置"
465
+ }
466
+ );
467
+ const l = y.customLayoutCode;
468
+ if (l)
469
+ return /* @__PURE__ */ o.jsx(
470
+ "div",
471
+ {
472
+ style: {
473
+ height: "100%",
474
+ display: "flex",
475
+ flexDirection: "column",
476
+ backgroundColor: r.surfaceColor,
477
+ borderRadius: a,
478
+ border: `1px solid ${r.borderColor}`,
479
+ overflow: "hidden"
480
+ // 防止内容溢出
481
+ },
482
+ children: /* @__PURE__ */ o.jsx(
483
+ "div",
484
+ {
485
+ className: "dialogue-form-area",
486
+ style: {
487
+ flex: 1,
488
+ overflowY: "auto",
489
+ padding: 16
490
+ },
491
+ children: /* @__PURE__ */ o.jsx(
492
+ je,
493
+ {
494
+ code: l,
495
+ scope: {
496
+ theme: r,
497
+ formData: { ...c },
498
+ onValueChange: u,
499
+ onSubmit: b
500
+ }
501
+ }
502
+ )
503
+ }
504
+ )
505
+ }
506
+ );
507
+ const x = y.fields || [];
508
+ return /* @__PURE__ */ o.jsx(
509
+ "div",
510
+ {
511
+ style: {
512
+ height: "100%",
513
+ display: "flex",
514
+ flexDirection: "column",
515
+ backgroundColor: r.surfaceColor,
516
+ borderRadius: a,
517
+ border: `1px solid ${r.borderColor}`,
518
+ overflow: "hidden"
519
+ // 防止内容溢出
520
+ },
521
+ children: /* @__PURE__ */ o.jsxs(
522
+ "div",
523
+ {
524
+ className: "dialogue-form-area",
525
+ style: {
526
+ flex: 1,
527
+ overflowY: "auto",
528
+ padding: 16
529
+ },
530
+ children: [
531
+ I && y.title && /* @__PURE__ */ o.jsx(
532
+ "div",
533
+ {
534
+ style: {
535
+ fontSize: 20,
536
+ fontWeight: 700,
537
+ color: r.headerColor,
538
+ marginBottom: 6,
539
+ fontFamily: "'Crimson Pro', serif",
540
+ letterSpacing: "-0.3px",
541
+ lineHeight: 1.3
542
+ },
543
+ children: y.title
544
+ }
545
+ ),
546
+ O && y.description && /* @__PURE__ */ o.jsx(
547
+ "div",
548
+ {
549
+ style: {
550
+ fontSize: 13,
551
+ color: "#8c8c8c",
552
+ marginBottom: 20,
553
+ fontFamily: "'Inter', sans-serif",
554
+ lineHeight: 1.6,
555
+ paddingBottom: 16,
556
+ borderBottom: `1px solid ${r.borderColor}`
557
+ },
558
+ children: y.description
559
+ }
560
+ ),
561
+ /* @__PURE__ */ o.jsx(
562
+ re,
563
+ {
564
+ form: C,
565
+ layout: M === "top" ? "vertical" : "horizontal",
566
+ onValuesChange: (n) => {
567
+ const f = Object.keys(n)[0], T = n[f];
568
+ L(f, T);
569
+ },
570
+ children: x.map((n) => {
571
+ const f = k.has(n.name), T = s[n.name];
572
+ return /* @__PURE__ */ o.jsx(
573
+ re.Item,
574
+ {
575
+ name: n.name,
576
+ label: n.label,
577
+ required: n.required,
578
+ validateStatus: T ? "error" : void 0,
579
+ help: T,
580
+ style: {
581
+ transition: "all 0.3s ease",
582
+ backgroundColor: f ? `${r.primaryColor}15` : "transparent",
583
+ padding: f ? "8px" : "0",
584
+ borderRadius: f ? a : 0,
585
+ border: f ? `2px solid ${r.primaryColor}` : "none"
586
+ },
587
+ children: ie(n)
588
+ },
589
+ n.name
590
+ );
591
+ })
592
+ }
593
+ ),
594
+ /* @__PURE__ */ o.jsx("div", { style: { marginTop: 24, textAlign: "center" }, children: /* @__PURE__ */ o.jsx(
595
+ ee,
596
+ {
597
+ type: "primary",
598
+ icon: /* @__PURE__ */ o.jsx(be, {}),
599
+ onClick: b,
600
+ size: "large",
601
+ style: {
602
+ backgroundColor: r.primaryColor,
603
+ borderColor: r.primaryColor,
604
+ borderRadius: a,
605
+ paddingLeft: 32,
606
+ paddingRight: 32,
607
+ height: 44,
608
+ fontSize: 15,
609
+ fontWeight: 600,
610
+ boxShadow: `0 4px 12px ${r.primaryColor}30`
611
+ },
612
+ children: "提交评估"
613
+ }
614
+ ) })
615
+ ]
616
+ }
617
+ )
618
+ }
619
+ );
620
+ }, ie = (l) => {
621
+ var x;
622
+ switch (l.type) {
623
+ case "select":
624
+ return /* @__PURE__ */ o.jsx(ne, { placeholder: `请选择${l.label}`, children: (x = l.options) == null ? void 0 : x.map((n) => /* @__PURE__ */ o.jsx(ke, { value: n, children: n }, n)) });
625
+ case "number":
626
+ return /* @__PURE__ */ o.jsx(
627
+ Ce,
628
+ {
629
+ placeholder: `请输入${l.label}`,
630
+ min: l.min,
631
+ max: l.max,
632
+ style: { width: "100%" }
633
+ }
634
+ );
635
+ case "text":
636
+ default:
637
+ return l.maxLength && l.maxLength > 30 ? /* @__PURE__ */ o.jsx(
638
+ oe,
639
+ {
640
+ placeholder: `请输入${l.label}`,
641
+ maxLength: l.maxLength,
642
+ rows: 4,
643
+ showCount: !0
644
+ }
645
+ ) : /* @__PURE__ */ o.jsx(
646
+ se,
647
+ {
648
+ placeholder: `请输入${l.label}`,
649
+ maxLength: l.maxLength
650
+ }
651
+ );
652
+ }
653
+ }, me = g === "horizontal" ? {
654
+ display: "flex",
655
+ gap: 16,
656
+ height: "100%"
657
+ // 占满父容器高度
658
+ } : {
659
+ display: "flex",
660
+ flexDirection: "column",
661
+ gap: 16,
662
+ height: "100%"
663
+ }, ge = g === "horizontal" ? {
664
+ width: h,
665
+ flexShrink: 0,
666
+ height: "60vh"
667
+ } : {
668
+ width: "100%",
669
+ height: "60vh"
670
+ }, fe = g === "horizontal" ? {
671
+ flex: 1,
672
+ minWidth: 0,
673
+ height: "60vh"
674
+ } : {
675
+ width: "100%",
676
+ height: "60vh"
677
+ };
678
+ return /* @__PURE__ */ o.jsxs(
679
+ "div",
680
+ {
681
+ style: {
682
+ height: "100%",
683
+ display: "flex",
684
+ flexDirection: "column",
685
+ padding: "16px",
686
+ ...p.styleOverrides
687
+ },
688
+ children: [
689
+ m && /* @__PURE__ */ o.jsx("div", { style: { marginBottom: 12, flexShrink: 0 }, children: /* @__PURE__ */ o.jsx($e, { title: m, variant: "card", theme: r }) }),
690
+ /* @__PURE__ */ o.jsxs("div", { style: { ...me, flex: 1, minHeight: 0 }, children: [
691
+ /* @__PURE__ */ o.jsx("div", { style: ge, children: de() }),
692
+ /* @__PURE__ */ o.jsx("div", { style: fe, children: ce() })
693
+ ] }),
694
+ /* @__PURE__ */ o.jsx("style", { children: `
695
+ /* Google Fonts - Editorial 风格字体 */
696
+ @import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;600;700&family=Inter:wght@400;500;600&display=swap');
697
+
698
+ @keyframes dialogueFormTyping {
699
+ 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
700
+ 30% { opacity: 1; transform: translateY(-4px); }
701
+ }
702
+
703
+ /* 聊天区域滚动条 - 非激活时与背景融合 */
704
+ .dialogue-form-chat-area::-webkit-scrollbar {
705
+ width: 6px;
706
+ }
707
+ .dialogue-form-chat-area::-webkit-scrollbar-track {
708
+ background: transparent;
709
+ }
710
+ .dialogue-form-chat-area::-webkit-scrollbar-thumb {
711
+ background: ${r.borderColor};
712
+ border-radius: 3px;
713
+ transition: background 0.3s ease;
714
+ }
715
+ .dialogue-form-chat-area::-webkit-scrollbar-thumb:hover {
716
+ background: ${r.primaryColor}60;
717
+ }
718
+
719
+ /* 表单区域滚动条 - 非激活时与背景融合 */
720
+ .dialogue-form-area::-webkit-scrollbar {
721
+ width: 6px;
722
+ }
723
+ .dialogue-form-area::-webkit-scrollbar-track {
724
+ background: transparent;
725
+ }
726
+ .dialogue-form-area::-webkit-scrollbar-thumb {
727
+ background: ${r.borderColor};
728
+ border-radius: 3px;
729
+ transition: background 0.3s ease;
730
+ }
731
+ .dialogue-form-area::-webkit-scrollbar-thumb:hover {
732
+ background: ${r.primaryColor}60;
733
+ }
734
+
735
+ /* 对话目标自动滚动 */
736
+ .objectives-scroll-container {
737
+ mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
738
+ -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
739
+ }
740
+ .objectives-scroll-track.scrolling {
741
+ animation: objectivesMarquee 8s linear infinite;
742
+ }
743
+ @keyframes objectivesMarquee {
744
+ 0% { transform: translateX(0); }
745
+ 100% { transform: translateX(-50%); }
746
+ }
747
+ .objectives-scroll-track.scrolling:hover {
748
+ animation-play-state: paused;
749
+ }
750
+
751
+ /* Firefox 滚动条支持 */
752
+ .dialogue-form-chat-area,
753
+ .dialogue-form-area {
754
+ scrollbar-width: thin;
755
+ scrollbar-color: ${r.borderColor} transparent;
756
+ }
757
+ .dialogue-objectives-bar {
758
+ scrollbar-width: thin;
759
+ scrollbar-color: ${r.borderColor} transparent;
760
+ }
761
+ ` })
762
+ ]
763
+ }
764
+ );
765
+ }, Pe = ({
766
+ initData: e,
767
+ checkRules: d,
768
+ onFinish: v,
769
+ onRealtimeData: t
770
+ }) => {
771
+ var F, L;
772
+ const m = (e == null ? void 0 : e.dialogue) || e, j = (e == null ? void 0 : e.form) || e, S = (e == null ? void 0 : e.tellerRoleName) || (e == null ? void 0 : e.targetPosition) || "柜员", $ = ((F = e == null ? void 0 : e.roleConfig) == null ? void 0 : F.角色名称) || (e == null ? void 0 : e.customerRoleName) || "客户", y = (e == null ? void 0 : e.domain) || "银行", c = ve(
773
+ {
774
+ ...m,
775
+ stepId: e == null ? void 0 : e.stepId,
776
+ botId: e == null ? void 0 : e.botId,
777
+ currentUser: e == null ? void 0 : e.currentUser,
778
+ tellerRoleName: S,
779
+ customerRoleName: $,
780
+ domain: y,
781
+ caseData: e == null ? void 0 : e.caseData,
782
+ roleConfig: e == null ? void 0 : e.roleConfig
783
+ },
784
+ {
785
+ onRealtimeData: t,
786
+ enableRealtimeGuidance: !0,
787
+ checkRules: d,
788
+ // 自定义 prompt:包含表单上下文
789
+ buildPrompt: (b, r, g) => Le(
790
+ b,
791
+ r,
792
+ s.formData,
793
+ e,
794
+ S,
795
+ $,
796
+ y,
797
+ z,
798
+ p
799
+ )
800
+ }
801
+ ), s = we(
802
+ {
803
+ ...j,
804
+ stepId: e == null ? void 0 : e.stepId
805
+ },
806
+ { onRealtimeData: t }
807
+ ), k = A(() => (e == null ? void 0 : e.uiConfig) || {}, [e == null ? void 0 : e.uiConfig]), C = A(() => (e == null ? void 0 : e.fieldMappings) || [], [e == null ? void 0 : e.fieldMappings]), { filledData: p } = xe(), z = A(() => ({ ...(e == null ? void 0 : e.caseData) || {}, ...e || {} }), [e]), [u, E] = P(/* @__PURE__ */ new Set());
808
+ H(() => {
809
+ if (c.messages.length === 0) return;
810
+ const b = c.messages[c.messages.length - 1];
811
+ if (b.role !== "customer") return;
812
+ const r = b.content;
813
+ C.forEach((g) => {
814
+ g.keywords.some((i) => r.includes(i)) && (k.highlightFieldOnMention !== !1 && (E((i) => new Set(i).add(g.fieldName)), setTimeout(() => {
815
+ E((i) => {
816
+ const w = new Set(i);
817
+ return w.delete(g.fieldName), w;
818
+ });
819
+ }, 3e3)), k.autoFillEnabled && g.extractRule && ze(r, g.extractRule));
820
+ });
821
+ }, [c.messages, C, k, s.stableOnValueChange]);
822
+ const N = async () => {
823
+ const b = d == null ? void 0 : d.dialogueRules, r = d == null ? void 0 : d.formRules, g = (d == null ? void 0 : d.completionMode) || "both", h = c.checkCompletion(b), i = s.checkCompletion(r);
824
+ let w = !1, I = "";
825
+ switch (g) {
826
+ case "both":
827
+ w = h.canComplete && i.canComplete, h.canComplete ? i.canComplete || (I = i.reason) : I = h.reason;
828
+ break;
829
+ case "dialogue-first":
830
+ w = h.canComplete, I = h.reason || "";
831
+ break;
832
+ case "form-first":
833
+ w = i.canComplete, I = i.reason || "";
834
+ break;
835
+ default:
836
+ w = !0;
837
+ }
838
+ if (!w) {
839
+ B.warning(I || "请完成所有必填项");
840
+ return;
841
+ }
842
+ try {
843
+ if (await s.form.validateFields(), Object.keys(s.validationErrors).some(
844
+ (a) => s.validationErrors[a] && !s.validationErrors[a].startsWith("⚠️")
845
+ )) {
846
+ B.error("请修正表单错误后再提交");
847
+ return;
848
+ }
849
+ const M = Object.keys(s.formData).filter((a) => s.formData[a] != null && s.formData[a] !== "");
850
+ v({
851
+ stepId: (e == null ? void 0 : e.stepId) || "unknown",
852
+ operationType: "dialogue-form",
853
+ operationData: {
854
+ dialogueHistory: c.messages,
855
+ dialogueLog: c.dialogueLog,
856
+ formData: s.formData,
857
+ totalMessages: c.messages.length,
858
+ mustConfirmResult: d != null && d.mustConfirm ? c.isConfirmed() : void 0
859
+ },
860
+ operationLog: [
861
+ ...c.dialogueLog,
862
+ {
863
+ action: "form-submit",
864
+ data: s.formData,
865
+ timestamp: Date.now()
866
+ }
867
+ ],
868
+ timestamp: Date.now(),
869
+ evidenceSummary: Se({
870
+ sourceStepId: (e == null ? void 0 : e.stepId) || "unknown",
871
+ sourceStepName: (e == null ? void 0 : e.stepName) || "对话式表单",
872
+ sourceType: "dialogue-form",
873
+ title: `${(e == null ? void 0 : e.stepName) || "对话式表单"}摘要`,
874
+ summary: `完成 ${c.messages.length} 条消息对话,填写 ${M.length} 个字段。`,
875
+ keyFacts: [
876
+ { label: "消息总数", value: String(c.messages.length) },
877
+ { label: "填写字段数", value: String(M.length) }
878
+ ]
879
+ })
880
+ });
881
+ } catch (O) {
882
+ console.error("表单验证失败:", O), B.error("表单验证失败");
883
+ }
884
+ };
885
+ return A(() => ({
886
+ theme: { primaryColor: "#1890ff" },
887
+ formData: { ...s.formData },
888
+ onValueChange: s.stableOnValueChange,
889
+ onSubmit: s.stableOnSubmit
890
+ }), [s.formData, s.stableOnValueChange, s.stableOnSubmit]), /* @__PURE__ */ o.jsx(
891
+ Te,
892
+ {
893
+ messages: c.messages,
894
+ input: c.input,
895
+ aiResponding: c.aiResponding,
896
+ aiError: c.aiError,
897
+ scenario: le((m == null ? void 0 : m.scenario) || "", z, p),
898
+ objectives: (m == null ? void 0 : m.dialogueGoals) || (m == null ? void 0 : m.objectives),
899
+ tellerRoleName: S,
900
+ customerRoleName: $,
901
+ formTemplate: s.resolvedTemplate ? {
902
+ ...s.resolvedTemplate,
903
+ customLayoutCode: (L = j == null ? void 0 : j.uiConfig) == null ? void 0 : L.customLayoutCode
904
+ } : null,
905
+ formData: s.formData,
906
+ validationErrors: s.validationErrors,
907
+ highlightedFields: u,
908
+ formInstance: s.form,
909
+ uiConfig: k,
910
+ stableFormData: s.stableFormData,
911
+ stableOnValueChange: s.stableOnValueChange,
912
+ onInputChange: c.setInput,
913
+ onSend: c.handleSend,
914
+ onFieldChange: s.handleFieldChange,
915
+ onComplete: N
916
+ }
917
+ );
918
+ };
919
+ function Le(e, d, v, t, m, j, S, $, y) {
920
+ if (d.some((g) => g.role === "teller"))
921
+ return `${m}: ${e}`;
922
+ const s = (t == null ? void 0 : t.dialogue) || t, k = (t == null ? void 0 : t.roleConfig) || {}, C = t == null ? void 0 : t.caseData, p = (s == null ? void 0 : s.scenario) || `${S}业务办理`, z = le(p, $ || C, y), u = (C == null ? void 0 : C.customerInfo) || (s == null ? void 0 : s.customerInfo) || {}, E = (C == null ? void 0 : C.businessData) || (t == null ? void 0 : t.businessData) || {}, N = (t == null ? void 0 : t.modelName) || "", F = (t == null ? void 0 : t.businessType) || "", L = (t == null ? void 0 : t.targetPosition) || "", b = (u == null ? void 0 : u.name) || (u == null ? void 0 : u.姓名) || (u == null ? void 0 : u.customerName), r = [];
923
+ return b && r.push(`- 姓名:${b}`), Object.entries(k).forEach(([g, h]) => {
924
+ if (g === "角色编号") return;
925
+ let i;
926
+ Array.isArray(h) ? i = h.join("、") : typeof h == "object" && h !== null ? i = JSON.stringify(h, null, 2) : i = String(h || ""), i && r.push(`- ${g}:${i}`);
927
+ }), `
928
+ ## 实训场景信息
929
+ - 模型名称:${N}
930
+ - 业务领域:${S}
931
+ - 业务类型:${F}
932
+ - 目标岗位:${L}
933
+ - 场景描述:${z}
934
+
935
+ ## 角色设定
936
+ - 你扮演的角色:${j}${b ? `,你的名字是"${b}"` : ""}
937
+ - 学生扮演的角色:${m}
938
+ ${r.length > 0 ? r.join(`
939
+ `) : "- (无特殊设定)"}
940
+
941
+ ## 客户信息
942
+ ${JSON.stringify(u, null, 2)}
943
+
944
+ ## 业务数据
945
+ ${JSON.stringify(E, null, 2)}
946
+
947
+ ## 表单填写状态
948
+ 当前表单已填写字段:${Object.keys(v).length > 0 ? JSON.stringify(v, null, 2) : "(尚未填写)"}
949
+
950
+ ## 对话开始
951
+ ${m}: ${e}
952
+ `.trim();
953
+ }
954
+ function ze(e, d) {
955
+ return null;
956
+ }
957
+ export {
958
+ Pe as default
959
+ };