@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,416 @@
1
+ import { c as H, j as o, i as $, e as M, a as N, r as B } from "./RadarChart-C5ZM0kWt.js";
2
+ import { Button as T, Tag as I, Card as z, Input as Y, message as F } from "antd";
3
+ import { u as V } from "./useDialogueLogic-IHELcN3X.js";
4
+ import { a as K } from "./judgement-D_9i7x9S.js";
5
+ import { useRef as O, useEffect as q } from "react";
6
+ import { P as L } from "./PluginHeader-B-GESJmT.js";
7
+ const { TextArea: J } = Y, Q = {
8
+ happy: { emoji: "😊", label: "开心", color: "#52c41a" },
9
+ confused: { emoji: "😕", label: "困惑", color: "#faad14" },
10
+ angry: { emoji: "😠", label: "不满", color: "#ff4d4f" }
11
+ };
12
+ function U(e) {
13
+ const d = new Date(e);
14
+ return `${d.getHours().toString().padStart(2, "0")}:${d.getMinutes().toString().padStart(2, "0")}`;
15
+ }
16
+ const X = ({
17
+ messages: e,
18
+ input: d,
19
+ aiResponding: c,
20
+ aiError: f,
21
+ dialogueLogCount: s,
22
+ scenario: g,
23
+ dialogueGoals: p,
24
+ tellerRoleName: u,
25
+ customerRoleName: x,
26
+ uiConfig: n,
27
+ onInputChange: b,
28
+ onSend: y,
29
+ onComplete: v
30
+ }) => {
31
+ const r = H(n.theme), h = n.showAvatar !== !1, C = n.chatAreaHeight || 420, i = n.tellerBubbleColor || r.primaryColor, R = n.customerBubbleColor || r.surfaceLightColor, E = n.showTimestamp !== !1, W = n.showEmotionTag !== !1, A = n.inputPlaceholder || "输入您的话术... (Shift+Enter换行,Enter发送)", P = n.submitButtonText || "完成对话", S = n.scenarioDisplay || "card", w = n.goalDisplay || "tags", t = r.borderRadius, k = O(null);
32
+ return q(() => {
33
+ var l;
34
+ (l = k.current) == null || l.scrollIntoView({ behavior: "smooth" });
35
+ }, [e, c]), /* @__PURE__ */ o.jsxs("div", { style: { padding: "20px", ...n.styleOverrides }, children: [
36
+ /* @__PURE__ */ o.jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: 12, marginBottom: 16 }, children: [
37
+ g && S !== "none" && /* @__PURE__ */ o.jsx("div", { style: { flex: 1, minWidth: 0 }, children: S === "banner" ? /* @__PURE__ */ o.jsx(L, { title: g, variant: "banner", theme: r, noMargin: !0 }) : /* @__PURE__ */ o.jsx(L, { title: g, variant: "card", theme: r, noMargin: !0 }) }),
38
+ /* @__PURE__ */ o.jsx(
39
+ T,
40
+ {
41
+ type: "default",
42
+ icon: /* @__PURE__ */ o.jsx($, {}),
43
+ onClick: v,
44
+ disabled: s === 0,
45
+ style: {
46
+ flexShrink: 0,
47
+ alignSelf: "flex-start",
48
+ marginLeft: !g || S === "none" ? "auto" : void 0,
49
+ borderRadius: t,
50
+ borderColor: r.primaryColor,
51
+ color: r.primaryColor
52
+ },
53
+ children: P
54
+ }
55
+ )
56
+ ] }),
57
+ p && p.length > 0 && w !== "none" && (w === "tags" ? /* @__PURE__ */ o.jsxs("div", { style: { marginBottom: 16 }, children: [
58
+ /* @__PURE__ */ o.jsx("div", { style: { fontSize: 13, fontWeight: 600, color: r.headerColor, marginBottom: 8 }, children: "对话目标:" }),
59
+ /* @__PURE__ */ o.jsx("div", { style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: p.map((l, m) => /* @__PURE__ */ o.jsx(
60
+ I,
61
+ {
62
+ style: {
63
+ borderColor: r.primaryColor,
64
+ color: r.primaryColor,
65
+ borderRadius: 20,
66
+ padding: "2px 12px",
67
+ fontSize: 13,
68
+ background: "transparent"
69
+ },
70
+ children: l
71
+ },
72
+ m
73
+ )) })
74
+ ] }) : w === "card" ? /* @__PURE__ */ o.jsx(
75
+ z,
76
+ {
77
+ size: "small",
78
+ style: {
79
+ marginBottom: 16,
80
+ borderRadius: t,
81
+ borderColor: r.borderColor
82
+ },
83
+ title: /* @__PURE__ */ o.jsx("span", { style: { fontSize: 13, fontWeight: 600, color: r.headerColor }, children: "对话目标" }),
84
+ children: /* @__PURE__ */ o.jsx("ul", { style: { margin: 0, paddingLeft: 20 }, children: p.map((l, m) => /* @__PURE__ */ o.jsx("li", { style: { fontSize: 13, color: "#595959", marginBottom: 4 }, children: l }, m)) })
85
+ }
86
+ ) : /* @__PURE__ */ o.jsxs(
87
+ "div",
88
+ {
89
+ style: {
90
+ marginBottom: 16,
91
+ padding: "12px 16px",
92
+ backgroundColor: r.backgroundColor,
93
+ borderRadius: t,
94
+ borderLeft: `4px solid ${r.primaryColor}`
95
+ },
96
+ children: [
97
+ /* @__PURE__ */ o.jsx("div", { style: { fontSize: 13, fontWeight: 600, color: r.headerColor, marginBottom: 8 }, children: "对话目标" }),
98
+ p.map((l, m) => /* @__PURE__ */ o.jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: 8, marginBottom: 4 }, children: [
99
+ /* @__PURE__ */ o.jsx($, { style: { color: r.primaryColor, marginTop: 3, fontSize: 13 } }),
100
+ /* @__PURE__ */ o.jsx("span", { style: { fontSize: 13, color: "#595959" }, children: l })
101
+ ] }, m))
102
+ ]
103
+ }
104
+ )),
105
+ /* @__PURE__ */ o.jsxs(
106
+ "div",
107
+ {
108
+ className: "dialogue-chat-area",
109
+ style: {
110
+ borderRadius: t,
111
+ height: C,
112
+ overflowY: "auto",
113
+ marginBottom: 16,
114
+ padding: 16,
115
+ backgroundColor: r.surfaceColor,
116
+ border: `1px solid ${r.borderColor}`
117
+ },
118
+ children: [
119
+ e.map((l, m) => {
120
+ const a = l.role === "teller", j = l.emotion && l.emotion !== "neutral" ? Q[l.emotion] : null;
121
+ return /* @__PURE__ */ o.jsxs(
122
+ "div",
123
+ {
124
+ style: {
125
+ marginBottom: 16,
126
+ display: "flex",
127
+ flexDirection: a ? "row-reverse" : "row",
128
+ alignItems: "flex-start",
129
+ gap: 10
130
+ },
131
+ children: [
132
+ h && /* @__PURE__ */ o.jsx(
133
+ "div",
134
+ {
135
+ style: {
136
+ width: 36,
137
+ height: 36,
138
+ borderRadius: "50%",
139
+ backgroundColor: a ? i : "#bfbfbf",
140
+ color: "#fff",
141
+ display: "flex",
142
+ alignItems: "center",
143
+ justifyContent: "center",
144
+ fontSize: 14,
145
+ fontWeight: 600,
146
+ flexShrink: 0
147
+ },
148
+ children: a ? u[0] : x[0]
149
+ }
150
+ ),
151
+ /* @__PURE__ */ o.jsxs("div", { style: { maxWidth: "70%" }, children: [
152
+ /* @__PURE__ */ o.jsxs(
153
+ "div",
154
+ {
155
+ style: {
156
+ fontSize: 12,
157
+ color: "#8c8c8c",
158
+ marginBottom: 4,
159
+ textAlign: a ? "right" : "left"
160
+ },
161
+ children: [
162
+ a ? u : x,
163
+ W && j && /* @__PURE__ */ o.jsxs(
164
+ I,
165
+ {
166
+ color: j.color,
167
+ style: { marginLeft: 6, fontSize: 11, lineHeight: "18px", padding: "0 6px" },
168
+ children: [
169
+ j.emoji,
170
+ " ",
171
+ j.label
172
+ ]
173
+ }
174
+ )
175
+ ]
176
+ }
177
+ ),
178
+ /* @__PURE__ */ o.jsx(
179
+ "div",
180
+ {
181
+ style: {
182
+ padding: "10px 14px",
183
+ borderRadius: a ? `${t}px 2px ${t}px ${t}px` : `2px ${t}px ${t}px ${t}px`,
184
+ backgroundColor: a ? i : R,
185
+ color: a ? "#fff" : "#262626",
186
+ boxShadow: "0 1px 4px rgba(0,0,0,0.08)",
187
+ border: a ? void 0 : `1px solid ${r.borderColor}`,
188
+ lineHeight: 1.6,
189
+ fontSize: 14
190
+ },
191
+ children: l.content
192
+ }
193
+ ),
194
+ E && /* @__PURE__ */ o.jsx(
195
+ "div",
196
+ {
197
+ style: {
198
+ fontSize: 11,
199
+ color: "#bfbfbf",
200
+ marginTop: 4,
201
+ textAlign: a ? "right" : "left"
202
+ },
203
+ children: U(l.timestamp)
204
+ }
205
+ )
206
+ ] })
207
+ ]
208
+ },
209
+ m
210
+ );
211
+ }),
212
+ c && /* @__PURE__ */ o.jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: 10, marginBottom: 16 }, children: [
213
+ h && /* @__PURE__ */ o.jsx(
214
+ "div",
215
+ {
216
+ style: {
217
+ width: 36,
218
+ height: 36,
219
+ borderRadius: "50%",
220
+ backgroundColor: "#bfbfbf",
221
+ color: "#fff",
222
+ display: "flex",
223
+ alignItems: "center",
224
+ justifyContent: "center",
225
+ fontSize: 14,
226
+ fontWeight: 600,
227
+ flexShrink: 0
228
+ },
229
+ children: x[0]
230
+ }
231
+ ),
232
+ /* @__PURE__ */ o.jsx(
233
+ "div",
234
+ {
235
+ style: {
236
+ padding: "12px 18px",
237
+ borderRadius: `2px ${t}px ${t}px ${t}px`,
238
+ backgroundColor: r.surfaceLightColor,
239
+ border: `1px solid ${r.borderColor}`,
240
+ boxShadow: "0 1px 4px rgba(0,0,0,0.08)"
241
+ },
242
+ children: /* @__PURE__ */ o.jsx("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [0, 1, 2].map((l) => /* @__PURE__ */ o.jsx(
243
+ "span",
244
+ {
245
+ style: {
246
+ width: 7,
247
+ height: 7,
248
+ borderRadius: "50%",
249
+ backgroundColor: r.primaryColor,
250
+ opacity: 0.4,
251
+ display: "inline-block",
252
+ animation: `dialogueTyping 1.4s infinite ${l * 0.2}s`
253
+ }
254
+ },
255
+ l
256
+ )) })
257
+ }
258
+ )
259
+ ] }),
260
+ /* @__PURE__ */ o.jsx("div", { ref: k })
261
+ ]
262
+ }
263
+ ),
264
+ f && /* @__PURE__ */ o.jsxs(
265
+ z,
266
+ {
267
+ size: "small",
268
+ style: {
269
+ marginBottom: 16,
270
+ backgroundColor: "#fff2e8",
271
+ borderColor: "#ffbb96",
272
+ borderRadius: t
273
+ },
274
+ children: [
275
+ /* @__PURE__ */ o.jsx("span", { style: { fontWeight: 600 }, children: "⚠️ AI服务异常:" }),
276
+ f,
277
+ "(将使用模拟回复)"
278
+ ]
279
+ }
280
+ ),
281
+ /* @__PURE__ */ o.jsxs(
282
+ "div",
283
+ {
284
+ style: {
285
+ display: "flex",
286
+ gap: 10,
287
+ padding: 12,
288
+ backgroundColor: r.surfaceLightColor,
289
+ borderRadius: t,
290
+ border: `1px solid ${r.borderColor}`,
291
+ boxShadow: "0 1px 4px rgba(0,0,0,0.06)"
292
+ },
293
+ children: [
294
+ /* @__PURE__ */ o.jsx(
295
+ J,
296
+ {
297
+ value: d,
298
+ onChange: (l) => b(l.target.value),
299
+ onPressEnter: (l) => {
300
+ l.shiftKey || (l.preventDefault(), y());
301
+ },
302
+ placeholder: A,
303
+ autoSize: { minRows: 2, maxRows: 4 },
304
+ style: { flex: 1, border: "none", boxShadow: "none", resize: "none", backgroundColor: r.surfaceLightColor },
305
+ disabled: c
306
+ }
307
+ ),
308
+ /* @__PURE__ */ o.jsx(
309
+ T,
310
+ {
311
+ type: "primary",
312
+ icon: /* @__PURE__ */ o.jsx(M, {}),
313
+ onClick: y,
314
+ disabled: !d.trim() || c,
315
+ loading: c,
316
+ style: {
317
+ alignSelf: "center",
318
+ borderRadius: t,
319
+ backgroundColor: i,
320
+ borderColor: i
321
+ },
322
+ children: "发送"
323
+ }
324
+ )
325
+ ]
326
+ }
327
+ ),
328
+ /* @__PURE__ */ o.jsx("style", { children: `
329
+ @keyframes dialogueTyping {
330
+ 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
331
+ 30% { opacity: 1; transform: translateY(-4px); }
332
+ }
333
+ .dialogue-chat-area::-webkit-scrollbar {
334
+ width: 5px;
335
+ }
336
+ .dialogue-chat-area::-webkit-scrollbar-track {
337
+ background: transparent;
338
+ }
339
+ .dialogue-chat-area::-webkit-scrollbar-thumb {
340
+ background: ${r.primaryColor}33;
341
+ border-radius: 4px;
342
+ }
343
+ .dialogue-chat-area::-webkit-scrollbar-thumb:hover {
344
+ background: ${r.primaryColor}66;
345
+ }
346
+ .dialogue-chat-area {
347
+ scrollbar-width: thin;
348
+ scrollbar-color: ${r.primaryColor}33 transparent;
349
+ }
350
+ ` })
351
+ ] });
352
+ }, re = ({
353
+ initData: e,
354
+ checkRules: d,
355
+ onFinish: c,
356
+ onRealtimeData: f
357
+ }) => {
358
+ var h, C;
359
+ const s = V(e, {
360
+ onRealtimeData: f,
361
+ enableRealtimeGuidance: !0,
362
+ checkRules: d
363
+ }), g = (e == null ? void 0 : e.tellerRoleName) || (e == null ? void 0 : e.targetPosition) || "柜员", p = ((h = e == null ? void 0 : e.roleConfig) == null ? void 0 : h.角色名称) || (e == null ? void 0 : e.customerRoleName) || "客户", u = (e == null ? void 0 : e.uiConfig) || {}, x = e == null ? void 0 : e.caseData, { filledData: n } = N(), b = { ...x || {}, ...e || {} }, y = B((e == null ? void 0 : e.scenario) || "", b, n), v = (C = e == null ? void 0 : e.dialogueGoals) == null ? void 0 : C.map(
364
+ (i) => B(i, b, n)
365
+ ), r = () => {
366
+ const i = s.checkCompletion(d);
367
+ if (!i.canComplete) {
368
+ F.warning(i.reason || "请完成所有必要对话");
369
+ return;
370
+ }
371
+ c({
372
+ stepId: (e == null ? void 0 : e.stepId) || "unknown",
373
+ operationType: "dialogue",
374
+ operationData: {
375
+ dialogueHistory: s.messages,
376
+ dialogueLog: s.dialogueLog,
377
+ totalMessages: s.messages.length,
378
+ mustConfirmResult: d != null && d.mustConfirm ? s.isConfirmed() : void 0
379
+ },
380
+ operationLog: s.dialogueLog,
381
+ timestamp: Date.now(),
382
+ evidenceSummary: K({
383
+ sourceStepId: (e == null ? void 0 : e.stepId) || "unknown",
384
+ sourceStepName: (e == null ? void 0 : e.stepName) || "对话交互",
385
+ sourceType: "dialogue",
386
+ title: `${(e == null ? void 0 : e.stepName) || "对话交互"}摘要`,
387
+ summary: `完成 ${s.messages.length} 条消息的对话交互。`,
388
+ keyFacts: [
389
+ { label: "消息总数", value: String(s.messages.length) },
390
+ { label: "对话轮数", value: String(Math.ceil(s.messages.length / 2)) }
391
+ ]
392
+ })
393
+ });
394
+ };
395
+ return /* @__PURE__ */ o.jsx(
396
+ X,
397
+ {
398
+ messages: s.messages,
399
+ input: s.input,
400
+ aiResponding: s.aiResponding,
401
+ aiError: s.aiError,
402
+ dialogueLogCount: s.dialogueLog.length,
403
+ scenario: y,
404
+ dialogueGoals: v,
405
+ tellerRoleName: g,
406
+ customerRoleName: p,
407
+ uiConfig: u,
408
+ onInputChange: s.setInput,
409
+ onSend: s.handleSend,
410
+ onComplete: r
411
+ }
412
+ );
413
+ };
414
+ export {
415
+ re as default
416
+ };