@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.
- package/README.md +33 -0
- package/dist/ArrowLeftOutlined-CiSQq3bL.js +12 -0
- package/dist/AssessmentPlugin-Bx4VrBdV.js +607 -0
- package/dist/CaseAnalysisPlugin-CQvF9_zr.js +416 -0
- package/dist/CharacterDialoguePanel-Bvdab3qj.js +776 -0
- package/dist/CheckCircleFilled-Byo8CDfW.js +12 -0
- package/dist/CustomLayoutRenderer--rnQrqQ2.js +122524 -0
- package/dist/DecisionSelectPlugin-DtQ2KV34.js +863 -0
- package/dist/DecisionShared-Dh9oeQFT.js +65 -0
- package/dist/DialogueFormPlugin-C9ssnVMr.js +959 -0
- package/dist/DialoguePlugin-DU00QpmQ.js +416 -0
- package/dist/DocumentReviewPlugin-HNOZY1T4.js +977 -0
- package/dist/EyeOutlined-XvOAKlLs.js +12 -0
- package/dist/FormFillingPlugin-DURWsioi.js +445 -0
- package/dist/ModelEditor-BPJsPR0S.js +8264 -0
- package/dist/PluginHeader-B-GESJmT.js +87 -0
- package/dist/ProcessOperationPlugin-IijngDlX.js +88 -0
- package/dist/QAPlugin-Bh_UjK1N.js +184 -0
- package/dist/RadarChart-C5ZM0kWt.js +24963 -0
- package/dist/ReloadOutlined-Daor2m11.js +12 -0
- package/dist/SettingOutlined-CLEOgXB-.js +92 -0
- package/dist/StrategyLabPlugin-DGeZsr_7.js +14361 -0
- package/dist/ThunderboltOutlined-nH_FO_4A.js +44 -0
- package/dist/ToolOutlined-DtuNJDB2.js +28 -0
- package/dist/TrainingModelContainer-DpW-uB8O.js +11883 -0
- package/dist/UndoOutlined-ChUQYUul.js +84 -0
- package/dist/WarningFilled-1Rc4hr0C.js +12 -0
- package/dist/WarningOutlined-5g1d66hO.js +164 -0
- package/dist/adapters-D1FFZFoA.js +51 -0
- package/dist/analysisTools-CXyOvSZT.js +237 -0
- package/dist/creator.js +5 -0
- package/dist/index-CYjdXPgc.js +6568 -0
- package/dist/index-XuBVjlmu.js +44651 -0
- package/dist/index.js +11 -0
- package/dist/judgement-D_9i7x9S.js +20 -0
- package/dist/runtime.js +4 -0
- package/dist/types.js +8 -0
- package/dist/useDialogueLogic-IHELcN3X.js +368 -0
- package/dist-types/client/src/lib/adapters.d.ts +10 -0
- package/dist-types/client/src/lib/creator.d.ts +3 -0
- package/dist-types/client/src/lib/creatorIntegrationContext.d.ts +8 -0
- package/dist-types/client/src/lib/index.d.ts +5 -0
- package/dist-types/client/src/lib/public-types.d.ts +2 -0
- package/dist-types/client/src/lib/runtime.d.ts +3 -0
- package/dist-types/client/src/lib/types.d.ts +301 -0
- package/package.json +83 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { T as o } from "./TrainingModelContainer-DpW-uB8O.js";
|
|
2
|
+
import { M as t, S as s } from "./ModelEditor-BPJsPR0S.js";
|
|
3
|
+
import { c as n, r as p, a as c } from "./adapters-D1FFZFoA.js";
|
|
4
|
+
export {
|
|
5
|
+
t as ModelEditor,
|
|
6
|
+
s as StepByStepCreator,
|
|
7
|
+
o as TrainingRuntime,
|
|
8
|
+
n as createLocalStorageCreatorPersistence,
|
|
9
|
+
p as resolveCreatorNotify,
|
|
10
|
+
c as resolveTokenProvider
|
|
11
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const t = (r) => r === "material-review" ? "material-review" : "identity-verification", c = (r, e) => r === "assessment" || r === "select" ? r : e != null && e.options ? "select" : "assessment", o = (r = [], e = []) => r.length > 0 ? r : e, a = (r) => ({
|
|
2
|
+
...r,
|
|
3
|
+
rawRef: r.sourceStepId
|
|
4
|
+
}), u = (r = [], e) => r.find((s) => s.sourceType === e), l = (r = []) => r.map((e, s) => ({
|
|
5
|
+
id: `${e.sourceStepId}-${s}`,
|
|
6
|
+
label: e.title,
|
|
7
|
+
category: "风险性",
|
|
8
|
+
result: e.riskFlags && e.riskFlags.length > 0 ? "warning" : "pass",
|
|
9
|
+
comment: e.summary,
|
|
10
|
+
evidence: e.keyFacts.map((n) => `${n.label}:${n.value}`),
|
|
11
|
+
stepId: e.rawRef || e.sourceStepId
|
|
12
|
+
}));
|
|
13
|
+
export {
|
|
14
|
+
a,
|
|
15
|
+
l as b,
|
|
16
|
+
t as c,
|
|
17
|
+
o as d,
|
|
18
|
+
u as f,
|
|
19
|
+
c as n
|
|
20
|
+
};
|
package/dist/runtime.js
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { c as s, r as t, a as E } from "./adapters-D1FFZFoA.js";
|
|
2
|
+
var e = /* @__PURE__ */ ((r) => (r.FORM_FILLING = "form-filling", r.DIALOGUE = "dialogue", r.DIALOGUE_FORM = "dialogue-form", r.PROCESS_OPERATION = "process-operation", r.DOCUMENT_REVIEW = "document-review", r.DECISION_MAKING = "decision-making", r.CASE_ANALYSIS = "case-analysis", r.STRATEGY_LAB = "strategy-lab", r.KNOWLEDGE_LEARNING = "knowledge-learning", r))(e || {});
|
|
3
|
+
export {
|
|
4
|
+
e as PluginType,
|
|
5
|
+
s as createLocalStorageCreatorPersistence,
|
|
6
|
+
t as resolveCreatorNotify,
|
|
7
|
+
E as resolveTokenProvider
|
|
8
|
+
};
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { useState as J, useRef as B, useCallback as G, useEffect as X } from "react";
|
|
2
|
+
import { message as Y } from "antd";
|
|
3
|
+
import { b as D, c as Z, a as re, p as ce } from "./TrainingModelContainer-DpW-uB8O.js";
|
|
4
|
+
import { g as ee, f as te, a as ue, r as le } from "./RadarChart-C5ZM0kWt.js";
|
|
5
|
+
function de(e, a) {
|
|
6
|
+
const { requiredTopics: o, mustConfirm: r } = e;
|
|
7
|
+
if (!(o != null && o.length) && !r) return "";
|
|
8
|
+
const g = [`
|
|
9
|
+
## 考核检查(请在 checkResult 中返回结果)`];
|
|
10
|
+
return o != null && o.length && g.push(`必须涉及的话题:${o.join("、")}`), r && g.push(`需要${a}认可:是`), g.join(`
|
|
11
|
+
`);
|
|
12
|
+
}
|
|
13
|
+
const me = (e, a = {}) => {
|
|
14
|
+
const o = ee("COACH_AGENT"), {
|
|
15
|
+
domain: r = "金融",
|
|
16
|
+
tellerRoleName: g = "服务人员",
|
|
17
|
+
customerRoleName: y = "客户"
|
|
18
|
+
} = a, [I, $] = J(null), [F, v] = J(!1), b = B(/* @__PURE__ */ new Set()), w = B(!1), c = B(null), M = (n) => `
|
|
19
|
+
## 实训场景信息
|
|
20
|
+
- 模型名称:${n.modelName || ""}
|
|
21
|
+
- 业务领域:${r}
|
|
22
|
+
- 业务类型:${n.businessType || ""}
|
|
23
|
+
- 目标岗位:${n.targetPosition || g}
|
|
24
|
+
|
|
25
|
+
## 当前对话情况
|
|
26
|
+
${g}刚刚说的话:
|
|
27
|
+
"${n.tellerMessage}"
|
|
28
|
+
|
|
29
|
+
${y}的回复:
|
|
30
|
+
${n.customerMessage || "(尚未回复)"}
|
|
31
|
+
|
|
32
|
+
## 对话历史
|
|
33
|
+
${n.dialogueHistory || "(对话刚开始)"}
|
|
34
|
+
|
|
35
|
+
## ${y}当前情绪
|
|
36
|
+
${n.customerEmotion || "neutral"}
|
|
37
|
+
## 评估要求
|
|
38
|
+
请基于以上信息评估${g}的话术,判断是否需要指导,并给出具体的指导建议(如果需要)。评估重点包括但不限于:
|
|
39
|
+
- 语气是否得当
|
|
40
|
+
- 用词是否专业
|
|
41
|
+
- 是否有不当用语
|
|
42
|
+
- 是否重要信息遗漏
|
|
43
|
+
- 客户情绪变化
|
|
44
|
+
${de(n, y)}
|
|
45
|
+
`.trim(), Q = (n) => {
|
|
46
|
+
const p = [];
|
|
47
|
+
p.push(`${g}:"${n.tellerMessage}"`), n.customerMessage && p.push(`${y}回复:"${n.customerMessage}"`), n.customerEmotion && n.customerEmotion !== "neutral" && p.push(`${y}当前情绪:${n.customerEmotion}`);
|
|
48
|
+
const R = f(n);
|
|
49
|
+
return R && p.push(R), p.join(`
|
|
50
|
+
`);
|
|
51
|
+
}, f = (n) => {
|
|
52
|
+
const { requiredTopics: p, mustConfirm: R } = n, h = p == null ? void 0 : p.filter((x) => !b.current.has(x)), l = R && !w.current;
|
|
53
|
+
if (!(h != null && h.length) && !l) return "";
|
|
54
|
+
const N = [`
|
|
55
|
+
## 剩余考核项`];
|
|
56
|
+
return h != null && h.length && N.push(`未覆盖话题:${h.join("、")}`), l && N.push(`需要${y}认可:是`), N.join(`
|
|
57
|
+
`);
|
|
58
|
+
}, u = G(
|
|
59
|
+
async (n) => {
|
|
60
|
+
var p;
|
|
61
|
+
if (!e || !o)
|
|
62
|
+
return console.warn("无法获取实时指导:缺少 token 或 botId"), null;
|
|
63
|
+
v(!0);
|
|
64
|
+
try {
|
|
65
|
+
const R = c.current ? Q(n) : M(n), h = await te({
|
|
66
|
+
botId: o,
|
|
67
|
+
prompt: R,
|
|
68
|
+
token: e,
|
|
69
|
+
conversationId: c.current || void 0,
|
|
70
|
+
autoSaveHistory: !0
|
|
71
|
+
});
|
|
72
|
+
if (h.conversationId && (c.current = h.conversationId), !h.response)
|
|
73
|
+
return console.warn("实时指导返回空响应"), null;
|
|
74
|
+
let l;
|
|
75
|
+
try {
|
|
76
|
+
l = JSON.parse(h.response);
|
|
77
|
+
} catch {
|
|
78
|
+
console.warn("实时指导返回非 JSON 格式,尝试解析文本");
|
|
79
|
+
const C = n.tellerMessage.toLowerCase();
|
|
80
|
+
let A = null;
|
|
81
|
+
return (C.includes("怎么了") || C.includes("干什么")) && (A = {
|
|
82
|
+
severity: "warning",
|
|
83
|
+
message: "语气可能引起客户不适",
|
|
84
|
+
suggestion: '建议使用"请问有什么可以帮您"等更友好的表达'
|
|
85
|
+
}), (C.includes("开户") || C.includes("办理")) && !C.includes("费用") && !C.includes("手续费") && !C.includes("需要") && (A = {
|
|
86
|
+
severity: "info",
|
|
87
|
+
message: "建议告知客户相关费用和所需材料",
|
|
88
|
+
suggestion: '可以说"开户需要携带身份证,可能会收取一定手续费"'
|
|
89
|
+
}), (C.includes("不行") || C.includes("不能")) && (A = {
|
|
90
|
+
severity: "warning",
|
|
91
|
+
message: "直接拒绝可能引起客户反感",
|
|
92
|
+
suggestion: '建议使用"目前暂时不支持"等更委婉的表达'
|
|
93
|
+
}), A ? ($(A), D.getState().addGuidance({
|
|
94
|
+
severity: A.severity,
|
|
95
|
+
message: A.message,
|
|
96
|
+
suggestion: A.suggestion
|
|
97
|
+
}), A) : null;
|
|
98
|
+
}
|
|
99
|
+
const N = l.type === "guidance" && l.data, x = N ? l.severity || l.data.severity : l.severity, H = N ? l.data.message : l.message, U = N ? l.data.suggestion : l.suggestion, W = N ? !0 : l.needGuidance, P = N ? (p = l.data) == null ? void 0 : p.checkResult : l.checkResult;
|
|
100
|
+
if (P && (Array.isArray(P.coveredTopics) && P.coveredTopics.forEach((C) => b.current.add(C)), P.confirmed === !0 && (w.current = !0)), !W || !x || !H)
|
|
101
|
+
return $(null), null;
|
|
102
|
+
const E = {
|
|
103
|
+
severity: x,
|
|
104
|
+
message: H,
|
|
105
|
+
suggestion: U
|
|
106
|
+
};
|
|
107
|
+
return $(E), D.getState().addGuidance({
|
|
108
|
+
severity: E.severity,
|
|
109
|
+
message: E.message,
|
|
110
|
+
suggestion: E.suggestion
|
|
111
|
+
}), E;
|
|
112
|
+
} catch (R) {
|
|
113
|
+
return console.error("获取实时指导失败:", R), null;
|
|
114
|
+
} finally {
|
|
115
|
+
v(!1);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
[e, o]
|
|
119
|
+
), j = G(() => {
|
|
120
|
+
$(null);
|
|
121
|
+
}, []), S = G(() => [...b.current], []), k = G(() => w.current, []), O = G(() => {
|
|
122
|
+
b.current = /* @__PURE__ */ new Set(), w.current = !1, c.current = null;
|
|
123
|
+
}, []), V = G((n) => {
|
|
124
|
+
c.current = n;
|
|
125
|
+
}, []), K = G(() => c.current, []);
|
|
126
|
+
return {
|
|
127
|
+
guidance: I,
|
|
128
|
+
// 当前指导信息
|
|
129
|
+
loading: F,
|
|
130
|
+
// 是否正在获取指导
|
|
131
|
+
evaluateGuidance: u,
|
|
132
|
+
// 评估并获取指导
|
|
133
|
+
clearGuidance: j,
|
|
134
|
+
// 清除指导
|
|
135
|
+
getCoveredTopics: S,
|
|
136
|
+
// 获取 AI 已判定覆盖的话题列表
|
|
137
|
+
isConfirmed: k,
|
|
138
|
+
// AI 角色是否已认可学生主张
|
|
139
|
+
resetCheckState: O,
|
|
140
|
+
// 重置考核检查状态(切换案例/步骤时调用)
|
|
141
|
+
setGuidanceConversationId: V,
|
|
142
|
+
// 设置会话 ID(从缓存恢复时使用)
|
|
143
|
+
getGuidanceConversationId: K
|
|
144
|
+
// 获取当前会话 ID(持久化时使用)
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
function $e(e, a = {}) {
|
|
148
|
+
const {
|
|
149
|
+
onRealtimeData: o,
|
|
150
|
+
onMessageReceived: r,
|
|
151
|
+
buildPrompt: g,
|
|
152
|
+
enableRealtimeGuidance: y = !0,
|
|
153
|
+
checkRules: I
|
|
154
|
+
} = a, $ = (e == null ? void 0 : e.stepId) || "", F = (e == null ? void 0 : e.botId) || ee("ACTOR_AGENT"), v = (e == null ? void 0 : e.currentUser) || { userId: "student-001" }, b = (e == null ? void 0 : e.tellerRoleName) || (e == null ? void 0 : e.targetPosition) || "柜员", w = (e == null ? void 0 : e.customerRoleName) || "客户", c = (e == null ? void 0 : e.domain) || "银行", { filledData: M } = ue(), Q = { ...(e == null ? void 0 : e.caseData) || {}, ...e || {} }, f = B(Z.getState().getDialogue($)), [u, j] = J(() => {
|
|
155
|
+
var s, t, i, m, d;
|
|
156
|
+
return (t = (s = f.current) == null ? void 0 : s.messages) != null && t.length ? f.current.messages : [{
|
|
157
|
+
role: "customer",
|
|
158
|
+
content: ((m = (i = e == null ? void 0 : e.caseData) == null ? void 0 : i.customerInfo) == null ? void 0 : m.purpose) || ((d = e == null ? void 0 : e.customerInfo) == null ? void 0 : d.purpose) || "你好",
|
|
159
|
+
timestamp: Date.now()
|
|
160
|
+
}];
|
|
161
|
+
}), [S, k] = J(""), [O, V] = J(
|
|
162
|
+
() => {
|
|
163
|
+
var s;
|
|
164
|
+
return ((s = f.current) == null ? void 0 : s.dialogueLog) || [];
|
|
165
|
+
}
|
|
166
|
+
), [K, n] = J(!1), { callAI: p, ready: R, error: h, token: l, setConversationId: N, getConversationId: x } = re(F, v);
|
|
167
|
+
X(() => {
|
|
168
|
+
var s;
|
|
169
|
+
(s = f.current) != null && s.conversationId && N(f.current.conversationId);
|
|
170
|
+
}, [N]);
|
|
171
|
+
const {
|
|
172
|
+
evaluateGuidance: H,
|
|
173
|
+
getCoveredTopics: U,
|
|
174
|
+
isConfirmed: W,
|
|
175
|
+
resetCheckState: P,
|
|
176
|
+
setGuidanceConversationId: E,
|
|
177
|
+
getGuidanceConversationId: C
|
|
178
|
+
} = me(l, {
|
|
179
|
+
domain: c,
|
|
180
|
+
tellerRoleName: b,
|
|
181
|
+
customerRoleName: w
|
|
182
|
+
});
|
|
183
|
+
X(() => {
|
|
184
|
+
var s;
|
|
185
|
+
(s = f.current) != null && s.guidanceConversationId && E(f.current.guidanceConversationId);
|
|
186
|
+
}, [E]), X(() => {
|
|
187
|
+
$ && Z.getState().saveDialogue($, {
|
|
188
|
+
messages: u,
|
|
189
|
+
dialogueLog: O,
|
|
190
|
+
conversationId: x(),
|
|
191
|
+
guidanceConversationId: C()
|
|
192
|
+
});
|
|
193
|
+
}, [u, O, $, x, C]);
|
|
194
|
+
const A = G((s) => {
|
|
195
|
+
const { data: t } = s, i = {
|
|
196
|
+
role: "customer",
|
|
197
|
+
content: t.content,
|
|
198
|
+
timestamp: Date.now(),
|
|
199
|
+
emotion: t.emotion,
|
|
200
|
+
feedback: t.feedback
|
|
201
|
+
};
|
|
202
|
+
if (j((m) => [...m, i]), r == null || r(i), t.talkQuality && t.feedback) {
|
|
203
|
+
const d = {
|
|
204
|
+
excellent: { type: "success", text: "优秀" },
|
|
205
|
+
good: { type: "success", text: "良好" },
|
|
206
|
+
average: { type: "info", text: "一般" },
|
|
207
|
+
poor: { type: "warning", text: "需改进" }
|
|
208
|
+
}[t.talkQuality];
|
|
209
|
+
Y.open({
|
|
210
|
+
type: d.type,
|
|
211
|
+
content: `话术质量:${d.text} - ${t.feedback}`,
|
|
212
|
+
duration: 8
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}, [r]), q = G(async (s) => {
|
|
216
|
+
if (!R) {
|
|
217
|
+
Y.error("AI服务未就绪");
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
n(!0);
|
|
221
|
+
try {
|
|
222
|
+
const t = g ? g(s, u, e) : ge(
|
|
223
|
+
s,
|
|
224
|
+
u,
|
|
225
|
+
e,
|
|
226
|
+
b,
|
|
227
|
+
w,
|
|
228
|
+
c,
|
|
229
|
+
Q,
|
|
230
|
+
M
|
|
231
|
+
);
|
|
232
|
+
await p(t, (i, m) => {
|
|
233
|
+
if (m) {
|
|
234
|
+
const { command: d, cleanContent: T } = ce(i, "dialogue");
|
|
235
|
+
if (d)
|
|
236
|
+
A(d);
|
|
237
|
+
else {
|
|
238
|
+
try {
|
|
239
|
+
const L = JSON.parse(T);
|
|
240
|
+
if (L && L.type) return;
|
|
241
|
+
} catch {
|
|
242
|
+
}
|
|
243
|
+
const _ = {
|
|
244
|
+
role: "customer",
|
|
245
|
+
content: T,
|
|
246
|
+
timestamp: Date.now()
|
|
247
|
+
};
|
|
248
|
+
j((L) => [...L, _]), r == null || r(_);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
} catch (t) {
|
|
253
|
+
console.error("AI调用失败:", t), Y.error("AI回复失败,请重试");
|
|
254
|
+
const i = {
|
|
255
|
+
role: "customer",
|
|
256
|
+
content: fe(s, e),
|
|
257
|
+
timestamp: Date.now()
|
|
258
|
+
};
|
|
259
|
+
j((m) => [...m, i]), r == null || r(i);
|
|
260
|
+
} finally {
|
|
261
|
+
n(!1);
|
|
262
|
+
}
|
|
263
|
+
}, [R, p, u, e, A, g, r, b, w, c]), oe = G(() => {
|
|
264
|
+
var i;
|
|
265
|
+
if (!S.trim()) return;
|
|
266
|
+
const s = S, t = {
|
|
267
|
+
role: "teller",
|
|
268
|
+
content: s,
|
|
269
|
+
timestamp: Date.now()
|
|
270
|
+
};
|
|
271
|
+
if (j((m) => [...m, t]), V((m) => [...m, t]), o == null || o({
|
|
272
|
+
type: "dialogue",
|
|
273
|
+
message: t
|
|
274
|
+
}), y) {
|
|
275
|
+
const m = u.slice(-4).map((z) => `${z.role === "teller" ? b : w}: ${z.content}`).join(`
|
|
276
|
+
`), d = [...u].reverse().find((z) => z.role === "customer"), T = (d == null ? void 0 : d.emotion) || "neutral", _ = (I == null ? void 0 : I.requiredTopics) || ((i = I == null ? void 0 : I.dialogueRules) == null ? void 0 : i.requiredTopics), L = I == null ? void 0 : I.mustConfirm;
|
|
277
|
+
H({
|
|
278
|
+
tellerMessage: s,
|
|
279
|
+
customerMessage: d == null ? void 0 : d.content,
|
|
280
|
+
dialogueHistory: m,
|
|
281
|
+
customerEmotion: T,
|
|
282
|
+
modelName: e == null ? void 0 : e.modelName,
|
|
283
|
+
businessType: e == null ? void 0 : e.businessType,
|
|
284
|
+
targetPosition: e == null ? void 0 : e.targetPosition,
|
|
285
|
+
requiredTopics: _,
|
|
286
|
+
mustConfirm: L
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
q(s), k("");
|
|
290
|
+
}, [S, u, o, y, H, q, b, w]), se = G((s) => {
|
|
291
|
+
var t;
|
|
292
|
+
if (!s) return { canComplete: !0 };
|
|
293
|
+
if (s.minRounds && O.length < s.minRounds)
|
|
294
|
+
return { canComplete: !1, reason: `至少需要 ${s.minRounds} 轮对话` };
|
|
295
|
+
if (((t = s.requiredTopics) == null ? void 0 : t.length) > 0) {
|
|
296
|
+
const i = u.filter((T) => T.role === "teller").map((T) => T.content).join(" "), m = new Set(U()), d = s.requiredTopics.filter(
|
|
297
|
+
(T) => !i.includes(T) && !m.has(T)
|
|
298
|
+
);
|
|
299
|
+
if (d.length > 0)
|
|
300
|
+
return { canComplete: !1, reason: `还需涉及:${d.join("、")}` };
|
|
301
|
+
}
|
|
302
|
+
return { canComplete: !0 };
|
|
303
|
+
}, [O, u, U]), ne = G(() => {
|
|
304
|
+
$ && Z.getState().clearStep($), P();
|
|
305
|
+
}, [$, P]);
|
|
306
|
+
return {
|
|
307
|
+
messages: u,
|
|
308
|
+
input: S,
|
|
309
|
+
dialogueLog: O,
|
|
310
|
+
aiResponding: K,
|
|
311
|
+
aiError: h,
|
|
312
|
+
ready: R,
|
|
313
|
+
setInput: k,
|
|
314
|
+
handleSend: oe,
|
|
315
|
+
checkCompletion: se,
|
|
316
|
+
isConfirmed: W,
|
|
317
|
+
cleanup: ne
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function ge(e, a, o, r = "柜员", g = "客户", y = "银行", I, $) {
|
|
321
|
+
const F = (o == null ? void 0 : o.roleConfig) || {}, v = o == null ? void 0 : o.caseData, b = (o == null ? void 0 : o.scenario) || `${y}业务办理`, w = le(b, I || v, $), c = (v == null ? void 0 : v.customerInfo) || (o == null ? void 0 : o.customerInfo) || {}, M = (v == null ? void 0 : v.businessData) || (o == null ? void 0 : o.businessData) || {};
|
|
322
|
+
if (!a.some((f) => f.role === "teller")) {
|
|
323
|
+
const f = [], u = (c == null ? void 0 : c.name) || (c == null ? void 0 : c.姓名) || (c == null ? void 0 : c.customerName);
|
|
324
|
+
return u && f.push(`姓名:${u}`), Object.entries(F).forEach(([j, S]) => {
|
|
325
|
+
if (j === "角色编号") return;
|
|
326
|
+
let k;
|
|
327
|
+
Array.isArray(S) ? k = S.join("、") : typeof S == "object" && S !== null ? k = JSON.stringify(S, null, 2) : k = String(S || ""), k && f.push(`${j}:${k}`);
|
|
328
|
+
}), `
|
|
329
|
+
【场景信息】
|
|
330
|
+
场景:${w}
|
|
331
|
+
|
|
332
|
+
【角色设定】
|
|
333
|
+
你扮演的角色信息如下${u ? `,你的名字是"${u}"` : ""}:
|
|
334
|
+
${f.length > 0 ? f.join(`
|
|
335
|
+
`) : "(无特殊设定)"}
|
|
336
|
+
|
|
337
|
+
【客户信息】
|
|
338
|
+
${JSON.stringify(c, null, 2)}
|
|
339
|
+
|
|
340
|
+
【业务数据】
|
|
341
|
+
${JSON.stringify(M, null, 2)}
|
|
342
|
+
|
|
343
|
+
【对话要求】
|
|
344
|
+
请以JSON格式返回你的回复,格式如下:
|
|
345
|
+
{
|
|
346
|
+
"type": "dialogue",
|
|
347
|
+
"data": {
|
|
348
|
+
"role": "customer",
|
|
349
|
+
"content": "你的回复内容",
|
|
350
|
+
"emotion": "neutral",
|
|
351
|
+
"talkQuality": "good",
|
|
352
|
+
"feedback": "对${r}话术的简短评价(可选)"
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
${r}: ${e}
|
|
357
|
+
`.trim();
|
|
358
|
+
}
|
|
359
|
+
return `${r}: ${e}`;
|
|
360
|
+
}
|
|
361
|
+
function fe(e, a) {
|
|
362
|
+
var r, g, y;
|
|
363
|
+
const o = e.toLowerCase();
|
|
364
|
+
return o.includes("您好") || o.includes("你好") ? "你好!" : o.includes("办理") || o.includes("业务") ? ((g = (r = a == null ? void 0 : a.caseData) == null ? void 0 : r.customerInfo) == null ? void 0 : g.purpose) || ((y = a == null ? void 0 : a.customerInfo) == null ? void 0 : y.purpose) || "我想开个储蓄账户" : o.includes("材料") || o.includes("证件") ? "我带了身份证,还需要什么吗?" : o.includes("开户") || o.includes("账户") ? "开储蓄账户需要多少钱?有什么要求吗?" : o.includes("费用") || o.includes("手续费") ? "好的,我明白了。" : "好的,谢谢!";
|
|
365
|
+
}
|
|
366
|
+
export {
|
|
367
|
+
$e as u
|
|
368
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CreatorNotifyAdapter, CreatorPersistenceAdapter, TokenProvider } from './types';
|
|
2
|
+
export declare function resolveTokenProvider(params: {
|
|
3
|
+
cozeToken?: string;
|
|
4
|
+
getToken?: TokenProvider;
|
|
5
|
+
}): TokenProvider;
|
|
6
|
+
export declare function resolveCreatorNotify(notify?: CreatorNotifyAdapter, fallback?: CreatorNotifyAdapter): CreatorNotifyAdapter;
|
|
7
|
+
export declare function createLocalStorageCreatorPersistence(params?: {
|
|
8
|
+
storageKey?: string;
|
|
9
|
+
expireMs?: number;
|
|
10
|
+
}): CreatorPersistenceAdapter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CreatorNotifyAdapter, TokenProvider } from './types';
|
|
3
|
+
export interface CreatorIntegrationContextValue {
|
|
4
|
+
getToken?: TokenProvider;
|
|
5
|
+
notify?: CreatorNotifyAdapter;
|
|
6
|
+
}
|
|
7
|
+
export declare const CreatorIntegrationProvider: React.Provider<CreatorIntegrationContextValue>;
|
|
8
|
+
export declare const useCreatorIntegration: () => CreatorIntegrationContextValue;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { TrainingRuntime } from './runtime';
|
|
2
|
+
export type { TrainingEngineProps, TrainingResult } from './runtime';
|
|
3
|
+
export { StepByStepCreator, ModelEditor } from './creator';
|
|
4
|
+
export type { StepByStepCreatorProps, ModelEditorProps, TrainingModel, Case, StudentOperationResult, EvaluationReport, PluginType, CreatorContext, CreatorNotifyAdapter, CreatorPersistenceAdapter, RuntimePersistenceAdapter, TokenProvider, } from './types';
|
|
5
|
+
export { createLocalStorageCreatorPersistence, resolveCreatorNotify, resolveTokenProvider, } from './adapters';
|