feat:智能体创建
This commit is contained in:
@@ -2,7 +2,10 @@ package com.xiang.xsa.xservice.ai.server;
|
||||
|
||||
import com.xiang.xservice.ai.agent.BaseAgent;
|
||||
import com.xiang.xservice.ai.core.enums.ModelTypeEnum;
|
||||
import com.xiang.xservice.ai.pojo.enums.AgentEnums;
|
||||
import com.xiang.xservice.ai.service.AgentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -11,11 +14,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequiredArgsConstructor
|
||||
public class ChatController {
|
||||
|
||||
private final BaseAgent baseAgent;
|
||||
private final AgentService agentService;
|
||||
|
||||
@GetMapping("/chat")
|
||||
public String chatDemo(@RequestParam("question") String question, @RequestParam("memoryId") Long memoryId, @RequestParam("userId") Long userId) {
|
||||
baseAgent.chat(ModelTypeEnum.OPEN_AI, memoryId, userId, question);
|
||||
BaseAgent agent = agentService.createAgent(AgentEnums.SIMPLE_CHAT_AGENT);
|
||||
agent.chat(ModelTypeEnum.OPEN_AI, memoryId, userId, question);
|
||||
return "321";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user