249 lines
9.8 KiB
TypeScript
249 lines
9.8 KiB
TypeScript
|
|
import { Assistant, CallLog, KnowledgeBase, Voice, Workflow, AutoTestAssistant, TestType, TestMethod, Tool, LLMModel, ASRModel } from '../types';
|
|
|
|
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 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: 'v3',
|
|
speed: 1.0,
|
|
hotwords: ['refund', 'order'],
|
|
interruptionSensitivity: 500,
|
|
embeddingModelId: 'm3',
|
|
},
|
|
{
|
|
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: 'v1',
|
|
speed: 1.1,
|
|
hotwords: ['price', 'discount'],
|
|
interruptionSensitivity: 300,
|
|
},
|
|
];
|
|
|
|
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',
|
|
type: 'video',
|
|
details: [
|
|
{ role: 'user', content: 'Can you see this product?', imageUrls: ['https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=150&h=150&fit=crop'], timestamp: '10:30:05' },
|
|
{ role: 'assistant', content: 'Yes, I can see the white watch. It looks like a minimalist design.', timestamp: '10:30:08' },
|
|
{ role: 'user', content: 'How much is it?', imageUrls: [], timestamp: '10:30:15' },
|
|
{ role: 'assistant', content: 'Based on the database, this model retails for $199.', timestamp: '10:30:18' }
|
|
]
|
|
},
|
|
{
|
|
id: 'c2',
|
|
source: 'debug',
|
|
status: 'connected',
|
|
startTime: '2023-11-20 11:15:00',
|
|
duration: '1m 10s',
|
|
agentName: 'Sales Agent',
|
|
type: 'audio',
|
|
details: [
|
|
{ role: 'user', content: 'I am interested in the premium plan.', timestamp: '11:15:02' },
|
|
{ role: 'assistant', content: 'That is a great choice. The premium plan includes...', timestamp: '11:15:05' }
|
|
]
|
|
},
|
|
{
|
|
id: 'c3',
|
|
source: 'external',
|
|
status: 'missed',
|
|
startTime: '2023-11-20 12:00:00',
|
|
duration: '0s',
|
|
agentName: 'Customer Support Bot',
|
|
type: 'text',
|
|
details: []
|
|
},
|
|
{
|
|
id: 'c4',
|
|
source: 'debug',
|
|
status: 'connected',
|
|
startTime: '2023-11-21 09:30:00',
|
|
duration: '45s',
|
|
agentName: 'Refund Bot',
|
|
type: 'text',
|
|
details: [
|
|
{ role: 'user', content: '我想申请退款', timestamp: '09:30:01' },
|
|
{ role: 'assistant', content: '好的,请提供您的订单号。', timestamp: '09:30:02' },
|
|
{ role: 'user', content: 'ORDER-2024-888', timestamp: '09:30:10' },
|
|
{ role: 'assistant', content: '收到,正在为您处理...', timestamp: '09:30:12' }
|
|
]
|
|
}
|
|
];
|
|
|
|
export const mockAutoTestAssistants: AutoTestAssistant[] = [
|
|
{
|
|
id: 'at1',
|
|
name: '退款流程压力测试',
|
|
type: TestType.FIXED,
|
|
method: TestMethod.TEXT,
|
|
targetAssistantId: '1',
|
|
fixedWorkflowSteps: ['你好,我要退款', '订单号是123456', '谢谢'],
|
|
intelligentPrompt: '',
|
|
createdAt: '2024-03-10 09:00'
|
|
},
|
|
{
|
|
id: 'at2',
|
|
name: '愤怒的客户模拟',
|
|
type: TestType.INTELLIGENT,
|
|
method: TestMethod.AUDIO,
|
|
targetAssistantId: '1',
|
|
fixedWorkflowSteps: [],
|
|
intelligentPrompt: '你是一个非常愤怒的客户,因为订单延迟了一周。你需要表达你的不满,并要求立即解决。你的语气必须很冲,不接受简单的道歉。',
|
|
createdAt: '2024-03-11 14:20'
|
|
}
|
|
];
|
|
|
|
export const mockTools: Tool[] = [
|
|
{ id: 'cam_open', name: '打开相机', description: '允许 AI 开启摄像头流', category: 'system', icon: 'Camera' },
|
|
{ id: 'cam_close', name: '关闭相机', description: '允许 AI 停止摄像头流', category: 'system', icon: 'CameraOff' },
|
|
{ id: 'take_photo', name: '拍照', description: 'AI 触发单张拍摄', category: 'system', icon: 'Image' },
|
|
{ id: 'burst_3', name: '连拍三张', description: 'AI 触发快速连拍', category: 'system', icon: 'Images' },
|
|
{ id: 'q_weather', name: '天气查询', description: '查询实时及未来天气', category: 'query', icon: 'CloudSun' },
|
|
{ id: 'q_calendar', name: '日历查询', description: '查询日程及节假日信息', category: 'query', icon: 'Calendar' },
|
|
{ id: 'q_stock', name: '股价查询', description: '查询股票实时行情', category: 'query', icon: 'TrendingUp' },
|
|
{ id: 'q_exchange', name: '汇率查询', description: '查询多国货币汇率', category: 'query', icon: 'Coins' },
|
|
{ id: 'custom_1', name: '智能家居控制', description: '控制灯光、窗帘等设备', category: 'system', icon: 'Terminal', isCustom: true },
|
|
];
|
|
|
|
export const mockLLMModels: LLMModel[] = [
|
|
{ id: 'm1', name: 'GPT-4o', vendor: 'OpenAI Compatible', type: 'text', baseUrl: 'https://api.openai.com/v1', apiKey: 'sk-***', temperature: 0.7 },
|
|
{ id: 'm2', name: 'DeepSeek-V3', vendor: 'OpenAI Compatible', type: 'text', baseUrl: 'https://api.deepseek.com', apiKey: 'sk-***', temperature: 0.5 },
|
|
{ id: 'm3', name: 'text-embedding-3-small', vendor: 'OpenAI Compatible', type: 'embedding', baseUrl: 'https://api.openai.com/v1', apiKey: 'sk-***' },
|
|
{ id: 'm4', name: 'bge-reranker-v2-m3', vendor: 'SiliconFlow', type: 'rerank', baseUrl: 'https://api.siliconflow.cn/v1', apiKey: 'sk-***' },
|
|
];
|
|
|
|
export const mockASRModels: ASRModel[] = [
|
|
{ id: 'asr1', name: 'Whisper-1', vendor: 'OpenAI Compatible', language: 'Multi-lingual', baseUrl: 'https://api.openai.com/v1', apiKey: 'sk-***' },
|
|
{ id: 'asr2', name: 'SenseVoiceSmall', vendor: 'OpenAI Compatible', language: 'zh', baseUrl: 'https://api.siliconflow.cn/v1', apiKey: 'sk-***' },
|
|
];
|
|
|
|
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
|
|
};
|
|
};
|