新增智能体
This commit is contained in:
@@ -66,6 +66,7 @@ public class AiInit {
|
||||
@Bean
|
||||
public CommandLineRunner agentInitRunner(){
|
||||
return args -> {
|
||||
String chatAgentApiKey = sysConfigService.getStringConfig("dify.workcase.agent.chat");
|
||||
logger.info("开始初始化客服系统智能体...");
|
||||
TbAgent agent = new TbAgent();
|
||||
agent.setIsOuter(true);
|
||||
@@ -73,17 +74,35 @@ public class AiInit {
|
||||
ResultDomain<TbAgent> listDomain = agentService.getAgentList(agent);
|
||||
if (listDomain.getSuccess()&&!listDomain.getDataList().isEmpty()) {
|
||||
logger.info("泰豪小电智能体已经存在");
|
||||
return;
|
||||
}
|
||||
agent.setApiKey("app-CDKy0wYkPnl6dA6G7eu113Vw");
|
||||
agent.setIntroduce("您好,我是泰豪小电智能客服。请描述您的问题,我会尽力协助。");
|
||||
agent.setCategory("客服智能体");
|
||||
agent.setCategory("user_admin");
|
||||
ResultDomain<TbAgent> resultDomain = agentService.addAgent(agent);
|
||||
if(resultDomain.getSuccess()){
|
||||
logger.info("泰豪小电智能体初始化成功");
|
||||
}else{
|
||||
logger.error("泰豪小电智能体初始化失败"+resultDomain.getMessage());
|
||||
agent.setApiKey(chatAgentApiKey);
|
||||
agent.setIntroduce("您好,我是泰豪小电智能客服。请描述您的问题,我会尽力协助。");
|
||||
agent.setCategory("客服智能体");
|
||||
ResultDomain<TbAgent> resultDomain = agentService.addAgent(agent);
|
||||
if(resultDomain.getSuccess()){
|
||||
logger.info("泰豪小电智能体初始化成功");
|
||||
}else{
|
||||
logger.error("泰豪小电智能体初始化失败"+resultDomain.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
String summaryAgentApiKey = sysConfigService.getStringConfig("dify.workcase.agent.summary");
|
||||
TbAgent summaryAgent = new TbAgent();
|
||||
summaryAgent.setIsOuter(true);
|
||||
summaryAgent.setName("工单总结");
|
||||
ResultDomain<TbAgent> listDomain2 = agentService.getAgentList(summaryAgent);
|
||||
if (listDomain2.getSuccess()&&!listDomain2.getDataList().isEmpty()) {
|
||||
logger.info("工单总结智能体已经存在");
|
||||
}else {
|
||||
summaryAgent.setApiKey(summaryAgentApiKey);
|
||||
summaryAgent.setIntroduce("工单总结工作流");
|
||||
summaryAgent.setCategory("工作流");
|
||||
ResultDomain<TbAgent> resultDomain2 = agentService.addAgent(summaryAgent);
|
||||
if(resultDomain2.getSuccess()){
|
||||
logger.info("泰豪小电智能体初始化成功");
|
||||
}else{
|
||||
logger.error("泰豪小电智能体初始化失败"+resultDomain2.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user