MCPcopy Create free account
hub / github.com/echoVic/blade-code / startCustomerService

Function startCustomerService

src/commands/agent-llm.ts:598–630  ·  view source on GitHub ↗

* 启动智能客服

(config: AgentConfig)

Source from the content-addressed store, hash-verified

596 * 启动智能客服
597 */
598async function startCustomerService(config: AgentConfig) {
599 console.log(chalk.cyan('\n=== 🎧 智能客服 Agent ==='));
600
601 const agent = new Agent(config);
602 await agent.init();
603
604 const scenarios = [
605 '我想了解你们的退货政策',
606 '这个产品质量太差了,我要求退款!',
607 '请问你们有什么优惠活动吗?',
608 ];
609
610 for (const inquiry of scenarios) {
611 console.log(chalk.yellow(`\n客户: ${inquiry}`));
612
613 try {
614 const systemPrompt = '你是专业的客服代表,友好耐心地解答问题';
615 const response = await agent.chatWithSystem(systemPrompt, inquiry);
616 console.log(chalk.green(`客服: ${response}`));
617
618 if (inquiry.includes('质量太差')) {
619 console.log(chalk.gray('\n分析客户情绪...'));
620 const sentiment = await agent.analyzeSentiment(inquiry);
621 console.log(chalk.blue(`情绪分析: ${sentiment}`));
622 }
623 } catch (error) {
624 console.error(chalk.red('❌ 处理失败:'), error);
625 }
626 }
627
628 await agent.destroy();
629 console.log(chalk.green('\n✅ 客服演示完成'));
630}
631
632/**
633 * 启动代码助手

Callers 1

runScenarioDemoFunction · 0.85

Calls 6

initMethod · 0.95
chatWithSystemMethod · 0.95
analyzeSentimentMethod · 0.95
destroyMethod · 0.95
logMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected