Update workflow

This commit is contained in:
Xin Wang
2026-02-02 10:10:24 +08:00
parent ae391a8aa7
commit 75914cf2e6
7 changed files with 1017 additions and 282 deletions

View File

@@ -1,5 +1,5 @@
import { Assistant, CallLog, KnowledgeBase, Voice } from '../types';
import { Assistant, CallLog, KnowledgeBase, Voice, Workflow } from '../types';
export const mockAssistants: Assistant[] = [
{
@@ -28,6 +28,50 @@ export const mockAssistants: Assistant[] = [
},
];
export let mockWorkflows: Workflow[] = [
{
id: 'wf1',
name: 'Lead Qualification Agent',
nodeCount: 11,
createdAt: '2024-03-01 10:00',
updatedAt: '2024-03-05 14:30',
nodes: [
{
name: "introduction",
type: "conversation",
isStart: true,
metadata: { position: { x: 100, y: 100 } },
prompt: "You are Morgan from GrowthPartners. Start with: 'Hello, this is Morgan from GrowthPartners. We help businesses improve their operational efficiency through custom software solutions. Do you have a few minutes to chat about how we might be able to help your business?' Use a friendly, consultative tone.",
messagePlan: { firstMessage: "Hello, this is Morgan from GrowthPartners. Do you have a few minutes to chat about how we might be able to help your business?" }
},
{
name: "need_discovery",
type: "conversation",
metadata: { position: { x: 400, y: 150 } },
prompt: "Conduct need discovery by asking about: 1) Their business and industry, 2) Current systems/processes they use, 3) Biggest challenges with current approach...",
variableExtractionPlan: {
output: [
{ type: "string", title: "industry", description: "the user's industry or business type" },
{ type: "string", title: "company_size", description: "approximate number of employees" }
]
}
}
],
edges: [
{ from: "introduction", to: "need_discovery" }
]
},
{
id: 'wf2',
name: '售后退款流程',
nodeCount: 5,
createdAt: '2024-03-01 10:00',
updatedAt: '2024-03-05 14:30',
nodes: [],
edges: []
},
];
export const mockKnowledgeBases: KnowledgeBase[] = [
{
id: 'kb1',
@@ -85,8 +129,6 @@ export const mockVoices: Voice[] = [
{ id: 'v5', name: 'Doubao', vendor: 'Volcano', gender: 'Female', language: 'zh', description: 'Cute and young.' },
];
// --- Dashboard Mock Data Helpers ---
export interface DashboardStats {
totalCalls: number;
answerRate: number;
@@ -96,14 +138,11 @@ export interface DashboardStats {
}
export const getDashboardStats = (timeRange: 'week' | 'month' | 'year', assistantId: string): DashboardStats => {
// Simulate data variation based on inputs
const multiplier = assistantId === 'all' ? 1 : (assistantId === '1' ? 0.6 : 0.4);
const rangeMultiplier = timeRange === 'week' ? 1 : (timeRange === 'month' ? 4 : 52);
const baseCalls = Math.floor(100 * rangeMultiplier * multiplier);
const transfers = Math.floor(baseCalls * 0.15); // 15% transfer rate
const transfers = Math.floor(baseCalls * 0.15);
// Generate Trend Data
let points = 7;
if (timeRange === 'month') points = 30;
if (timeRange === 'year') points = 12;
@@ -122,7 +161,7 @@ export const getDashboardStats = (timeRange: 'week' | 'month' | 'year', assistan
return {
totalCalls: baseCalls,
answerRate: 85 + Math.floor(Math.random() * 10), // 85-95%
answerRate: 85 + Math.floor(Math.random() * 10),
avgDuration: `${Math.floor(2 + Math.random() * 3)}m ${Math.floor(Math.random() * 60)}s`,
humanTransferCount: transfers,
trend