@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,301 @@
1
+ import type { ReactNode } from 'react';
2
+ export type Domain = 'banking' | 'insurance' | 'trade';
3
+ export type Difficulty = 'easy' | 'medium' | 'hard';
4
+ export type TrainingLevel = 'undergraduate' | 'vocational' | 'technical';
5
+ export type AbilityCategory = 'basic' | 'core' | 'comprehensive';
6
+ export type EntryAnimationType = 'time-skip' | 'scene-change' | 'event-intro' | 'result-summary';
7
+ export declare enum PluginType {
8
+ FORM_FILLING = "form-filling",
9
+ DIALOGUE = "dialogue",
10
+ DIALOGUE_FORM = "dialogue-form",
11
+ PROCESS_OPERATION = "process-operation",
12
+ DOCUMENT_REVIEW = "document-review",
13
+ DECISION_MAKING = "decision-making",
14
+ CASE_ANALYSIS = "case-analysis",
15
+ STRATEGY_LAB = "strategy-lab",
16
+ KNOWLEDGE_LEARNING = "knowledge-learning"
17
+ }
18
+ export interface EvaluationDimension {
19
+ name: string;
20
+ weight: number;
21
+ checkPoints?: string[];
22
+ requiredFields?: string[];
23
+ }
24
+ export interface GlobalRules {
25
+ stagePassScore: number;
26
+ stepPassScore: number;
27
+ timeout: number;
28
+ }
29
+ export interface EvaluationRules {
30
+ dimensions: EvaluationDimension[];
31
+ businessRules: string[];
32
+ }
33
+ export interface EntryAnimation {
34
+ type: EntryAnimationType;
35
+ narration: string;
36
+ }
37
+ export interface StepTargetAbility {
38
+ abilityId: string;
39
+ targetLevel: number;
40
+ weight: number;
41
+ }
42
+ export interface Step {
43
+ stepId: string;
44
+ name: string;
45
+ description?: string;
46
+ learningObjectives?: string[];
47
+ pluginId: string;
48
+ pluginType: PluginType;
49
+ initData: any;
50
+ checkRules: any;
51
+ jumpRules?: any;
52
+ entryAnimation?: EntryAnimation;
53
+ order: number;
54
+ targetAbilities?: StepTargetAbility[];
55
+ }
56
+ export interface Stage {
57
+ stageId: string;
58
+ name: string;
59
+ description: string;
60
+ businessType: string;
61
+ learningObjectives?: string[];
62
+ evaluationRules: EvaluationRules;
63
+ steps: Step[];
64
+ order: number;
65
+ }
66
+ export interface RoleConfig {
67
+ 角色编号: string;
68
+ 角色名称: string;
69
+ 角色类型: string;
70
+ [key: string]: any;
71
+ }
72
+ export interface CaseSchemaField {
73
+ path: string;
74
+ type: 'string' | 'number' | 'boolean' | 'enum' | 'date' | 'object' | 'array';
75
+ label: string;
76
+ purpose?: string;
77
+ rule?: string;
78
+ enumValues?: string[];
79
+ maxLength?: number;
80
+ children?: CaseSchemaField[];
81
+ }
82
+ export interface CaseSchemaConstraint {
83
+ type: 'derived' | 'consistent' | 'conditional';
84
+ fields?: string[];
85
+ description?: string;
86
+ rule?: string;
87
+ conditionField?: string;
88
+ conditionValue?: string[];
89
+ sourceField?: string;
90
+ targetField?: string;
91
+ }
92
+ export interface CaseSchema {
93
+ fields: CaseSchemaField[];
94
+ constraints: CaseSchemaConstraint[];
95
+ }
96
+ export interface Case {
97
+ caseId: string;
98
+ name: string;
99
+ description: string;
100
+ difficulty: Difficulty;
101
+ scenario: string;
102
+ customerInfo: any;
103
+ businessData: any;
104
+ standardAnswer: any;
105
+ riskPoints?: string[];
106
+ rolePool: Record<string, RoleConfig>;
107
+ }
108
+ export interface AbilityNode {
109
+ id: string;
110
+ name: string;
111
+ category: AbilityCategory;
112
+ description?: string;
113
+ weight: number;
114
+ children?: AbilityNode[];
115
+ relatedSteps?: string[];
116
+ }
117
+ export interface AbilityMap {
118
+ targetPosition: string;
119
+ version: string;
120
+ abilities: AbilityNode[];
121
+ totalWeight: number;
122
+ createdAt?: Date;
123
+ updatedAt?: Date;
124
+ }
125
+ export interface TrainingModel {
126
+ modelId: string;
127
+ name: string;
128
+ domain: Domain;
129
+ businessType?: string;
130
+ targetPosition?: string;
131
+ description: string;
132
+ learningObjectives?: string;
133
+ trainingLevel?: TrainingLevel;
134
+ trainingType?: string;
135
+ ideologicalElements?: string;
136
+ ideologicalRatio?: number;
137
+ botId?: string;
138
+ uiConfig?: any;
139
+ globalRules: GlobalRules;
140
+ caseSchema?: CaseSchema;
141
+ cases?: Case[];
142
+ defaultCaseId?: string;
143
+ abilityMap?: AbilityMap;
144
+ stages: Stage[];
145
+ createdAt?: Date;
146
+ updatedAt?: Date;
147
+ }
148
+ export interface EvidenceSummary {
149
+ sourceStepId: string;
150
+ sourceStepName?: string;
151
+ sourceType: string;
152
+ title: string;
153
+ summary: string;
154
+ keyFacts: Array<{
155
+ label: string;
156
+ value: string;
157
+ }>;
158
+ riskFlags?: string[];
159
+ conclusion?: string;
160
+ rawRef?: string;
161
+ }
162
+ export interface StudentOperationResult {
163
+ stepId: string;
164
+ operationType: string;
165
+ operationData: any;
166
+ operationLog: any[];
167
+ timestamp: number;
168
+ evidenceSummary?: EvidenceSummary;
169
+ }
170
+ export interface DimensionResult {
171
+ name: string;
172
+ score: number;
173
+ feedback: string;
174
+ errors?: string[];
175
+ suggestions?: string[];
176
+ }
177
+ export interface EvaluationReport {
178
+ totalScore: number;
179
+ dimensions: DimensionResult[];
180
+ highlights: string[];
181
+ improvements: string[];
182
+ nextStepAdvice: string;
183
+ pass: boolean;
184
+ }
185
+ export interface ScenarioDimension {
186
+ key: string;
187
+ dimensionLabel: string;
188
+ value: string;
189
+ fieldHint?: string;
190
+ }
191
+ export interface CreatorContext {
192
+ basicInfo: {
193
+ domain: string;
194
+ businessType: string;
195
+ targetPosition: string;
196
+ description: string;
197
+ learningObjectives?: string;
198
+ trainingLevel?: TrainingLevel;
199
+ trainingType?: string;
200
+ ideologicalElements?: string;
201
+ ideologicalRatio?: number;
202
+ };
203
+ intentData?: any;
204
+ caseScenario: {
205
+ selectedCases: Array<{
206
+ value: string;
207
+ label: string;
208
+ description?: string;
209
+ }>;
210
+ customCase: string;
211
+ scenarioSeeds?: Record<string, ScenarioDimension[]>;
212
+ };
213
+ outline: {
214
+ stages: Array<{
215
+ name: string;
216
+ description: string;
217
+ businessType: string;
218
+ learningObjectives?: string[];
219
+ steps: Array<{
220
+ name: string;
221
+ description: string;
222
+ learningObjectives?: string[];
223
+ }>;
224
+ }>;
225
+ summary?: string;
226
+ } | null;
227
+ outlineMessages: Array<{
228
+ role: 'user' | 'ai';
229
+ content: string;
230
+ }>;
231
+ designConversationId?: string | null;
232
+ generatedModel?: TrainingModel;
233
+ caseSchema?: CaseSchema;
234
+ generatedCases?: Case[];
235
+ casesConversationId?: string | null;
236
+ currentStep: number;
237
+ savedAt: number;
238
+ }
239
+ export type TokenProvider = () => string | Promise<string>;
240
+ export interface CreatorNotifyAdapter {
241
+ success(message: string): void;
242
+ error(message: string): void;
243
+ warning(message: string): void;
244
+ info?(message: string): void;
245
+ }
246
+ export interface CreatorPersistenceAdapter {
247
+ load(): CreatorContext | null | Promise<CreatorContext | null>;
248
+ save(context: CreatorContext): void | Promise<void>;
249
+ clear(): void | Promise<void>;
250
+ }
251
+ export interface RuntimePersistenceAdapter {
252
+ initSession?(payload: unknown): void | Promise<void>;
253
+ loadSession?(sessionId: string): unknown | Promise<unknown>;
254
+ saveProcess?(payload: unknown): void | Promise<void>;
255
+ saveEvaluation?(payload: unknown): void | Promise<void>;
256
+ saveResult?(payload: unknown): void | Promise<void>;
257
+ saveConversation?(payload: unknown): void | Promise<void>;
258
+ }
259
+ export interface CurrentUser {
260
+ userId: string;
261
+ name: string;
262
+ }
263
+ export interface TrainingResult {
264
+ sessionId: string;
265
+ studentId: string;
266
+ modelId: string;
267
+ completedStages: number;
268
+ totalScore: number;
269
+ evaluationHistory: EvaluationReport[];
270
+ operationLog: any[];
271
+ startTime: Date;
272
+ endTime: Date;
273
+ }
274
+ export interface TrainingRuntimeProps {
275
+ trainingModel?: TrainingModel;
276
+ modelId?: string;
277
+ selectedCase?: Case;
278
+ studentId: string;
279
+ currentUser: CurrentUser;
280
+ onComplete?: (result: TrainingResult) => void;
281
+ onStepComplete?: (stepResult: StudentOperationResult) => void;
282
+ onError?: (error: Error) => void;
283
+ botId?: string;
284
+ onSwitchCase?: (caseItem: Case) => void;
285
+ }
286
+ export interface StepByStepCreatorProps {
287
+ cozeToken?: string;
288
+ getToken?: TokenProvider;
289
+ persistence?: CreatorPersistenceAdapter;
290
+ notify?: CreatorNotifyAdapter;
291
+ onComplete: (model: TrainingModel) => void;
292
+ onCancel: () => void;
293
+ }
294
+ export interface ModelEditorProps {
295
+ model: TrainingModel;
296
+ onSave: (model: TrainingModel) => void;
297
+ onCancel: () => void;
298
+ getToken?: TokenProvider;
299
+ notify?: CreatorNotifyAdapter;
300
+ children?: ReactNode;
301
+ }
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@sim-design/training",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist-types/client/src/lib/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist-types/client/src/lib/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./runtime": {
14
+ "types": "./dist-types/client/src/lib/runtime.d.ts",
15
+ "import": "./dist/runtime.js"
16
+ },
17
+ "./creator": {
18
+ "types": "./dist-types/client/src/lib/creator.d.ts",
19
+ "import": "./dist/creator.js"
20
+ },
21
+ "./types": {
22
+ "types": "./dist-types/client/src/lib/public-types.d.ts",
23
+ "import": "./dist/types.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist/*.js",
28
+ "dist-types/client/src/lib/**/*",
29
+ "README.md"
30
+ ],
31
+ "scripts": {
32
+ "dev": "vite",
33
+ "build": "tsc && vite build",
34
+ "build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json",
35
+ "pack:lib": "npm run build:lib && npm pack",
36
+ "publish:lib": "npm run build:lib && npm publish --access public",
37
+ "preview": "vite preview",
38
+ "lint": "eslint . --ext ts,tsx --max-warnings 0",
39
+ "test": "vitest run",
40
+ "prepublishOnly": "npm run build:lib"
41
+ },
42
+ "peerDependencies": {
43
+ "antd": "^5.29.3",
44
+ "react": "^18.2.0",
45
+ "react-dom": "^18.2.0"
46
+ },
47
+ "dependencies": {
48
+ "@babel/standalone": "^7.29.1",
49
+ "@coze/api": "^1.3.9",
50
+ "@dnd-kit/core": "^6.3.1",
51
+ "@dnd-kit/sortable": "^10.0.0",
52
+ "@dnd-kit/utilities": "^3.2.2",
53
+ "@monaco-editor/react": "^4.7.0",
54
+ "axios": "^1.6.2",
55
+ "echarts": "^5.5.1",
56
+ "echarts-for-react": "^3.0.6",
57
+ "echarts-gl": "^2.0.9",
58
+ "framer-motion": "^12.35.0",
59
+ "json-rules-engine": "^6.4.0",
60
+ "react-countup": "^6.5.3",
61
+ "react-live": "^4.1.8",
62
+ "react-markdown": "^10.1.0",
63
+ "recharts": "^3.7.0",
64
+ "umi-request": "^1.4.0",
65
+ "zustand": "^4.4.7"
66
+ },
67
+ "devDependencies": {
68
+ "@types/react": "^18.2.43",
69
+ "@types/react-dom": "^18.2.17",
70
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
71
+ "@typescript-eslint/parser": "^6.14.0",
72
+ "@vitejs/plugin-react": "^4.2.1",
73
+ "antd": "^5.29.3",
74
+ "eslint": "^8.55.0",
75
+ "eslint-plugin-react-hooks": "^4.6.0",
76
+ "eslint-plugin-react-refresh": "^0.4.5",
77
+ "less": "^4.5.1",
78
+ "react": "^18.2.0",
79
+ "react-dom": "^18.2.0",
80
+ "typescript": "^5.2.2",
81
+ "vite": "^5.0.8"
82
+ }
83
+ }