170 lines
5.4 KiB
TypeScript
170 lines
5.4 KiB
TypeScript
|
|
import { Assistant, CallLog, KnowledgeBase, Voice, Workflow } from '../types';
|
|
|
|
export const mockAssistants: Assistant[] = [
|
|
{
|
|
id: '1',
|
|
name: 'Customer Support Bot',
|
|
callCount: 154,
|
|
opener: 'Hello, how can I help you today?',
|
|
prompt: 'You are a helpful customer service agent.',
|
|
knowledgeBaseId: 'kb1',
|
|
language: 'en',
|
|
voice: 'alloy',
|
|
speed: 1.0,
|
|
hotwords: ['refund', 'order'],
|
|
},
|
|
{
|
|
id: '2',
|
|
name: 'Sales Agent',
|
|
callCount: 89,
|
|
opener: 'Hi! Are you interested in our new product?',
|
|
prompt: 'You are an energetic sales representative.',
|
|
knowledgeBaseId: 'kb2',
|
|
language: 'zh',
|
|
voice: 'echo',
|
|
speed: 1.1,
|
|
hotwords: ['price', 'discount'],
|
|
},
|
|
];
|
|
|
|
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',
|
|
name: 'Product Manuals',
|
|
creator: 'Admin',
|
|
createdAt: '2023-10-15',
|
|
documents: [
|
|
{ id: 'd1', name: 'User Guide v1.pdf', size: '2.4 MB', uploadDate: '2023-10-15' },
|
|
{ id: 'd2', name: 'Warranty Info.docx', size: '1.1 MB', uploadDate: '2023-10-16' },
|
|
],
|
|
},
|
|
{
|
|
id: 'kb2',
|
|
name: 'Sales Scripts',
|
|
creator: 'Sales Lead',
|
|
createdAt: '2023-11-01',
|
|
documents: [
|
|
{ id: 'd3', name: 'Objection Handling.pdf', size: '500 KB', uploadDate: '2023-11-01' },
|
|
],
|
|
},
|
|
];
|
|
|
|
export const mockCallLogs: CallLog[] = [
|
|
{
|
|
id: 'c1',
|
|
source: 'external',
|
|
status: 'connected',
|
|
startTime: '2023-11-20 10:30:00',
|
|
duration: '5m 23s',
|
|
agentName: 'Customer Support Bot',
|
|
},
|
|
{
|
|
id: 'c2',
|
|
source: 'debug',
|
|
status: 'connected',
|
|
startTime: '2023-11-20 11:15:00',
|
|
duration: '1m 10s',
|
|
agentName: 'Sales Agent',
|
|
},
|
|
{
|
|
id: 'c3',
|
|
source: 'external',
|
|
status: 'missed',
|
|
startTime: '2023-11-20 12:00:00',
|
|
duration: '0s',
|
|
agentName: 'Customer Support Bot',
|
|
},
|
|
];
|
|
|
|
export const mockVoices: Voice[] = [
|
|
{ id: 'v1', name: 'Xiaoyun', vendor: 'Ali', gender: 'Female', language: 'zh', description: 'Gentle and professional.' },
|
|
{ id: 'v2', name: 'Kevin', vendor: 'Volcano', gender: 'Male', language: 'en', description: 'Deep and authoritative.' },
|
|
{ id: 'v3', name: 'Abby', vendor: 'Minimax', gender: 'Female', language: 'en', description: 'Cheerful and lively.' },
|
|
{ id: 'v4', name: 'Guang', vendor: 'Ali', gender: 'Male', language: 'zh', description: 'Standard newscast style.' },
|
|
{ id: 'v5', name: 'Doubao', vendor: 'Volcano', gender: 'Female', language: 'zh', description: 'Cute and young.' },
|
|
];
|
|
|
|
export interface DashboardStats {
|
|
totalCalls: number;
|
|
answerRate: number;
|
|
avgDuration: string;
|
|
humanTransferCount: number;
|
|
trend: { label: string; value: number }[];
|
|
}
|
|
|
|
export const getDashboardStats = (timeRange: 'week' | 'month' | 'year', assistantId: string): DashboardStats => {
|
|
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);
|
|
|
|
let points = 7;
|
|
if (timeRange === 'month') points = 30;
|
|
if (timeRange === 'year') points = 12;
|
|
|
|
const trend = Array.from({ length: points }, (_, i) => {
|
|
let label = `Day ${i + 1}`;
|
|
if (timeRange === 'year') {
|
|
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
label = months[i];
|
|
}
|
|
return {
|
|
label,
|
|
value: Math.floor(Math.random() * 50 * multiplier) + 10
|
|
};
|
|
});
|
|
|
|
return {
|
|
totalCalls: baseCalls,
|
|
answerRate: 85 + Math.floor(Math.random() * 10),
|
|
avgDuration: `${Math.floor(2 + Math.random() * 3)}m ${Math.floor(Math.random() * 60)}s`,
|
|
humanTransferCount: transfers,
|
|
trend
|
|
};
|
|
};
|