@sim-design/training 1.0.0 → 1.1.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 +481 -15
- package/dist/{ArrowLeftOutlined-CiSQq3bL.js → ArrowLeftOutlined-BxA84GXs.js} +1 -1
- package/dist/ArrowLeftOutlined-D785XjyB.js +12 -0
- package/dist/{AssessmentPlugin-Bx4VrBdV.js → AssessmentPlugin-D_iesmyg.js} +7 -7
- package/dist/AssessmentPlugin-zRr-IsdA.js +607 -0
- package/dist/CaseAnalysisPlugin-CXuQpkPd.js +2196 -0
- package/dist/CaseAnalysisPlugin-DytlXsRD.js +2196 -0
- package/dist/CaseDetailContent-DT5nCtRT.js +28613 -0
- package/dist/CaseDetailContent-Y7Q430MG.js +28595 -0
- package/dist/{CharacterDialoguePanel-Bvdab3qj.js → CharacterDialoguePanel-CdtUl-Sv.js} +178 -139
- package/dist/CharacterDialoguePanel-D_4YNFZv.js +815 -0
- package/dist/{CheckCircleFilled-Byo8CDfW.js → CheckCircleFilled-CnslIY7j.js} +1 -1
- package/dist/CheckCircleFilled-NvZaC2sk.js +12 -0
- package/dist/DecisionMakingPlugin-B_KQUFzW.js +1385 -0
- package/dist/DecisionMakingPlugin-ILLGek3S.js +1385 -0
- package/dist/{DecisionSelectPlugin-DtQ2KV34.js → DecisionSelectPlugin-BGQiHGBK.js} +20 -11
- package/dist/DecisionSelectPlugin-Bqmh6XGh.js +872 -0
- package/dist/{DecisionShared-Dh9oeQFT.js → DecisionShared-BHq1lEqt.js} +2 -2
- package/dist/DecisionShared-Be-zKZLT.js +65 -0
- package/dist/DeleteOutlined-BvMjU7m5.js +12 -0
- package/dist/DeleteOutlined-Dqy6M2LH.js +12 -0
- package/dist/{CustomLayoutRenderer--rnQrqQ2.js → DialogueFormPlugin-BpCeFadt.js} +22724 -21631
- package/dist/DialogueFormPlugin-CXlbxX-z.js +123617 -0
- package/dist/DialoguePlugin-CO7Nzv0K.js +596 -0
- package/dist/DialoguePlugin-DDNdsylz.js +596 -0
- package/dist/DocumentReviewPlugin-2CnKQwVG.js +1967 -0
- package/dist/DocumentReviewPlugin-qYYrnjvE.js +1967 -0
- package/dist/{EyeOutlined-XvOAKlLs.js → EyeOutlined-BrKCNjui.js} +1 -1
- package/dist/EyeOutlined-CW0tYV0f.js +12 -0
- package/dist/FormFillingPlugin-C3h8ySOZ.js +969 -0
- package/dist/FormFillingPlugin-CPmd76Qr.js +969 -0
- package/dist/HolderOutlined-CH0tShWu.js +12 -0
- package/dist/HolderOutlined-Dm6TBtqf.js +12 -0
- package/dist/ModelEditor-BjEbFloQ.js +11753 -0
- package/dist/ModelEditor-CwR67DFQ.js +11753 -0
- package/dist/{ProcessOperationPlugin-IijngDlX.js → ProcessOperationPlugin-1Lz431aC.js} +12 -12
- package/dist/ProcessOperationPlugin-BkmdG3ch.js +88 -0
- package/dist/QAPlugin-0C4kpq3J.js +172 -0
- package/dist/QAPlugin-UC8uywcg.js +172 -0
- package/dist/{ReloadOutlined-Daor2m11.js → ReloadOutlined-BZ92nlYF.js} +1 -1
- package/dist/ReloadOutlined-CYoPOwLl.js +12 -0
- package/dist/{SettingOutlined-CLEOgXB-.js → SettingOutlined-F466s0Ti.js} +33 -65
- package/dist/SettingOutlined-c2hikCfN.js +60 -0
- package/dist/StarFilled-Bilmj6UK.js +28 -0
- package/dist/StarFilled-CtH30fL0.js +28 -0
- package/dist/StrategyLabPlugin-CvO07sXV.js +12445 -0
- package/dist/StrategyLabPlugin-DUqZYctQ.js +12445 -0
- package/dist/ThunderboltOutlined-BpmoCKdV.js +28 -0
- package/dist/ThunderboltOutlined-DDQFi5Cv.js +28 -0
- package/dist/TrainingModelContainer-DqCsdC7C.js +11241 -0
- package/dist/TrainingModelContainer-yi8W6KFl.js +11241 -0
- package/dist/{UndoOutlined-ChUQYUul.js → UndoOutlined-6JZVzmdX.js} +26 -42
- package/dist/UndoOutlined-Dw6_9_OL.js +68 -0
- package/dist/{WarningFilled-1Rc4hr0C.js → WarningFilled-Cy1tvuQy.js} +1 -1
- package/dist/WarningFilled-lkr453eh.js +12 -0
- package/dist/{adapters-D1FFZFoA.js → adapters-BbCnXSYo.js} +2 -2
- package/dist/{analysisTools-CXyOvSZT.js → analysisTools-Cp5-3DaU.js} +59 -12
- package/dist/creator.js +4 -2
- package/dist/designTokens-walF_QkZ.js +23 -0
- package/dist/images/healthcare/bg.jpg +0 -0
- package/dist/{index-CYjdXPgc.js → index-C71iHgSs.js} +2640 -2722
- package/dist/{index-XuBVjlmu.js → index-CBvqcbIU.js} +7214 -7643
- package/dist/index-D94YNWTb.js +433 -0
- package/dist/index-DSYmOXnQ.js +6486 -0
- package/dist/index-fP97rKeQ.js +433 -0
- package/dist/index.js +8 -6
- package/dist/judgement-xTGXlDcn.js +29 -0
- package/dist/runtime.js +1 -1
- package/dist/sortable.esm-bm_c5vmI.js +3307 -0
- package/dist/types.js +1 -1
- package/dist/useDialogueLogic-D1lkUKUZ.js +576 -0
- package/dist/useDialogueLogic-vOJ9XRNP.js +576 -0
- package/dist-types/client/src/admin/CaseDataEditor.d.ts +20 -0
- package/dist-types/client/src/admin/CaseEditor.d.ts +19 -0
- package/dist-types/client/src/admin/DialogueFormCheckRulesEditor.d.ts +11 -0
- package/dist-types/client/src/admin/DialogueFormInitDataEditor.d.ts +31 -0
- package/dist-types/client/src/admin/InitDataEditors.d.ts +7 -0
- package/dist-types/client/src/admin/ModelEditor.d.ts +11 -0
- package/dist-types/client/src/admin/ModelPreview.d.ts +13 -0
- package/dist-types/client/src/admin/OptionSelector.d.ts +32 -0
- package/dist-types/client/src/admin/StageStepEditor.d.ts +20 -0
- package/dist-types/client/src/admin/StepAnswerKeyEditor.d.ts +19 -0
- package/dist-types/client/src/admin/StepByStepCreator.d.ts +27 -0
- package/dist-types/client/src/admin/components/AbilityMapEditor.d.ts +12 -0
- package/dist-types/client/src/admin/components/CasePreview.d.ts +8 -0
- package/dist-types/client/src/admin/components/StepAbilitySelector.d.ts +9 -0
- package/dist-types/client/src/admin/constants/creatorConstants.d.ts +39 -0
- package/dist-types/client/src/admin/editors/CaseAnalysisEditor.d.ts +11 -0
- package/dist-types/client/src/admin/editors/DecisionMakingEditor.d.ts +7 -0
- package/dist-types/client/src/admin/editors/DialogueEditor.d.ts +12 -0
- package/dist-types/client/src/admin/editors/DocumentReviewEditor.d.ts +7 -0
- package/dist-types/client/src/admin/editors/DocumentReviewRuntimeRulesEditor.d.ts +15 -0
- package/dist-types/client/src/admin/editors/FormFillingEditor.d.ts +33 -0
- package/dist-types/client/src/admin/editors/ModelUIConfigEditor.d.ts +5 -0
- package/dist-types/client/src/admin/editors/QAEditor.d.ts +6 -0
- package/dist-types/client/src/admin/editors/RouterEditors.d.ts +18 -0
- package/dist-types/client/src/admin/editors/StepBriefingEditor.d.ts +14 -0
- package/dist-types/client/src/admin/editors/StrategyLabEditor.d.ts +24 -0
- package/dist-types/client/src/admin/editors/decisionEditorParts.d.ts +18 -0
- package/dist-types/client/src/admin/editors/index.d.ts +8 -0
- package/dist-types/client/src/admin/editors/shared.d.ts +17 -0
- package/dist-types/client/src/admin/hooks/useStep1Intent.d.ts +16 -0
- package/dist-types/client/src/admin/hooks/useStep2Outline.d.ts +41 -0
- package/dist-types/client/src/admin/hooks/useStep3Details.d.ts +123 -0
- package/dist-types/client/src/admin/hooks/useStep4Cases.d.ts +48 -0
- package/dist-types/client/src/admin/hooks/useStep5Validation.d.ts +16 -0
- package/dist-types/client/src/admin/landingValidation.d.ts +74 -0
- package/dist-types/client/src/admin/schemaFieldUtils.d.ts +55 -0
- package/dist-types/client/src/admin/services.d.ts +461 -0
- package/dist-types/client/src/admin/shared-editors.d.ts +31 -0
- package/dist-types/client/src/admin/types/creatorArtifacts.d.ts +140 -0
- package/dist-types/client/src/components/AbilityMapView.d.ts +15 -0
- package/dist-types/client/src/components/CaseDetail/CaseDetailContent.d.ts +12 -0
- package/dist-types/client/src/components/ConversationalDataCollector/IntentConfirmPanel.d.ts +20 -0
- package/dist-types/client/src/components/ConversationalDataCollector/index.d.ts +7 -0
- package/dist-types/client/src/components/ConversationalDataCollector/intentState.d.ts +24 -0
- package/dist-types/client/src/components/ConversationalDataCollector/types.d.ts +95 -0
- package/dist-types/client/src/components/ConversationalDataCollector/utils.d.ts +62 -0
- package/dist-types/client/src/components/CustomLayoutRenderer.d.ts +8 -0
- package/dist-types/client/src/components/MarkdownRenderer.d.ts +15 -0
- package/dist-types/client/src/components/StrategyLabScene/VisualInputComponents.d.ts +85 -0
- package/dist-types/client/src/components/StrategyLabScene/components/AdversarialView.d.ts +18 -0
- package/dist-types/client/src/components/StrategyLabScene/components/BottomBar.d.ts +22 -0
- package/dist-types/client/src/components/StrategyLabScene/components/CharacterCard.d.ts +14 -0
- package/dist-types/client/src/components/StrategyLabScene/components/CharacterDialoguePanel.d.ts +32 -0
- package/dist-types/client/src/components/StrategyLabScene/components/CollaborativeView.d.ts +20 -0
- package/dist-types/client/src/components/StrategyLabScene/components/ComparisonView.d.ts +16 -0
- package/dist-types/client/src/components/StrategyLabScene/components/DecisionInput.d.ts +27 -0
- package/dist-types/client/src/components/StrategyLabScene/components/DecisionSwitcher.d.ts +14 -0
- package/dist-types/client/src/components/StrategyLabScene/components/EvaluationReport.d.ts +13 -0
- package/dist-types/client/src/components/StrategyLabScene/components/NodeChainPanels.d.ts +32 -0
- package/dist-types/client/src/components/StrategyLabScene/components/ProgressSteps.d.ts +15 -0
- package/dist-types/client/src/components/StrategyLabScene/components/SandboxView.d.ts +19 -0
- package/dist-types/client/src/components/StrategyLabScene/components/ScenarioPanel.d.ts +17 -0
- package/dist-types/client/src/components/StrategyLabScene/components/SimulationAnimation.d.ts +13 -0
- package/dist-types/client/src/components/StrategyLabScene/components/SimulationResult.d.ts +15 -0
- package/dist-types/client/src/components/StrategyLabScene/components/StressTestView.d.ts +22 -0
- package/dist-types/client/src/components/StrategyLabScene/themeMatching.d.ts +21 -0
- package/dist-types/client/src/components/StrategyLabScene/themes/education.d.ts +45 -0
- package/dist-types/client/src/components/StrategyLabScene/themes/healthcare.d.ts +7 -0
- package/dist-types/client/src/components/StrategyLabScene/themes/index.d.ts +22 -0
- package/dist-types/client/src/components/StrategyLabScene/themes/professional.d.ts +7 -0
- package/dist-types/client/src/components/StrategyLabScene/themes/technology.d.ts +7 -0
- package/dist-types/client/src/components/StrategyLabScene/types.d.ts +82 -0
- package/dist-types/client/src/components/StrategyLabScene/views/UnifiedStrategyLabView.d.ts +72 -0
- package/dist-types/client/src/components/TrainingEngine/BriefingQAChat.d.ts +19 -0
- package/dist-types/client/src/components/TrainingEngine/CaseInfoModal.d.ts +12 -0
- package/dist-types/client/src/components/TrainingEngine/CaseSelector.d.ts +15 -0
- package/dist-types/client/src/components/TrainingEngine/ClassicView.d.ts +7 -0
- package/dist-types/client/src/components/TrainingEngine/DashboardHomePage.d.ts +7 -0
- package/dist-types/client/src/components/TrainingEngine/EnhancedStudentProfilePanel.d.ts +9 -0
- package/dist-types/client/src/components/TrainingEngine/EvaluationPanel.d.ts +8 -0
- package/dist-types/client/src/components/TrainingEngine/GlobalQAPanel.d.ts +34 -0
- package/dist-types/client/src/components/TrainingEngine/GuidanceHistoryDrawer.d.ts +7 -0
- package/dist-types/client/src/components/TrainingEngine/GuidancePanel.d.ts +3 -0
- package/dist-types/client/src/components/TrainingEngine/ImmersiveGameView.d.ts +7 -0
- package/dist-types/client/src/components/TrainingEngine/PluginRenderer.d.ts +15 -0
- package/dist-types/client/src/components/TrainingEngine/ProgressTracker.d.ts +3 -0
- package/dist-types/client/src/components/TrainingEngine/StageAssessingOverlay.d.ts +17 -0
- package/dist-types/client/src/components/TrainingEngine/StageAssessmentPanel.d.ts +10 -0
- package/dist-types/client/src/components/TrainingEngine/StepExecutor.d.ts +20 -0
- package/dist-types/client/src/components/TrainingEngine/StepNodeMap.d.ts +15 -0
- package/dist-types/client/src/components/TrainingEngine/StudentProfilePanel.d.ts +6 -0
- package/dist-types/client/src/components/TrainingEngine/ThemeContext.d.ts +8 -0
- package/dist-types/client/src/components/TrainingEngine/TrainingMaterialsSidebar.d.ts +21 -0
- package/dist-types/client/src/components/TrainingEngine/TrainingModelContainer.d.ts +42 -0
- package/dist-types/client/src/components/TrainingEngine/ViewProps.d.ts +37 -0
- package/dist-types/client/src/components/TrainingEngine/profileDataSelectors.d.ts +23 -0
- package/dist-types/client/src/components/TrainingEngine/stepInitData.d.ts +42 -0
- package/dist-types/client/src/components/TrainingEngine/targetAbilityUtils.d.ts +11 -0
- package/dist-types/client/src/components/VisualizationRenderer/ChartRenderer.d.ts +12 -0
- package/dist-types/client/src/components/VisualizationRenderer/types.d.ts +41 -0
- package/dist-types/client/src/config/appConfig.d.ts +15 -0
- package/dist-types/client/src/configs/agentConfig.d.ts +66 -0
- package/dist-types/client/src/configs/intentDiscoveryConfig.d.ts +22 -0
- package/dist-types/client/src/data/mockTrainingModel.d.ts +10 -0
- package/dist-types/client/src/hooks/useAIService.d.ts +17 -0
- package/dist-types/client/src/hooks/useDialogueLogic.d.ts +53 -0
- package/dist-types/client/src/hooks/useFormFillingLogic.d.ts +26 -0
- package/dist-types/client/src/hooks/useFormRealtimeGuidance.d.ts +45 -0
- package/dist-types/client/src/hooks/useRealtimeGuidance.d.ts +66 -0
- package/dist-types/client/src/hooks/useStageAssessment.d.ts +8 -0
- package/dist-types/client/src/hooks/useStepExecution.d.ts +14 -0
- package/dist-types/client/src/hooks/useTrainingModel.d.ts +30 -0
- package/dist-types/client/src/lib/creator.d.ts +1 -0
- package/dist-types/client/src/lib/index.d.ts +1 -0
- package/dist-types/client/src/lib/types.d.ts +113 -22
- package/dist-types/client/src/plugins/AssessmentPlugin.d.ts +8 -0
- package/dist-types/client/src/plugins/CaseAnalysisPlugin.d.ts +9 -0
- package/dist-types/client/src/plugins/CaseAnalysisPluginView.d.ts +26 -0
- package/dist-types/client/src/plugins/DecisionSelectPlugin.d.ts +8 -0
- package/dist-types/client/src/plugins/DialogueFormPlugin.d.ts +9 -0
- package/dist-types/client/src/plugins/DialogueFormPluginView.d.ts +37 -0
- package/dist-types/client/src/plugins/DialoguePlugin.d.ts +8 -0
- package/dist-types/client/src/plugins/DialoguePluginView.d.ts +44 -0
- package/dist-types/client/src/plugins/DocumentReview/DocumentCard.d.ts +47 -0
- package/dist-types/client/src/plugins/DocumentReview/LayoutComponents.d.ts +47 -0
- package/dist-types/client/src/plugins/DocumentReview/MarkListPanel.d.ts +51 -0
- package/dist-types/client/src/plugins/DocumentReview/MarkModal.d.ts +37 -0
- package/dist-types/client/src/plugins/DocumentReview/ResultPanel.d.ts +32 -0
- package/dist-types/client/src/plugins/DocumentReview/Toolbar.d.ts +31 -0
- package/dist-types/client/src/plugins/DocumentReview/designTokens.d.ts +76 -0
- package/dist-types/client/src/plugins/DocumentReviewPlugin.d.ts +14 -0
- package/dist-types/client/src/plugins/ProcessOperationPlugin.d.ts +8 -0
- package/dist-types/client/src/plugins/QAPlugin.d.ts +9 -0
- package/dist-types/client/src/plugins/StrategyLabPlugin.d.ts +7 -0
- package/dist-types/client/src/plugins/decision-making/DecisionMakingPlugin.d.ts +4 -0
- package/dist-types/client/src/plugins/decision-making/DecisionWorkspace.d.ts +23 -0
- package/dist-types/client/src/plugins/decision-making/MaterialsPanel.d.ts +18 -0
- package/dist-types/client/src/plugins/decision-making/logic.d.ts +46 -0
- package/dist-types/client/src/plugins/decision-making/scoring.d.ts +79 -0
- package/dist-types/client/src/plugins/decision-making/styles.d.ts +743 -0
- package/dist-types/client/src/plugins/decision-making/types.d.ts +179 -0
- package/dist-types/client/src/plugins/form-filling/DocumentFormLayout.d.ts +22 -0
- package/dist-types/client/src/plugins/form-filling/FormAssistPanel.d.ts +20 -0
- package/dist-types/client/src/plugins/form-filling/FormFillingPlugin.d.ts +15 -0
- package/dist-types/client/src/plugins/form-filling/forms.d.ts +28 -0
- package/dist-types/client/src/plugins/form-filling/scoring.d.ts +86 -0
- package/dist-types/client/src/plugins/form-filling/useFormFilling.d.ts +42 -0
- package/dist-types/client/src/plugins/form-filling/validationRules.d.ts +26 -0
- package/dist-types/client/src/plugins/shared/DecisionShared.d.ts +54 -0
- package/dist-types/client/src/plugins/shared/FrameworkWidget.d.ts +19 -0
- package/dist-types/client/src/plugins/shared/PluginFooter.d.ts +4 -0
- package/dist-types/client/src/plugins/shared/PluginHeader.d.ts +4 -0
- package/dist-types/client/src/plugins/shared/analysisTools.d.ts +30 -0
- package/dist-types/client/src/plugins/shared/disturbanceUtils.d.ts +5 -0
- package/dist-types/client/src/plugins/shared/index.d.ts +5 -0
- package/dist-types/client/src/plugins/shared/jsonRepair.d.ts +39 -0
- package/dist-types/client/src/plugins/shared/judgement.d.ts +46 -0
- package/dist-types/client/src/plugins/shared/nodeChain.d.ts +15 -0
- package/dist-types/client/src/plugins/shared/renderFieldGrid.d.ts +16 -0
- package/dist-types/client/src/plugins/shared/reportBlocks.d.ts +33 -0
- package/dist-types/client/src/plugins/shared/reportEvaluation.d.ts +30 -0
- package/dist-types/client/src/plugins/shared/reportExport.d.ts +12 -0
- package/dist-types/client/src/plugins/shared/reportWorkbench/BlockPropertiesPanel.d.ts +9 -0
- package/dist-types/client/src/plugins/shared/reportWorkbench/BlockToolbox.d.ts +11 -0
- package/dist-types/client/src/plugins/shared/reportWorkbench/ReportWorkbench.d.ts +20 -0
- package/dist-types/client/src/plugins/shared/reportWorkbench/SortableBlock.d.ts +15 -0
- package/dist-types/client/src/plugins/shared/reportWorkbench/factory.d.ts +14 -0
- package/dist-types/client/src/plugins/shared/reportWorkbench/outlineDraft.d.ts +7 -0
- package/dist-types/client/src/plugins/shared/simulationEngine.d.ts +112 -0
- package/dist-types/client/src/plugins/shared/simulationModes.d.ts +21 -0
- package/dist-types/client/src/plugins/shared/themes.d.ts +5 -0
- package/dist-types/client/src/plugins/shared/types.d.ts +1247 -0
- package/dist-types/client/src/services/AICommandHandler.d.ts +68 -0
- package/dist-types/client/src/services/cozeApiClient.d.ts +44 -0
- package/dist-types/client/src/services/mockApi.d.ts +48 -0
- package/dist-types/client/src/services/storageService.d.ts +88 -0
- package/dist-types/client/src/stores/abilityStore.d.ts +33 -0
- package/dist-types/client/src/stores/dialogueStore.d.ts +30 -0
- package/dist-types/client/src/stores/formRegistryStore.d.ts +45 -0
- package/dist-types/client/src/stores/guidanceStore.d.ts +17 -0
- package/dist-types/client/src/stores/stepEvidenceStore.d.ts +14 -0
- package/dist-types/client/src/stores/strategyLabStore.d.ts +46 -0
- package/dist-types/client/src/stores/trainingStore.d.ts +84 -0
- package/dist-types/client/src/types/ai-commands.d.ts +144 -0
- package/dist-types/client/src/types.d.ts +17 -0
- package/dist-types/client/src/utils/abilityMapGenerator.d.ts +27 -0
- package/dist-types/client/src/utils/formUtils.d.ts +66 -0
- package/dist-types/client/src/utils/rule-engine.d.ts +36 -0
- package/dist-types/shared/types/index.d.ts +592 -0
- package/package.json +5 -3
- package/dist/CaseAnalysisPlugin-CQvF9_zr.js +0 -416
- package/dist/DialogueFormPlugin-C9ssnVMr.js +0 -959
- package/dist/DialoguePlugin-DU00QpmQ.js +0 -416
- package/dist/DocumentReviewPlugin-HNOZY1T4.js +0 -977
- package/dist/FormFillingPlugin-DURWsioi.js +0 -445
- package/dist/ModelEditor-BPJsPR0S.js +0 -8264
- package/dist/PluginHeader-B-GESJmT.js +0 -87
- package/dist/QAPlugin-Bh_UjK1N.js +0 -184
- package/dist/RadarChart-C5ZM0kWt.js +0 -24963
- package/dist/StrategyLabPlugin-DGeZsr_7.js +0 -14361
- package/dist/ThunderboltOutlined-nH_FO_4A.js +0 -44
- package/dist/ToolOutlined-DtuNJDB2.js +0 -28
- package/dist/TrainingModelContainer-DpW-uB8O.js +0 -11883
- package/dist/WarningOutlined-5g1d66hO.js +0 -164
- package/dist/judgement-D_9i7x9S.js +0 -20
- package/dist/useDialogueLogic-IHELcN3X.js +0 -368
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as s, r as t, a as E } from "./adapters-
|
|
1
|
+
import { c as s, r as t, a as E } from "./adapters-BbCnXSYo.js";
|
|
2
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
3
|
export {
|
|
4
4
|
e as PluginType,
|
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
import { useState as G, useRef as ae, useCallback as j, useEffect as me } from "react";
|
|
2
|
+
import { message as $e } from "antd";
|
|
3
|
+
import { g as je, f as Me, k as Ge, a as Ue, c as _e, r as Ie } from "./CaseDetailContent-Y7Q430MG.js";
|
|
4
|
+
import { g as be, p as ze } from "./TrainingModelContainer-DqCsdC7C.js";
|
|
5
|
+
function Ye(e, b) {
|
|
6
|
+
const { requiredTopics: s, mustConfirm: a } = e;
|
|
7
|
+
if (!(s != null && s.length) && !a) return "";
|
|
8
|
+
const v = [`
|
|
9
|
+
## 考核检查(请在 checkResult 中返回结果)`];
|
|
10
|
+
return s != null && s.length && v.push(`必须涉及的话题:${s.join("、")}`), a && v.push(`需要${b}认可:是`), v.join(`
|
|
11
|
+
`);
|
|
12
|
+
}
|
|
13
|
+
const Ke = (e, b = {}) => {
|
|
14
|
+
const s = je("COACH_AGENT"), {
|
|
15
|
+
domain: a = "金融",
|
|
16
|
+
tellerRoleName: v = "服务人员",
|
|
17
|
+
customerRoleName: N = "客户"
|
|
18
|
+
} = b, [r, U] = G(null), [R, se] = G(!1), X = ae(/* @__PURE__ */ new Set()), B = ae(!1), x = ae(null), Z = (t) => {
|
|
19
|
+
var y, i, f;
|
|
20
|
+
const c = [];
|
|
21
|
+
return (y = t.pendingConditionDisturbances) != null && y.length && (c.push(`
|
|
22
|
+
## [扰动条件判定]`), c.push("以下条件是否在当前对话中已满足?逐条回答 true/false:"), t.pendingConditionDisturbances.forEach((o, S) => {
|
|
23
|
+
c.push(`${S + 1}. id="${o.id}":${o.condition}`);
|
|
24
|
+
})), (i = t.phases) != null && i.length && (c.push(`
|
|
25
|
+
## [阶段判定]`), c.push("当前对话阶段列表:"), t.phases.forEach((o, S) => {
|
|
26
|
+
const q = o.transitionHint ? `(进入条件:${o.transitionHint})` : "";
|
|
27
|
+
c.push(`${S + 1}. id="${o.id}",名称:${o.name}${q}`);
|
|
28
|
+
}), c.push("当前处于哪个阶段?返回阶段 id。")), (f = t.branchRulesToEvaluate) != null && f.length && (c.push(`
|
|
29
|
+
## [分支评估]`), c.push("以下分支条件是否已满足?请给出判断(met: true/false)和置信度(confidence: 0-1):"), t.branchRulesToEvaluate.forEach((o, S) => {
|
|
30
|
+
c.push(`${S + 1}. id="${o.id}":${o.condition}`);
|
|
31
|
+
})), t.resistanceFadeCondition && (c.push(`
|
|
32
|
+
## [阻力衰减判定]`), c.push(`以下条件是否已满足(true/false):${t.resistanceFadeCondition}`)), c.length ? (c.push(`
|
|
33
|
+
## V2 判定结果(在常规 guidance JSON 中追加以下字段,仅当有对应输入时才包含):
|
|
34
|
+
{
|
|
35
|
+
"disturbanceConditions": [{"id": "xxx", "met": true}],
|
|
36
|
+
"currentPhase": "phase-id",
|
|
37
|
+
"branchEvaluations": [{"id": "xxx", "met": true, "confidence": 0.8}],
|
|
38
|
+
"resistanceFaded": false
|
|
39
|
+
}`), c.join(`
|
|
40
|
+
`)) : "";
|
|
41
|
+
}, E = (t) => {
|
|
42
|
+
var y;
|
|
43
|
+
const c = (y = t.dialogueGoals) != null && y.length ? `
|
|
44
|
+
## 本次对话目标
|
|
45
|
+
${t.dialogueGoals.map((i, f) => `${f + 1}. ${i}`).join(`
|
|
46
|
+
`)}
|
|
47
|
+
` : "";
|
|
48
|
+
return `
|
|
49
|
+
## 实训场景信息
|
|
50
|
+
- 模型名称:${t.modelName || ""}
|
|
51
|
+
- 业务领域:${a}
|
|
52
|
+
- 业务类型:${t.businessType || ""}
|
|
53
|
+
- 目标岗位:${t.targetPosition || v}
|
|
54
|
+
${c}
|
|
55
|
+
## 当前对话情况
|
|
56
|
+
${v}刚刚说的话:
|
|
57
|
+
"${t.tellerMessage}"
|
|
58
|
+
|
|
59
|
+
${N}的回复:
|
|
60
|
+
${t.customerMessage || "(尚未回复)"}
|
|
61
|
+
|
|
62
|
+
## 对话历史
|
|
63
|
+
${t.dialogueHistory || "(对话刚开始)"}
|
|
64
|
+
|
|
65
|
+
## ${N}当前情绪
|
|
66
|
+
${t.customerEmotion || "neutral"}
|
|
67
|
+
## 评估要求
|
|
68
|
+
请基于以上信息评估${v}的话术,判断是否需要指导,并给出具体的指导建议(如果需要)。评估重点包括但不限于:
|
|
69
|
+
- 语气是否得当
|
|
70
|
+
- 用词是否专业
|
|
71
|
+
- 是否有不当用语
|
|
72
|
+
- 是否重要信息遗漏
|
|
73
|
+
- 客户情绪变化
|
|
74
|
+
${Ye(t, N)}${Z(t)}
|
|
75
|
+
`.trim();
|
|
76
|
+
}, _ = (t) => {
|
|
77
|
+
const c = [];
|
|
78
|
+
c.push(`${v}:"${t.tellerMessage}"`), t.customerMessage && c.push(`${N}回复:"${t.customerMessage}"`), t.customerEmotion && t.customerEmotion !== "neutral" && c.push(`${N}当前情绪:${t.customerEmotion}`);
|
|
79
|
+
const y = I(t);
|
|
80
|
+
y && c.push(y);
|
|
81
|
+
const i = Z(t);
|
|
82
|
+
return i && c.push(i), c.join(`
|
|
83
|
+
`);
|
|
84
|
+
}, I = (t) => {
|
|
85
|
+
const { requiredTopics: c, mustConfirm: y } = t, i = c == null ? void 0 : c.filter((S) => !X.current.has(S)), f = y && !B.current;
|
|
86
|
+
if (!(i != null && i.length) && !f) return "";
|
|
87
|
+
const o = [`
|
|
88
|
+
## 剩余考核项`];
|
|
89
|
+
return i != null && i.length && o.push(`未覆盖话题:${i.join("、")}`), f && o.push(`需要${N}认可:是`), o.join(`
|
|
90
|
+
`);
|
|
91
|
+
}, g = j(
|
|
92
|
+
async (t) => {
|
|
93
|
+
var y;
|
|
94
|
+
const c = { guidance: null };
|
|
95
|
+
if (!e || !s)
|
|
96
|
+
return console.warn("无法获取实时指导:缺少 token 或 botId"), c;
|
|
97
|
+
se(!0);
|
|
98
|
+
try {
|
|
99
|
+
const i = x.current ? _(t) : E(t), f = await Me({
|
|
100
|
+
botId: s,
|
|
101
|
+
prompt: i,
|
|
102
|
+
token: e,
|
|
103
|
+
conversationId: x.current || void 0,
|
|
104
|
+
autoSaveHistory: !0
|
|
105
|
+
});
|
|
106
|
+
if (f.conversationId && (x.current = f.conversationId), !f.response)
|
|
107
|
+
return console.warn("实时指导返回空响应"), c;
|
|
108
|
+
let o;
|
|
109
|
+
try {
|
|
110
|
+
o = JSON.parse(f.response);
|
|
111
|
+
} catch {
|
|
112
|
+
console.warn("实时指导返回非 JSON 格式,尝试解析文本");
|
|
113
|
+
const $ = t.tellerMessage.toLowerCase();
|
|
114
|
+
let J = null;
|
|
115
|
+
return ($.includes("怎么了") || $.includes("干什么")) && (J = {
|
|
116
|
+
severity: "warning",
|
|
117
|
+
message: "语气可能引起客户不适",
|
|
118
|
+
suggestion: '建议使用"请问有什么可以帮您"等更友好的表达'
|
|
119
|
+
}), ($.includes("开户") || $.includes("办理")) && !$.includes("费用") && !$.includes("手续费") && !$.includes("需要") && (J = {
|
|
120
|
+
severity: "info",
|
|
121
|
+
message: "建议告知客户相关费用和所需材料",
|
|
122
|
+
suggestion: '可以说"开户需要携带身份证,可能会收取一定手续费"'
|
|
123
|
+
}), ($.includes("不行") || $.includes("不能")) && (J = {
|
|
124
|
+
severity: "warning",
|
|
125
|
+
message: "直接拒绝可能引起客户反感",
|
|
126
|
+
suggestion: '建议使用"目前暂时不支持"等更委婉的表达'
|
|
127
|
+
}), J ? (U(J), Ge.getState().addGuidance({
|
|
128
|
+
severity: J.severity,
|
|
129
|
+
message: J.message,
|
|
130
|
+
suggestion: J.suggestion
|
|
131
|
+
}), { guidance: J }) : c;
|
|
132
|
+
}
|
|
133
|
+
const S = o.type === "guidance" && o.data, q = S ? o.severity || o.data.severity : o.severity, ce = S ? o.data.message : o.message, O = S ? o.data.suggestion : o.suggestion, pe = S ? !0 : o.needGuidance, Q = S ? (y = o.data) == null ? void 0 : y.checkResult : o.checkResult;
|
|
134
|
+
Q && (Array.isArray(Q.coveredTopics) && Q.coveredTopics.forEach(($) => X.current.add($)), Q.confirmed === !0 && (B.current = !0));
|
|
135
|
+
const K = { guidance: null };
|
|
136
|
+
if (Array.isArray(o.disturbanceConditions) && (K.disturbanceConditionsMet = o.disturbanceConditions.filter(($) => $.met === !0).map(($) => $.id)), o.currentPhase !== void 0 && (K.currentPhaseId = o.currentPhase || null), Array.isArray(o.branchEvaluations) && (K.branchEvaluations = o.branchEvaluations), o.resistanceFaded !== void 0 && (K.resistanceFaded = !!o.resistanceFaded), !pe || !q || !ce)
|
|
137
|
+
return U(null), K;
|
|
138
|
+
const W = {
|
|
139
|
+
severity: q,
|
|
140
|
+
message: ce,
|
|
141
|
+
suggestion: O
|
|
142
|
+
};
|
|
143
|
+
return U(W), K.guidance = W, Ge.getState().addGuidance({
|
|
144
|
+
severity: W.severity,
|
|
145
|
+
message: W.message,
|
|
146
|
+
suggestion: W.suggestion
|
|
147
|
+
}), K;
|
|
148
|
+
} catch (i) {
|
|
149
|
+
return console.error("获取实时指导失败:", i), c;
|
|
150
|
+
} finally {
|
|
151
|
+
se(!1);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
[e, s]
|
|
155
|
+
), z = j(() => {
|
|
156
|
+
U(null);
|
|
157
|
+
}, []), Y = j(() => [...X.current], []), ne = j(() => B.current, []), H = j(() => {
|
|
158
|
+
X.current = /* @__PURE__ */ new Set(), B.current = !1, x.current = null;
|
|
159
|
+
}, []), le = j((t) => {
|
|
160
|
+
x.current = t;
|
|
161
|
+
}, []), h = j(() => x.current, []);
|
|
162
|
+
return {
|
|
163
|
+
guidance: r,
|
|
164
|
+
// 当前指导信息
|
|
165
|
+
loading: R,
|
|
166
|
+
// 是否正在获取指导
|
|
167
|
+
evaluateGuidance: g,
|
|
168
|
+
// 评估并获取指导
|
|
169
|
+
clearGuidance: z,
|
|
170
|
+
// 清除指导
|
|
171
|
+
getCoveredTopics: Y,
|
|
172
|
+
// 获取 AI 已判定覆盖的话题列表
|
|
173
|
+
isConfirmed: ne,
|
|
174
|
+
// AI 角色是否已认可学生主张
|
|
175
|
+
resetCheckState: H,
|
|
176
|
+
// 重置考核检查状态(切换案例/步骤时调用)
|
|
177
|
+
setGuidanceConversationId: le,
|
|
178
|
+
// 设置会话 ID(从缓存恢复时使用)
|
|
179
|
+
getGuidanceConversationId: h
|
|
180
|
+
// 获取当前会话 ID(持久化时使用)
|
|
181
|
+
};
|
|
182
|
+
}, We = {
|
|
183
|
+
low: "约 20% 的回复中自然带出",
|
|
184
|
+
medium: "约 40% 的回复中自然带出",
|
|
185
|
+
high: "约 60% 的回复中自然带出"
|
|
186
|
+
};
|
|
187
|
+
function Xe(e) {
|
|
188
|
+
return e ? `
|
|
189
|
+
|
|
190
|
+
[扰动指令] 在本轮回复中自然引入以下状况(作为你主动抛出,不要复述本指令):${e}` : "";
|
|
191
|
+
}
|
|
192
|
+
function Ze(e) {
|
|
193
|
+
var s;
|
|
194
|
+
if (!((s = e == null ? void 0 : e.patterns) != null && s.length)) return "";
|
|
195
|
+
const b = We[e.intensity] || e.intensity;
|
|
196
|
+
return `
|
|
197
|
+
|
|
198
|
+
[沟通特征]
|
|
199
|
+
${e.patterns.map((a) => `- ${a}`).join(`
|
|
200
|
+
`)}
|
|
201
|
+
阻力强度:${b}(不要每轮都表现,${b})`;
|
|
202
|
+
}
|
|
203
|
+
function qe(e) {
|
|
204
|
+
return e ? `
|
|
205
|
+
|
|
206
|
+
[阻力衰减] 学员的表现已建立了信任,你的抵触情绪明显减弱,后续回复中不再主动表现沟通阻力。` : "";
|
|
207
|
+
}
|
|
208
|
+
function De(e) {
|
|
209
|
+
return e ? `
|
|
210
|
+
|
|
211
|
+
[分支指令] 基于学员表现,执行以下行为调整(自然融入回复,不复述本指令):${e}` : "";
|
|
212
|
+
}
|
|
213
|
+
function cn(e, b = {}) {
|
|
214
|
+
const {
|
|
215
|
+
onRealtimeData: s,
|
|
216
|
+
onMessageReceived: a,
|
|
217
|
+
buildPrompt: v,
|
|
218
|
+
enableRealtimeGuidance: N = !0,
|
|
219
|
+
runtimeRules: r,
|
|
220
|
+
dialogueGoals: U
|
|
221
|
+
} = b, R = (e == null ? void 0 : e.stepId) || "", se = (e == null ? void 0 : e.botId) || je("ACTOR_AGENT"), X = (e == null ? void 0 : e.currentUser) || { userId: "student-001", name: "学生" }, B = (e == null ? void 0 : e.tellerRoleName) || (e == null ? void 0 : e.targetPosition) || "柜员", x = (e == null ? void 0 : e.customerRoleName) || "客户", Z = (e == null ? void 0 : e.domain) || "银行", { filledData: E } = Ue(), _ = { ...(e == null ? void 0 : e.caseData) || {}, ...e || {} }, I = ae(be.getState().getDialogue(R)), [g, z] = G(() => {
|
|
222
|
+
var n, l, w, p, k;
|
|
223
|
+
return (l = (n = I.current) == null ? void 0 : n.messages) != null && l.length ? I.current.messages : [{
|
|
224
|
+
role: "customer",
|
|
225
|
+
content: ((p = (w = e == null ? void 0 : e.caseData) == null ? void 0 : w.customerInfo) == null ? void 0 : p.purpose) || ((k = e == null ? void 0 : e.customerInfo) == null ? void 0 : k.purpose) || "你好",
|
|
226
|
+
timestamp: Date.now()
|
|
227
|
+
}];
|
|
228
|
+
}), [Y, ne] = G(""), [H, le] = G(
|
|
229
|
+
() => {
|
|
230
|
+
var n;
|
|
231
|
+
return ((n = I.current) == null ? void 0 : n.dialogueLog) || [];
|
|
232
|
+
}
|
|
233
|
+
), [h, t] = G(
|
|
234
|
+
() => {
|
|
235
|
+
var n;
|
|
236
|
+
return new Set(((n = I.current) == null ? void 0 : n.firedDisturbanceIds) || []);
|
|
237
|
+
}
|
|
238
|
+
), [c, y] = G(!1), [i, f] = G(
|
|
239
|
+
() => {
|
|
240
|
+
var n;
|
|
241
|
+
return new Set(((n = I.current) == null ? void 0 : n.pendingDisturbanceIds) || []);
|
|
242
|
+
}
|
|
243
|
+
), [o, S] = G(
|
|
244
|
+
() => {
|
|
245
|
+
var n;
|
|
246
|
+
return ((n = I.current) == null ? void 0 : n.currentPhaseId) ?? null;
|
|
247
|
+
}
|
|
248
|
+
), [q, ce] = G(
|
|
249
|
+
() => {
|
|
250
|
+
var n;
|
|
251
|
+
return ((n = I.current) == null ? void 0 : n.phaseHistory) || [];
|
|
252
|
+
}
|
|
253
|
+
), [O, pe] = G(
|
|
254
|
+
() => {
|
|
255
|
+
var n;
|
|
256
|
+
return ((n = I.current) == null ? void 0 : n.branchResults) || {};
|
|
257
|
+
}
|
|
258
|
+
), [Q, K] = G(
|
|
259
|
+
() => {
|
|
260
|
+
var n;
|
|
261
|
+
return ((n = I.current) == null ? void 0 : n.resistanceFaded) || !1;
|
|
262
|
+
}
|
|
263
|
+
), [W, $] = G(null), J = ae(o);
|
|
264
|
+
me(() => {
|
|
265
|
+
J.current = o;
|
|
266
|
+
}, [o]);
|
|
267
|
+
const { callAI: Ce, ready: he, error: Be, token: He, setConversationId: ve, getConversationId: Se } = _e(se, X);
|
|
268
|
+
me(() => {
|
|
269
|
+
var n;
|
|
270
|
+
(n = I.current) != null && n.conversationId && ve(I.current.conversationId);
|
|
271
|
+
}, [ve]);
|
|
272
|
+
const {
|
|
273
|
+
evaluateGuidance: we,
|
|
274
|
+
getCoveredTopics: ke,
|
|
275
|
+
isConfirmed: Oe,
|
|
276
|
+
resetCheckState: Ae,
|
|
277
|
+
setGuidanceConversationId: Ee,
|
|
278
|
+
getGuidanceConversationId: Pe
|
|
279
|
+
} = Ke(He, {
|
|
280
|
+
domain: Z,
|
|
281
|
+
tellerRoleName: B,
|
|
282
|
+
customerRoleName: x
|
|
283
|
+
});
|
|
284
|
+
me(() => {
|
|
285
|
+
var n;
|
|
286
|
+
(n = I.current) != null && n.guidanceConversationId && Ee(I.current.guidanceConversationId);
|
|
287
|
+
}, [Ee]), me(() => {
|
|
288
|
+
R && be.getState().saveDialogue(R, {
|
|
289
|
+
messages: g,
|
|
290
|
+
dialogueLog: H,
|
|
291
|
+
conversationId: Se(),
|
|
292
|
+
guidanceConversationId: Pe(),
|
|
293
|
+
firedDisturbanceIds: Array.from(h),
|
|
294
|
+
pendingDisturbanceIds: Array.from(i),
|
|
295
|
+
currentPhaseId: o,
|
|
296
|
+
phaseHistory: q,
|
|
297
|
+
branchResults: O,
|
|
298
|
+
resistanceFaded: Q
|
|
299
|
+
});
|
|
300
|
+
}, [g, H, h, i, o, q, O, Q, R, Se, Pe]);
|
|
301
|
+
const Ne = j((n) => {
|
|
302
|
+
const { data: l } = n, w = {
|
|
303
|
+
role: "customer",
|
|
304
|
+
content: l.content,
|
|
305
|
+
timestamp: Date.now(),
|
|
306
|
+
emotion: l.emotion,
|
|
307
|
+
feedback: l.feedback,
|
|
308
|
+
talkQuality: l.talkQuality
|
|
309
|
+
};
|
|
310
|
+
if (z((p) => [...p, w]), a == null || a(w), l.talkQuality && l.feedback) {
|
|
311
|
+
const k = {
|
|
312
|
+
excellent: { type: "success", text: "优秀" },
|
|
313
|
+
good: { type: "success", text: "良好" },
|
|
314
|
+
average: { type: "info", text: "一般" },
|
|
315
|
+
poor: { type: "warning", text: "需改进" }
|
|
316
|
+
}[l.talkQuality];
|
|
317
|
+
$e.open({
|
|
318
|
+
type: k.type,
|
|
319
|
+
content: `话术质量:${k.text} - ${l.feedback}`,
|
|
320
|
+
duration: 8
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}, [a]), xe = j(async (n, l, w) => {
|
|
324
|
+
if (!he) {
|
|
325
|
+
$e.error("AI服务未就绪");
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
y(!0);
|
|
329
|
+
const p = r == null ? void 0 : r.resistance, k = p ? {
|
|
330
|
+
patterns: Array.isArray(p.patterns) ? p.patterns.map((C) => Ie(C, _, E)) : [],
|
|
331
|
+
intensity: p.intensity,
|
|
332
|
+
fadeCondition: p.fadeCondition
|
|
333
|
+
} : void 0;
|
|
334
|
+
try {
|
|
335
|
+
const C = { disturbanceEvent: l, resistance: k, resistanceFaded: Q, branchDirective: w }, D = v ? v(n, g, e, C) : en(
|
|
336
|
+
n,
|
|
337
|
+
g,
|
|
338
|
+
e,
|
|
339
|
+
B,
|
|
340
|
+
x,
|
|
341
|
+
Z,
|
|
342
|
+
_,
|
|
343
|
+
E,
|
|
344
|
+
C
|
|
345
|
+
);
|
|
346
|
+
await Ce(D, (te, ye) => {
|
|
347
|
+
var ge;
|
|
348
|
+
if (ye) {
|
|
349
|
+
const { command: ie, cleanContent: L } = ze(te, "dialogue");
|
|
350
|
+
if (ie)
|
|
351
|
+
Ne(ie);
|
|
352
|
+
else {
|
|
353
|
+
try {
|
|
354
|
+
const m = JSON.parse(L);
|
|
355
|
+
if (m && m.type) return;
|
|
356
|
+
} catch {
|
|
357
|
+
if (L.includes('"type"') && L.includes('"dialogue"')) {
|
|
358
|
+
const m = L.match(/"content"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
359
|
+
if (m) {
|
|
360
|
+
const V = L.match(/"emotion"\s*:\s*"(\w+)"/), ue = L.match(/"feedback"\s*:\s*"((?:[^"\\]|\\.)*)"/), de = L.match(/"role"\s*:\s*"(\w+)"/), oe = L.match(/"talkQuality"\s*:\s*"(\w+)"/), re = {
|
|
361
|
+
role: (de == null ? void 0 : de[1]) || "customer",
|
|
362
|
+
content: m[1].replace(/\\"/g, '"').replace(/\\n/g, `
|
|
363
|
+
`),
|
|
364
|
+
timestamp: Date.now(),
|
|
365
|
+
emotion: V == null ? void 0 : V[1],
|
|
366
|
+
feedback: (ge = ue == null ? void 0 : ue[1]) == null ? void 0 : ge.replace(/\\"/g, '"'),
|
|
367
|
+
talkQuality: oe == null ? void 0 : oe[1]
|
|
368
|
+
};
|
|
369
|
+
console.warn("⚠️ AI 返回了畸形 JSON,已通过正则容错提取对话内容"), z((ee) => [...ee, re]), a == null || a(re);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
const d = {
|
|
375
|
+
role: "customer",
|
|
376
|
+
content: L,
|
|
377
|
+
timestamp: Date.now()
|
|
378
|
+
};
|
|
379
|
+
z((m) => [...m, d]), a == null || a(d);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
} catch (C) {
|
|
384
|
+
console.error("AI调用失败:", C), $e.error("AI回复失败,请重试");
|
|
385
|
+
const D = {
|
|
386
|
+
role: "customer",
|
|
387
|
+
content: nn(n, e),
|
|
388
|
+
timestamp: Date.now()
|
|
389
|
+
};
|
|
390
|
+
z((te) => [...te, D]), a == null || a(D);
|
|
391
|
+
} finally {
|
|
392
|
+
y(!1);
|
|
393
|
+
}
|
|
394
|
+
}, [he, Ce, g, e, Ne, v, a, B, x, Z, r, Q, _, E]), Je = j(() => {
|
|
395
|
+
var ie, L;
|
|
396
|
+
if (!Y.trim()) return;
|
|
397
|
+
const n = Y, l = {
|
|
398
|
+
role: "teller",
|
|
399
|
+
content: n,
|
|
400
|
+
timestamp: Date.now()
|
|
401
|
+
};
|
|
402
|
+
z((d) => [...d, l]), le((d) => [...d, l]), s == null || s({
|
|
403
|
+
type: "dialogue",
|
|
404
|
+
message: l
|
|
405
|
+
});
|
|
406
|
+
const w = H.length + 1, p = (r == null ? void 0 : r.disturbances) || [], k = Array.from(i).filter((d) => !h.has(d));
|
|
407
|
+
k.length > 0 && (f((d) => {
|
|
408
|
+
const m = new Set(d);
|
|
409
|
+
return k.forEach((V) => m.delete(V)), m;
|
|
410
|
+
}), t((d) => {
|
|
411
|
+
const m = new Set(d);
|
|
412
|
+
return k.forEach((V) => m.add(V)), m;
|
|
413
|
+
}));
|
|
414
|
+
const C = p.filter(
|
|
415
|
+
(d) => d.trigger.type === "condition" && d.trigger.deadline != null && w >= d.trigger.deadline && !h.has(d.id) && !i.has(d.id)
|
|
416
|
+
);
|
|
417
|
+
C.length > 0 && t((d) => {
|
|
418
|
+
const m = new Set(d);
|
|
419
|
+
return C.forEach((V) => m.add(V.id)), m;
|
|
420
|
+
});
|
|
421
|
+
const D = p.find(
|
|
422
|
+
(d) => d.trigger.type === "round" && d.trigger.round === w && !h.has(d.id)
|
|
423
|
+
);
|
|
424
|
+
D && t((d) => new Set(d).add(D.id));
|
|
425
|
+
const te = D || (k.length > 0 ? p.find((d) => k.includes(d.id)) : void 0) || C[0], ye = te ? Ie(te.event, _, E) : void 0, ge = W || void 0;
|
|
426
|
+
if (W && $(null), xe(n, ye, ge), N) {
|
|
427
|
+
const d = g.slice(-4).map((u) => `${u.role === "teller" ? B : x}: ${u.content}`).join(`
|
|
428
|
+
`), m = [...g].reverse().find((u) => u.role === "customer"), V = (m == null ? void 0 : m.emotion) || "neutral", ue = (r == null ? void 0 : r.requiredTopics) || ((ie = r == null ? void 0 : r.dialogueRules) == null ? void 0 : ie.requiredTopics), de = r == null ? void 0 : r.mustConfirm, oe = p.filter(
|
|
429
|
+
(u) => u.trigger.type === "condition" && !h.has(u.id) && !i.has(u.id)
|
|
430
|
+
).map((u) => ({ id: u.id, condition: u.trigger.condition })), re = r == null ? void 0 : r.phases, ee = r == null ? void 0 : r.branchRules, fe = ee == null ? void 0 : ee.filter((u) => !(O[u.id] || u.evaluateAfterRound != null && w < u.evaluateAfterRound)).map((u) => ({ id: u.id, condition: u.condition })), Ve = Q || (L = r == null ? void 0 : r.resistance) == null ? void 0 : L.fadeCondition;
|
|
431
|
+
we({
|
|
432
|
+
tellerMessage: n,
|
|
433
|
+
customerMessage: m == null ? void 0 : m.content,
|
|
434
|
+
dialogueHistory: d,
|
|
435
|
+
customerEmotion: V,
|
|
436
|
+
modelName: e == null ? void 0 : e.modelName,
|
|
437
|
+
businessType: e == null ? void 0 : e.businessType,
|
|
438
|
+
targetPosition: e == null ? void 0 : e.targetPosition,
|
|
439
|
+
dialogueGoals: U,
|
|
440
|
+
requiredTopics: ue,
|
|
441
|
+
mustConfirm: de,
|
|
442
|
+
pendingConditionDisturbances: oe.length ? oe : void 0,
|
|
443
|
+
phases: re == null ? void 0 : re.map((u) => ({ id: u.id, name: u.name, transitionHint: u.transitionHint })),
|
|
444
|
+
branchRulesToEvaluate: fe != null && fe.length ? fe : void 0,
|
|
445
|
+
resistanceFadeCondition: Ve
|
|
446
|
+
}).then((u) => {
|
|
447
|
+
var Te, Fe;
|
|
448
|
+
if (u) {
|
|
449
|
+
if ((Te = u.disturbanceConditionsMet) != null && Te.length && f((T) => {
|
|
450
|
+
const M = new Set(T);
|
|
451
|
+
return u.disturbanceConditionsMet.forEach((F) => {
|
|
452
|
+
h.has(F) || M.add(F);
|
|
453
|
+
}), M;
|
|
454
|
+
}), u.currentPhaseId !== void 0 && u.currentPhaseId !== null) {
|
|
455
|
+
const T = u.currentPhaseId, M = J.current;
|
|
456
|
+
if (T !== M) {
|
|
457
|
+
S(T), ce((P) => P.includes(T) ? P : [...P, T]);
|
|
458
|
+
const F = p.find(
|
|
459
|
+
(P) => P.trigger.type === "phase" && P.trigger.phaseId === T && P.trigger.timing === "enter" && !h.has(P.id)
|
|
460
|
+
);
|
|
461
|
+
if (F && f((P) => new Set(P).add(F.id)), M) {
|
|
462
|
+
const P = p.find(
|
|
463
|
+
(A) => A.trigger.type === "phase" && A.trigger.phaseId === M && A.trigger.timing === "exit" && !h.has(A.id)
|
|
464
|
+
);
|
|
465
|
+
P && f((A) => new Set(A).add(P.id));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
(Fe = u.branchEvaluations) != null && Fe.length && u.branchEvaluations.forEach((T) => {
|
|
470
|
+
if (T.confidence < 0.6 || O[T.id]) return;
|
|
471
|
+
const M = ee == null ? void 0 : ee.find((A) => A.id === T.id);
|
|
472
|
+
if (!M) return;
|
|
473
|
+
const F = T.met ? M.outcomes.positive : M.outcomes.negative, P = T.met ? "positive" : "negative";
|
|
474
|
+
pe((A) => ({ ...A, [T.id]: P })), F.directive && $(F.directive), F.triggerDisturbance && f((A) => new Set(A).add(F.triggerDisturbance)), F.unlockPhase && (S(F.unlockPhase), ce((A) => A.includes(F.unlockPhase) ? A : [...A, F.unlockPhase]));
|
|
475
|
+
}), u.resistanceFaded === !0 && K(!0);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
ne("");
|
|
480
|
+
}, [Y, g, H, r, h, i, W, O, Q, _, E, s, N, we, xe, B, x, U, e]), Le = j((n) => {
|
|
481
|
+
var l;
|
|
482
|
+
if (!n) return { canComplete: !0 };
|
|
483
|
+
if (n.minRounds && H.length < n.minRounds)
|
|
484
|
+
return { canComplete: !1, reason: `至少需要 ${n.minRounds} 轮对话` };
|
|
485
|
+
if (((l = n.requiredTopics) == null ? void 0 : l.length) > 0) {
|
|
486
|
+
const w = g.filter((C) => C.role === "teller").map((C) => C.content).join(" "), p = new Set(ke()), k = n.requiredTopics.filter(
|
|
487
|
+
(C) => !w.includes(C) && !p.has(C)
|
|
488
|
+
);
|
|
489
|
+
if (k.length > 0)
|
|
490
|
+
return { canComplete: !1, reason: `还需涉及:${k.join("、")}` };
|
|
491
|
+
}
|
|
492
|
+
return { canComplete: !0 };
|
|
493
|
+
}, [H, g, ke]), Re = j(() => {
|
|
494
|
+
const n = r == null ? void 0 : r.branchRules;
|
|
495
|
+
return !(n != null && n.length) || !Object.keys(O).length ? [] : n.filter((l) => O[l.id]).map((l) => {
|
|
496
|
+
const w = O[l.id], p = w === "positive" ? l.outcomes.positive : l.outcomes.negative;
|
|
497
|
+
return `分支「${l.condition.slice(0, 20)}…」→ ${w === "positive" ? "✅ 正向" : "❌ 负向"}:${p.directive}`;
|
|
498
|
+
});
|
|
499
|
+
}, [r, O]), Qe = j(() => {
|
|
500
|
+
R && be.getState().clearStep(R), Ae();
|
|
501
|
+
}, [R, Ae]);
|
|
502
|
+
return {
|
|
503
|
+
messages: g,
|
|
504
|
+
input: Y,
|
|
505
|
+
dialogueLog: H,
|
|
506
|
+
aiResponding: c,
|
|
507
|
+
aiError: Be,
|
|
508
|
+
ready: he,
|
|
509
|
+
setInput: ne,
|
|
510
|
+
handleSend: Je,
|
|
511
|
+
checkCompletion: Le,
|
|
512
|
+
isConfirmed: Oe,
|
|
513
|
+
cleanup: Qe,
|
|
514
|
+
// V2
|
|
515
|
+
currentPhaseId: o,
|
|
516
|
+
phaseHistory: q,
|
|
517
|
+
branchResults: O,
|
|
518
|
+
phases: r == null ? void 0 : r.phases,
|
|
519
|
+
getBranchResultsSummary: Re
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function en(e, b, s, a = "柜员", v = "客户", N = "银行", r, U, R) {
|
|
523
|
+
const { disturbanceEvent: se, resistance: X, resistanceFaded: B, branchDirective: x } = R || {}, Z = (s == null ? void 0 : s.roleConfig) || {}, E = s == null ? void 0 : s.caseData, _ = (s == null ? void 0 : s.scenario) || `${N}业务办理`, I = Ie(_, r || E, U), g = (E == null ? void 0 : E.customerInfo) || (s == null ? void 0 : s.customerInfo) || {}, z = (E == null ? void 0 : E.businessData) || (s == null ? void 0 : s.businessData) || {}, Y = Xe(se), ne = De(x), H = qe(B);
|
|
524
|
+
if (!b.some((h) => h.role === "teller")) {
|
|
525
|
+
const h = [], t = (g == null ? void 0 : g.name) || (g == null ? void 0 : g.姓名) || (g == null ? void 0 : g.customerName);
|
|
526
|
+
t && h.push(`姓名:${t}`), Object.entries(Z).forEach(([y, i]) => {
|
|
527
|
+
if (y === "角色编号") return;
|
|
528
|
+
let f;
|
|
529
|
+
Array.isArray(i) ? f = i.join("、") : typeof i == "object" && i !== null ? f = JSON.stringify(i, null, 2) : f = String(i || ""), f && h.push(`${y}:${f}`);
|
|
530
|
+
});
|
|
531
|
+
const c = Ze(X);
|
|
532
|
+
return `
|
|
533
|
+
【场景信息】
|
|
534
|
+
场景:${I}
|
|
535
|
+
|
|
536
|
+
【角色设定】
|
|
537
|
+
你扮演的角色信息如下${t ? `,你的名字是"${t}"` : ""}:
|
|
538
|
+
${h.length > 0 ? h.join(`
|
|
539
|
+
`) : "(无特殊设定)"}${c}
|
|
540
|
+
|
|
541
|
+
【客户信息】
|
|
542
|
+
${JSON.stringify(g, null, 2)}
|
|
543
|
+
|
|
544
|
+
【业务数据】
|
|
545
|
+
${JSON.stringify(z, null, 2)}
|
|
546
|
+
|
|
547
|
+
【对话要求】
|
|
548
|
+
请以JSON格式返回你的回复,格式如下:
|
|
549
|
+
{
|
|
550
|
+
"type": "dialogue",
|
|
551
|
+
"data": {
|
|
552
|
+
"role": "customer",
|
|
553
|
+
"content": "你的回复内容",
|
|
554
|
+
"emotion": "neutral",
|
|
555
|
+
"talkQuality": "good",
|
|
556
|
+
"feedback": "对${a}话术的简短评价(可选)"
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
${a}: ${e}${Y}${ne}${H}
|
|
561
|
+
`.trim();
|
|
562
|
+
}
|
|
563
|
+
return `${a}: ${e}${Y}${ne}${H}`;
|
|
564
|
+
}
|
|
565
|
+
function nn(e, b) {
|
|
566
|
+
var a, v, N;
|
|
567
|
+
const s = e.toLowerCase();
|
|
568
|
+
return s.includes("您好") || s.includes("你好") ? "你好!" : s.includes("办理") || s.includes("业务") ? ((v = (a = b == null ? void 0 : b.caseData) == null ? void 0 : a.customerInfo) == null ? void 0 : v.purpose) || ((N = b == null ? void 0 : b.customerInfo) == null ? void 0 : N.purpose) || "我想开个储蓄账户" : s.includes("材料") || s.includes("证件") ? "我带了身份证,还需要什么吗?" : s.includes("开户") || s.includes("账户") ? "开储蓄账户需要多少钱?有什么要求吗?" : s.includes("费用") || s.includes("手续费") ? "好的,我明白了。" : "好的,谢谢!";
|
|
569
|
+
}
|
|
570
|
+
export {
|
|
571
|
+
De as a,
|
|
572
|
+
Xe as b,
|
|
573
|
+
qe as c,
|
|
574
|
+
Ze as d,
|
|
575
|
+
cn as u
|
|
576
|
+
};
|