mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
(improvement)(chat) Provide agent tool type list (#683)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -1,8 +1,25 @@
|
||||
package com.tencent.supersonic.chat.core.agent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum AgentToolType {
|
||||
NL2SQL_RULE,
|
||||
NL2SQL_LLM,
|
||||
PLUGIN,
|
||||
ANALYTICS
|
||||
NL2SQL_RULE("基于规则Text-to-SQL"),
|
||||
NL2SQL_LLM("基于大模型Text-to-SQL"),
|
||||
PLUGIN("第三方插件");
|
||||
|
||||
private String title;
|
||||
|
||||
AgentToolType(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public static Map<AgentToolType, String> getToolTypes() {
|
||||
Map<AgentToolType, String> map = new HashMap<>();
|
||||
map.put(NL2SQL_RULE, NL2SQL_RULE.title);
|
||||
map.put(NL2SQL_LLM, NL2SQL_LLM.title);
|
||||
map.put(PLUGIN, PLUGIN.title);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.tencent.supersonic.chat.server.rest;
|
||||
import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.auth.api.authentication.utils.UserHolder;
|
||||
import com.tencent.supersonic.chat.core.agent.Agent;
|
||||
import com.tencent.supersonic.chat.core.agent.AgentToolType;
|
||||
import com.tencent.supersonic.chat.server.service.AgentService;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -14,6 +12,10 @@ import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/api/chat/agent", "/openapi/chat/agent"})
|
||||
@@ -54,4 +56,9 @@ public class AgentController {
|
||||
return agentService.getAgents();
|
||||
}
|
||||
|
||||
@RequestMapping("/getToolTypes")
|
||||
public Map<AgentToolType, String> getToolTypes() {
|
||||
return AgentToolType.getToolTypes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user