Browse Source

新增智能体、工具表

lamphua 2 weeks ago
parent
commit
dca7fce1df
23 changed files with 1128 additions and 26 deletions
  1. 1
    1
      llm-back/ruoyi-admin/src/main/resources/banner.txt
  2. 11
    0
      llm-back/ruoyi-agent/src/main/java/com/ruoyi/agent/service/impl/McpServiceImpl.java
  3. 97
    0
      llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcAgentController.java
  4. 97
    0
      llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcAgentToolController.java
  5. 1
    1
      llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcChatController.java
  6. 1
    1
      llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcDocumentController.java
  7. 1
    1
      llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcTopicController.java
  8. 38
    3
      llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/McpController.java
  9. 2
    2
      llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/service/impl/LangChainMilvusServiceImpl.java
  10. 81
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/domain/CmcAgent.java
  11. 79
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/domain/CmcAgentTool.java
  12. 61
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/mapper/CmcAgentMapper.java
  13. 61
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/mapper/CmcAgentToolMapper.java
  14. 61
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/ICmcAgentService.java
  15. 61
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/ICmcAgentToolService.java
  16. 95
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/impl/CmcAgentServiceImpl.java
  17. 93
    0
      llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/impl/CmcAgentToolServiceImpl.java
  18. 74
    0
      llm-back/ruoyi-system/src/main/resources/mapper/llm/CmcAgentMapper.xml
  19. 68
    0
      llm-back/ruoyi-system/src/main/resources/mapper/llm/CmcAgentToolMapper.xml
  20. 40
    17
      llm-back/sql/cmc_llm.sql
  21. 50
    0
      llm-ui/src/api/llm/agent.js
  22. 44
    0
      llm-ui/src/api/llm/tool.js
  23. 11
    0
      llm-ui/src/views/llm/agent/index.vue

+ 1
- 1
llm-back/ruoyi-admin/src/main/resources/banner.txt View File

@@ -1,2 +1,2 @@
1
-Application Version: ${ruoyi.version}
1
+Application Version: ${cmc.version}
2 2
 Spring Boot Version: ${spring-boot.version}

+ 11
- 0
llm-back/ruoyi-agent/src/main/java/com/ruoyi/agent/service/impl/McpServiceImpl.java View File

@@ -37,6 +37,17 @@ public class McpServiceImpl implements IMcpService {
37 37
         }
38 38
     }
39 39
 
40
+    @ToolMapping(description = "编制技术方案")
41
+    public String openDocument(@Param(description = "招标文件") String inviteDocument, @Param(description = "投标文件") String submitDocument) throws IOException {
42
+        try (XWPFDocument doc = new XWPFDocument(new FileInputStream(inviteDocument))) {
43
+            StringBuilder content = new StringBuilder();
44
+            for (XWPFParagraph paragraph : doc.getParagraphs()) {
45
+                content.append(paragraph.getText()).append("\n");
46
+            }
47
+            return content.toString();
48
+        }
49
+    }
50
+
40 51
     @ToolMapping(description = "补全技术方案")
41 52
     public String writeTechnicalPlan(@Param(description = "文件路径") String document, @Param(description = "技术方案内容") String resultContent) throws IOException {
42 53
         // 创建临时输出文件路径

+ 97
- 0
llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcAgentController.java View File

@@ -0,0 +1,97 @@
1
+package com.ruoyi.web.llm.controller;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.web.bind.annotation.GetMapping;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.PutMapping;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.ruoyi.common.annotation.Log;
15
+import com.ruoyi.common.core.controller.BaseController;
16
+import com.ruoyi.common.core.domain.AjaxResult;
17
+import com.ruoyi.common.enums.BusinessType;
18
+import com.ruoyi.llm.domain.CmcAgent;
19
+import com.ruoyi.llm.service.ICmcAgentService;
20
+import com.ruoyi.common.utils.poi.ExcelUtil;
21
+import com.ruoyi.common.core.page.TableDataInfo;
22
+
23
+/**
24
+ * 智能体Controller
25
+ * 
26
+ * @author ruoyi
27
+ * @date 2025-07-17
28
+ */
29
+@RestController
30
+@RequestMapping("/llm/agent")
31
+public class CmcAgentController extends BaseController
32
+{
33
+    @Autowired
34
+    private ICmcAgentService cmcAgentService;
35
+
36
+    /**
37
+     * 查询智能体列表
38
+     */
39
+    @GetMapping("/list")
40
+    public TableDataInfo list(CmcAgent cmcAgent)
41
+    {
42
+        startPage();
43
+        List<CmcAgent> list = cmcAgentService.selectCmcAgentList(cmcAgent);
44
+        return getDataTable(list);
45
+    }
46
+
47
+    /**
48
+     * 导出智能体列表
49
+     */
50
+    @Log(title = "智能体", businessType = BusinessType.EXPORT)
51
+    @PostMapping("/export")
52
+    public void export(HttpServletResponse response, CmcAgent cmcAgent)
53
+    {
54
+        List<CmcAgent> list = cmcAgentService.selectCmcAgentList(cmcAgent);
55
+        ExcelUtil<CmcAgent> util = new ExcelUtil<CmcAgent>(CmcAgent.class);
56
+        util.exportExcel(response, list, "智能体数据");
57
+    }
58
+
59
+    /**
60
+     * 获取智能体详细信息
61
+     */
62
+    @GetMapping(value = "/{agentId}")
63
+    public AjaxResult getInfo(@PathVariable("agentId") Integer agentId)
64
+    {
65
+        return success(cmcAgentService.selectCmcAgentByAgentId(agentId));
66
+    }
67
+
68
+    /**
69
+     * 新增智能体
70
+     */
71
+    @Log(title = "智能体", businessType = BusinessType.INSERT)
72
+    @PostMapping
73
+    public AjaxResult add(@RequestBody CmcAgent cmcAgent)
74
+    {
75
+        return toAjax(cmcAgentService.insertCmcAgent(cmcAgent));
76
+    }
77
+
78
+    /**
79
+     * 修改智能体
80
+     */
81
+    @Log(title = "智能体", businessType = BusinessType.UPDATE)
82
+    @PutMapping
83
+    public AjaxResult edit(@RequestBody CmcAgent cmcAgent)
84
+    {
85
+        return toAjax(cmcAgentService.updateCmcAgent(cmcAgent));
86
+    }
87
+
88
+    /**
89
+     * 删除智能体
90
+     */
91
+    @Log(title = "智能体", businessType = BusinessType.DELETE)
92
+	@DeleteMapping("/{agentIds}")
93
+    public AjaxResult remove(@PathVariable Integer[] agentIds)
94
+    {
95
+        return success(cmcAgentService.deleteCmcAgentByAgentIds(agentIds));
96
+    }
97
+}

+ 97
- 0
llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcAgentToolController.java View File

@@ -0,0 +1,97 @@
1
+package com.ruoyi.web.llm.controller;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.web.bind.annotation.GetMapping;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.PutMapping;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.ruoyi.common.annotation.Log;
15
+import com.ruoyi.common.core.controller.BaseController;
16
+import com.ruoyi.common.core.domain.AjaxResult;
17
+import com.ruoyi.common.enums.BusinessType;
18
+import com.ruoyi.llm.domain.CmcAgentTool;
19
+import com.ruoyi.llm.service.ICmcAgentToolService;
20
+import com.ruoyi.common.utils.poi.ExcelUtil;
21
+import com.ruoyi.common.core.page.TableDataInfo;
22
+
23
+/**
24
+ * 智能体工具Controller
25
+ * 
26
+ * @author ruoyi
27
+ * @date 2025-07-17
28
+ */
29
+@RestController
30
+@RequestMapping("/llm/tool")
31
+public class CmcAgentToolController extends BaseController
32
+{
33
+    @Autowired
34
+    private ICmcAgentToolService cmcAgentToolService;
35
+
36
+    /**
37
+     * 查询智能体工具列表
38
+     */
39
+    @GetMapping("/list")
40
+    public TableDataInfo list(CmcAgentTool cmcAgentTool)
41
+    {
42
+        startPage();
43
+        List<CmcAgentTool> list = cmcAgentToolService.selectCmcAgentToolList(cmcAgentTool);
44
+        return getDataTable(list);
45
+    }
46
+
47
+    /**
48
+     * 导出智能体工具列表
49
+     */
50
+    @Log(title = "智能体工具", businessType = BusinessType.EXPORT)
51
+    @PostMapping("/export")
52
+    public void export(HttpServletResponse response, CmcAgentTool cmcAgentTool)
53
+    {
54
+        List<CmcAgentTool> list = cmcAgentToolService.selectCmcAgentToolList(cmcAgentTool);
55
+        ExcelUtil<CmcAgentTool> util = new ExcelUtil<CmcAgentTool>(CmcAgentTool.class);
56
+        util.exportExcel(response, list, "智能体工具数据");
57
+    }
58
+
59
+    /**
60
+     * 获取智能体工具详细信息
61
+     */
62
+    @GetMapping(value = "/{agentToolId}")
63
+    public AjaxResult getInfo(@PathVariable("agentToolId") Integer agentToolId)
64
+    {
65
+        return success(cmcAgentToolService.selectCmcAgentToolByAgentToolId(agentToolId));
66
+    }
67
+
68
+    /**
69
+     * 新增智能体工具
70
+     */
71
+    @Log(title = "智能体工具", businessType = BusinessType.INSERT)
72
+    @PostMapping
73
+    public AjaxResult add(@RequestBody CmcAgentTool cmcAgentTool)
74
+    {
75
+        return toAjax(cmcAgentToolService.insertCmcAgentTool(cmcAgentTool));
76
+    }
77
+
78
+    /**
79
+     * 修改智能体工具
80
+     */
81
+    @Log(title = "智能体工具", businessType = BusinessType.UPDATE)
82
+    @PutMapping
83
+    public AjaxResult edit(@RequestBody CmcAgentTool cmcAgentTool)
84
+    {
85
+        return toAjax(cmcAgentToolService.updateCmcAgentTool(cmcAgentTool));
86
+    }
87
+
88
+    /**
89
+     * 删除智能体工具
90
+     */
91
+    @Log(title = "智能体工具", businessType = BusinessType.DELETE)
92
+	@DeleteMapping("/{agentToolIds}")
93
+    public AjaxResult remove(@PathVariable Integer[] agentToolIds)
94
+    {
95
+        return success(cmcAgentToolService.deleteCmcAgentToolByAgentToolIds(agentToolIds));
96
+    }
97
+}

llm-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/llm/CmcChatController.java → llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcChatController.java View File

@@ -1,4 +1,4 @@
1
-package com.ruoyi.web.controller.llm;
1
+package com.ruoyi.web.llm.controller;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;

llm-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/llm/CmcDocumentController.java → llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcDocumentController.java View File

@@ -1,4 +1,4 @@
1
-package com.ruoyi.web.controller.llm;
1
+package com.ruoyi.web.llm.controller;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;

llm-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/llm/CmcTopicController.java → llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/CmcTopicController.java View File

@@ -1,4 +1,4 @@
1
-package com.ruoyi.web.controller.llm;
1
+package com.ruoyi.web.llm.controller;
2 2
 
3 3
 import java.util.List;
4 4
 import javax.servlet.http.HttpServletResponse;

+ 38
- 3
llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/controller/McpController.java View File

@@ -1,12 +1,17 @@
1 1
 package com.ruoyi.web.llm.controller;
2 2
 
3
+import com.alibaba.fastjson2.JSON;
4
+import com.alibaba.fastjson2.JSONArray;
3 5
 import com.alibaba.fastjson2.JSONObject;
4 6
 import com.ruoyi.common.config.RuoYiConfig;
5 7
 import com.ruoyi.common.core.controller.BaseController;
8
+import com.ruoyi.common.core.domain.AjaxResult;
9
+import org.noear.solon.ai.chat.ChatConfig;
6 10
 import org.noear.solon.ai.chat.ChatModel;
7 11
 import org.noear.solon.ai.chat.ChatResponse;
8 12
 import org.noear.solon.ai.chat.message.AssistantMessage;
9 13
 import org.noear.solon.ai.chat.message.ChatMessage;
14
+import org.noear.solon.ai.chat.tool.FunctionTool;
10 15
 import org.noear.solon.ai.mcp.client.McpClientProvider;
11 16
 import org.springframework.web.bind.annotation.GetMapping;
12 17
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -15,9 +20,8 @@ import org.springframework.web.multipart.MultipartFile;
15 20
 
16 21
 import java.io.File;
17 22
 import java.io.IOException;
18
-import java.util.HashMap;
19
-import java.util.List;
20
-import java.util.Map;
23
+import java.util.*;
24
+import java.util.stream.Collectors;
21 25
 
22 26
 
23 27
 /**
@@ -60,6 +64,37 @@ public class McpController extends BaseController
60 64
         return assistantMessage;
61 65
     }
62 66
 
67
+    /**
68
+     * 获取工具集
69
+     * @return
70
+     */
71
+    @GetMapping("/tools")
72
+    public AjaxResult tools() {
73
+        McpClientProvider clientProvider = McpClientProvider.builder()
74
+                .apiUrl("http://localhost:8080/llm/mcp/sse")
75
+                .build();
76
+
77
+        ChatConfig config = new ChatConfig();
78
+        config.addDefaultTools(clientProvider.getTools());
79
+        Collection<FunctionTool> tools = config.getDefaultTools();
80
+        JSONArray jsonArray = new JSONArray();
81
+        for (FunctionTool tool : tools) {
82
+            JSONObject jsonObject = new JSONObject();
83
+            jsonObject.put("description", tool.description());
84
+            JSONObject properties = JSON.parseObject(tool.inputSchema()).getJSONObject("properties");
85
+            List<String> requiredParams = JSON.parseObject(tool.inputSchema()).getList("required", String.class);
86
+            JSONArray paramArray = new JSONArray();
87
+            for (String param : requiredParams) {
88
+                JSONObject paramObject = new JSONObject();
89
+                paramObject.put("paramDescription", properties.getJSONObject(param).getString("description"));
90
+                paramArray.add(paramObject);
91
+            }
92
+            jsonObject.put("inputParam", paramArray);
93
+            jsonArray.add(jsonObject);
94
+        }
95
+        return success(jsonArray);
96
+    }
97
+
63 98
     /**
64 99
      * 根据招标文件要求编写投标文件技术方案
65 100
      * @return

+ 2
- 2
llm-back/ruoyi-llm/src/main/java/com/ruoyi/web/llm/service/impl/LangChainMilvusServiceImpl.java View File

@@ -156,9 +156,9 @@ public class LangChainMilvusServiceImpl implements ILangChainMilvusService
156 156
     public Flux<AssistantMessage> generateAnswerWithRag(String question, List<JSONObject> contexts, String llmServiceUrl) {
157 157
         StringBuilder sb = new StringBuilder();
158 158
         sb.append("问题: ").append(question).append("\n\n");
159
-        sb.append("根据以下文件中的上下文内容回答问题:\n\n");
159
+        sb.append("根据以下上下文回答问题:\n\n");
160 160
         for (int i = 0; i < contexts.size(); i++) {
161
-            sb.append("文件").append(i + 1).append(": ")
161
+            sb.append("文件").append(": ")
162 162
                     .append(contexts.get(i).getString("file_name")).append("\n\n")
163 163
                     .append("上下文").append(": ")
164 164
                     .append(contexts.get(i).getString("content")).append("\n\n");

+ 81
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/domain/CmcAgent.java View File

@@ -0,0 +1,81 @@
1
+package com.ruoyi.llm.domain;
2
+
3
+import org.apache.commons.lang3.builder.ToStringBuilder;
4
+import org.apache.commons.lang3.builder.ToStringStyle;
5
+import com.ruoyi.common.annotation.Excel;
6
+import com.ruoyi.common.core.domain.BaseEntity;
7
+
8
+/**
9
+ * 智能体对象 cmc_agent
10
+ * 
11
+ * @author ruoyi
12
+ * @date 2025-07-17
13
+ */
14
+public class CmcAgent extends BaseEntity
15
+{
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /** 智能体id */
19
+    private Integer agentId;
20
+
21
+    /** 名称 */
22
+    @Excel(name = "名称")
23
+    private String agentName;
24
+
25
+    /** 描述 */
26
+    @Excel(name = "描述")
27
+    private String description;
28
+
29
+    /** 角色id */
30
+    @Excel(name = "角色id")
31
+    private Long roleId;
32
+
33
+    public void setAgentId(Integer agentId) 
34
+    {
35
+        this.agentId = agentId;
36
+    }
37
+
38
+    public Integer getAgentId() 
39
+    {
40
+        return agentId;
41
+    }
42
+    public void setAgentName(String agentName) 
43
+    {
44
+        this.agentName = agentName;
45
+    }
46
+
47
+    public String getAgentName() 
48
+    {
49
+        return agentName;
50
+    }
51
+    public void setDescription(String description) 
52
+    {
53
+        this.description = description;
54
+    }
55
+
56
+    public String getDescription() 
57
+    {
58
+        return description;
59
+    }
60
+    public void setRoleId(Long roleId) 
61
+    {
62
+        this.roleId = roleId;
63
+    }
64
+
65
+    public Long getRoleId() 
66
+    {
67
+        return roleId;
68
+    }
69
+
70
+    @Override
71
+    public String toString() {
72
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
73
+            .append("agentId", getAgentId())
74
+            .append("agentName", getAgentName())
75
+            .append("description", getDescription())
76
+            .append("createBy", getCreateBy())
77
+            .append("createTime", getCreateTime())
78
+            .append("roleId", getRoleId())
79
+            .toString();
80
+    }
81
+}

+ 79
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/domain/CmcAgentTool.java View File

@@ -0,0 +1,79 @@
1
+package com.ruoyi.llm.domain;
2
+
3
+import org.apache.commons.lang3.builder.ToStringBuilder;
4
+import org.apache.commons.lang3.builder.ToStringStyle;
5
+import com.ruoyi.common.annotation.Excel;
6
+import com.ruoyi.common.core.domain.BaseEntity;
7
+
8
+/**
9
+ * 智能体工具对象 cmc_agent_tool
10
+ * 
11
+ * @author ruoyi
12
+ * @date 2025-07-17
13
+ */
14
+public class CmcAgentTool extends BaseEntity
15
+{
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /** 智能体工具id */
19
+    private Integer agentToolId;
20
+
21
+    /** 工具描述 */
22
+    @Excel(name = "工具描述")
23
+    private String toolName;
24
+
25
+    /** 智能体id */
26
+    @Excel(name = "智能体id")
27
+    private Integer agentId;
28
+
29
+    /** 顺序 */
30
+    @Excel(name = "顺序")
31
+    private String toolSort;
32
+
33
+    public void setAgentToolId(Integer agentToolId) 
34
+    {
35
+        this.agentToolId = agentToolId;
36
+    }
37
+
38
+    public Integer getAgentToolId() 
39
+    {
40
+        return agentToolId;
41
+    }
42
+    public void setToolName(String toolName) 
43
+    {
44
+        this.toolName = toolName;
45
+    }
46
+
47
+    public String getToolName() 
48
+    {
49
+        return toolName;
50
+    }
51
+    public void setAgentId(Integer agentId) 
52
+    {
53
+        this.agentId = agentId;
54
+    }
55
+
56
+    public Integer getAgentId() 
57
+    {
58
+        return agentId;
59
+    }
60
+    public void setToolSort(String toolSort) 
61
+    {
62
+        this.toolSort = toolSort;
63
+    }
64
+
65
+    public String getToolSort() 
66
+    {
67
+        return toolSort;
68
+    }
69
+
70
+    @Override
71
+    public String toString() {
72
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
73
+            .append("agentToolId", getAgentToolId())
74
+            .append("toolName", getToolName())
75
+            .append("agentId", getAgentId())
76
+            .append("toolSort", getToolSort())
77
+            .toString();
78
+    }
79
+}

+ 61
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/mapper/CmcAgentMapper.java View File

@@ -0,0 +1,61 @@
1
+package com.ruoyi.llm.mapper;
2
+
3
+import java.util.List;
4
+import com.ruoyi.llm.domain.CmcAgent;
5
+
6
+/**
7
+ * 智能体Mapper接口
8
+ * 
9
+ * @author ruoyi
10
+ * @date 2025-07-17
11
+ */
12
+public interface CmcAgentMapper 
13
+{
14
+    /**
15
+     * 查询智能体
16
+     * 
17
+     * @param agentId 智能体主键
18
+     * @return 智能体
19
+     */
20
+    public CmcAgent selectCmcAgentByAgentId(Integer agentId);
21
+
22
+    /**
23
+     * 查询智能体列表
24
+     * 
25
+     * @param cmcAgent 智能体
26
+     * @return 智能体集合
27
+     */
28
+    public List<CmcAgent> selectCmcAgentList(CmcAgent cmcAgent);
29
+
30
+    /**
31
+     * 新增智能体
32
+     * 
33
+     * @param cmcAgent 智能体
34
+     * @return 结果
35
+     */
36
+    public int insertCmcAgent(CmcAgent cmcAgent);
37
+
38
+    /**
39
+     * 修改智能体
40
+     * 
41
+     * @param cmcAgent 智能体
42
+     * @return 结果
43
+     */
44
+    public int updateCmcAgent(CmcAgent cmcAgent);
45
+
46
+    /**
47
+     * 删除智能体
48
+     * 
49
+     * @param agentId 智能体主键
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcAgentByAgentId(Integer agentId);
53
+
54
+    /**
55
+     * 批量删除智能体
56
+     * 
57
+     * @param agentIds 需要删除的数据主键集合
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcAgentByAgentIds(Integer[] agentIds);
61
+}

+ 61
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/mapper/CmcAgentToolMapper.java View File

@@ -0,0 +1,61 @@
1
+package com.ruoyi.llm.mapper;
2
+
3
+import java.util.List;
4
+import com.ruoyi.llm.domain.CmcAgentTool;
5
+
6
+/**
7
+ * 智能体工具Mapper接口
8
+ * 
9
+ * @author ruoyi
10
+ * @date 2025-07-17
11
+ */
12
+public interface CmcAgentToolMapper 
13
+{
14
+    /**
15
+     * 查询智能体工具
16
+     * 
17
+     * @param agentToolId 智能体工具主键
18
+     * @return 智能体工具
19
+     */
20
+    public CmcAgentTool selectCmcAgentToolByAgentToolId(Integer agentToolId);
21
+
22
+    /**
23
+     * 查询智能体工具列表
24
+     * 
25
+     * @param cmcAgentTool 智能体工具
26
+     * @return 智能体工具集合
27
+     */
28
+    public List<CmcAgentTool> selectCmcAgentToolList(CmcAgentTool cmcAgentTool);
29
+
30
+    /**
31
+     * 新增智能体工具
32
+     * 
33
+     * @param cmcAgentTool 智能体工具
34
+     * @return 结果
35
+     */
36
+    public int insertCmcAgentTool(CmcAgentTool cmcAgentTool);
37
+
38
+    /**
39
+     * 修改智能体工具
40
+     * 
41
+     * @param cmcAgentTool 智能体工具
42
+     * @return 结果
43
+     */
44
+    public int updateCmcAgentTool(CmcAgentTool cmcAgentTool);
45
+
46
+    /**
47
+     * 删除智能体工具
48
+     * 
49
+     * @param agentToolId 智能体工具主键
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcAgentToolByAgentToolId(Integer agentToolId);
53
+
54
+    /**
55
+     * 批量删除智能体工具
56
+     * 
57
+     * @param agentToolIds 需要删除的数据主键集合
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcAgentToolByAgentToolIds(Integer[] agentToolIds);
61
+}

+ 61
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/ICmcAgentService.java View File

@@ -0,0 +1,61 @@
1
+package com.ruoyi.llm.service;
2
+
3
+import java.util.List;
4
+import com.ruoyi.llm.domain.CmcAgent;
5
+
6
+/**
7
+ * 智能体Service接口
8
+ * 
9
+ * @author ruoyi
10
+ * @date 2025-07-17
11
+ */
12
+public interface ICmcAgentService 
13
+{
14
+    /**
15
+     * 查询智能体
16
+     * 
17
+     * @param agentId 智能体主键
18
+     * @return 智能体
19
+     */
20
+    public CmcAgent selectCmcAgentByAgentId(Integer agentId);
21
+
22
+    /**
23
+     * 查询智能体列表
24
+     * 
25
+     * @param cmcAgent 智能体
26
+     * @return 智能体集合
27
+     */
28
+    public List<CmcAgent> selectCmcAgentList(CmcAgent cmcAgent);
29
+
30
+    /**
31
+     * 新增智能体
32
+     * 
33
+     * @param cmcAgent 智能体
34
+     * @return 结果
35
+     */
36
+    public int insertCmcAgent(CmcAgent cmcAgent);
37
+
38
+    /**
39
+     * 修改智能体
40
+     * 
41
+     * @param cmcAgent 智能体
42
+     * @return 结果
43
+     */
44
+    public int updateCmcAgent(CmcAgent cmcAgent);
45
+
46
+    /**
47
+     * 批量删除智能体
48
+     * 
49
+     * @param agentIds 需要删除的智能体主键集合
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcAgentByAgentIds(Integer[] agentIds);
53
+
54
+    /**
55
+     * 删除智能体信息
56
+     * 
57
+     * @param agentId 智能体主键
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcAgentByAgentId(Integer agentId);
61
+}

+ 61
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/ICmcAgentToolService.java View File

@@ -0,0 +1,61 @@
1
+package com.ruoyi.llm.service;
2
+
3
+import java.util.List;
4
+import com.ruoyi.llm.domain.CmcAgentTool;
5
+
6
+/**
7
+ * 智能体工具Service接口
8
+ * 
9
+ * @author ruoyi
10
+ * @date 2025-07-17
11
+ */
12
+public interface ICmcAgentToolService 
13
+{
14
+    /**
15
+     * 查询智能体工具
16
+     * 
17
+     * @param agentToolId 智能体工具主键
18
+     * @return 智能体工具
19
+     */
20
+    public CmcAgentTool selectCmcAgentToolByAgentToolId(Integer agentToolId);
21
+
22
+    /**
23
+     * 查询智能体工具列表
24
+     * 
25
+     * @param cmcAgentTool 智能体工具
26
+     * @return 智能体工具集合
27
+     */
28
+    public List<CmcAgentTool> selectCmcAgentToolList(CmcAgentTool cmcAgentTool);
29
+
30
+    /**
31
+     * 新增智能体工具
32
+     * 
33
+     * @param cmcAgentTool 智能体工具
34
+     * @return 结果
35
+     */
36
+    public int insertCmcAgentTool(CmcAgentTool cmcAgentTool);
37
+
38
+    /**
39
+     * 修改智能体工具
40
+     * 
41
+     * @param cmcAgentTool 智能体工具
42
+     * @return 结果
43
+     */
44
+    public int updateCmcAgentTool(CmcAgentTool cmcAgentTool);
45
+
46
+    /**
47
+     * 批量删除智能体工具
48
+     * 
49
+     * @param agentToolIds 需要删除的智能体工具主键集合
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcAgentToolByAgentToolIds(Integer[] agentToolIds);
53
+
54
+    /**
55
+     * 删除智能体工具信息
56
+     * 
57
+     * @param agentToolId 智能体工具主键
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcAgentToolByAgentToolId(Integer agentToolId);
61
+}

+ 95
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/impl/CmcAgentServiceImpl.java View File

@@ -0,0 +1,95 @@
1
+package com.ruoyi.llm.service.impl;
2
+
3
+import java.util.List;
4
+import com.ruoyi.common.utils.DateUtils;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.stereotype.Service;
7
+import com.ruoyi.llm.mapper.CmcAgentMapper;
8
+import com.ruoyi.llm.domain.CmcAgent;
9
+import com.ruoyi.llm.service.ICmcAgentService;
10
+
11
+/**
12
+ * 智能体Service业务层处理
13
+ * 
14
+ * @author ruoyi
15
+ * @date 2025-07-17
16
+ */
17
+@Service
18
+public class CmcAgentServiceImpl implements ICmcAgentService 
19
+{
20
+    @Autowired
21
+    private CmcAgentMapper cmcAgentMapper;
22
+
23
+    /**
24
+     * 查询智能体
25
+     * 
26
+     * @param agentId 智能体主键
27
+     * @return 智能体
28
+     */
29
+    @Override
30
+    public CmcAgent selectCmcAgentByAgentId(Integer agentId)
31
+    {
32
+        return cmcAgentMapper.selectCmcAgentByAgentId(agentId);
33
+    }
34
+
35
+    /**
36
+     * 查询智能体列表
37
+     * 
38
+     * @param cmcAgent 智能体
39
+     * @return 智能体
40
+     */
41
+    @Override
42
+    public List<CmcAgent> selectCmcAgentList(CmcAgent cmcAgent)
43
+    {
44
+        return cmcAgentMapper.selectCmcAgentList(cmcAgent);
45
+    }
46
+
47
+    /**
48
+     * 新增智能体
49
+     * 
50
+     * @param cmcAgent 智能体
51
+     * @return 结果
52
+     */
53
+    @Override
54
+    public int insertCmcAgent(CmcAgent cmcAgent)
55
+    {
56
+        cmcAgent.setCreateTime(DateUtils.getNowDate());
57
+        return cmcAgentMapper.insertCmcAgent(cmcAgent);
58
+    }
59
+
60
+    /**
61
+     * 修改智能体
62
+     * 
63
+     * @param cmcAgent 智能体
64
+     * @return 结果
65
+     */
66
+    @Override
67
+    public int updateCmcAgent(CmcAgent cmcAgent)
68
+    {
69
+        return cmcAgentMapper.updateCmcAgent(cmcAgent);
70
+    }
71
+
72
+    /**
73
+     * 批量删除智能体
74
+     * 
75
+     * @param agentIds 需要删除的智能体主键
76
+     * @return 结果
77
+     */
78
+    @Override
79
+    public int deleteCmcAgentByAgentIds(Integer[] agentIds)
80
+    {
81
+        return cmcAgentMapper.deleteCmcAgentByAgentIds(agentIds);
82
+    }
83
+
84
+    /**
85
+     * 删除智能体信息
86
+     * 
87
+     * @param agentId 智能体主键
88
+     * @return 结果
89
+     */
90
+    @Override
91
+    public int deleteCmcAgentByAgentId(Integer agentId)
92
+    {
93
+        return cmcAgentMapper.deleteCmcAgentByAgentId(agentId);
94
+    }
95
+}

+ 93
- 0
llm-back/ruoyi-system/src/main/java/com/ruoyi/llm/service/impl/CmcAgentToolServiceImpl.java View File

@@ -0,0 +1,93 @@
1
+package com.ruoyi.llm.service.impl;
2
+
3
+import java.util.List;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.stereotype.Service;
6
+import com.ruoyi.llm.mapper.CmcAgentToolMapper;
7
+import com.ruoyi.llm.domain.CmcAgentTool;
8
+import com.ruoyi.llm.service.ICmcAgentToolService;
9
+
10
+/**
11
+ * 智能体工具Service业务层处理
12
+ * 
13
+ * @author ruoyi
14
+ * @date 2025-07-17
15
+ */
16
+@Service
17
+public class CmcAgentToolServiceImpl implements ICmcAgentToolService 
18
+{
19
+    @Autowired
20
+    private CmcAgentToolMapper cmcAgentToolMapper;
21
+
22
+    /**
23
+     * 查询智能体工具
24
+     * 
25
+     * @param agentToolId 智能体工具主键
26
+     * @return 智能体工具
27
+     */
28
+    @Override
29
+    public CmcAgentTool selectCmcAgentToolByAgentToolId(Integer agentToolId)
30
+    {
31
+        return cmcAgentToolMapper.selectCmcAgentToolByAgentToolId(agentToolId);
32
+    }
33
+
34
+    /**
35
+     * 查询智能体工具列表
36
+     * 
37
+     * @param cmcAgentTool 智能体工具
38
+     * @return 智能体工具
39
+     */
40
+    @Override
41
+    public List<CmcAgentTool> selectCmcAgentToolList(CmcAgentTool cmcAgentTool)
42
+    {
43
+        return cmcAgentToolMapper.selectCmcAgentToolList(cmcAgentTool);
44
+    }
45
+
46
+    /**
47
+     * 新增智能体工具
48
+     * 
49
+     * @param cmcAgentTool 智能体工具
50
+     * @return 结果
51
+     */
52
+    @Override
53
+    public int insertCmcAgentTool(CmcAgentTool cmcAgentTool)
54
+    {
55
+        return cmcAgentToolMapper.insertCmcAgentTool(cmcAgentTool);
56
+    }
57
+
58
+    /**
59
+     * 修改智能体工具
60
+     * 
61
+     * @param cmcAgentTool 智能体工具
62
+     * @return 结果
63
+     */
64
+    @Override
65
+    public int updateCmcAgentTool(CmcAgentTool cmcAgentTool)
66
+    {
67
+        return cmcAgentToolMapper.updateCmcAgentTool(cmcAgentTool);
68
+    }
69
+
70
+    /**
71
+     * 批量删除智能体工具
72
+     * 
73
+     * @param agentToolIds 需要删除的智能体工具主键
74
+     * @return 结果
75
+     */
76
+    @Override
77
+    public int deleteCmcAgentToolByAgentToolIds(Integer[] agentToolIds)
78
+    {
79
+        return cmcAgentToolMapper.deleteCmcAgentToolByAgentToolIds(agentToolIds);
80
+    }
81
+
82
+    /**
83
+     * 删除智能体工具信息
84
+     * 
85
+     * @param agentToolId 智能体工具主键
86
+     * @return 结果
87
+     */
88
+    @Override
89
+    public int deleteCmcAgentToolByAgentToolId(Integer agentToolId)
90
+    {
91
+        return cmcAgentToolMapper.deleteCmcAgentToolByAgentToolId(agentToolId);
92
+    }
93
+}

+ 74
- 0
llm-back/ruoyi-system/src/main/resources/mapper/llm/CmcAgentMapper.xml View File

@@ -0,0 +1,74 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.llm.mapper.CmcAgentMapper">
6
+    
7
+    <resultMap type="CmcAgent" id="CmcAgentResult">
8
+        <result property="agentId"    column="agent_id"    />
9
+        <result property="agentName"    column="agent_name"    />
10
+        <result property="description"    column="description"    />
11
+        <result property="createBy"    column="create_by"    />
12
+        <result property="createTime"    column="create_time"    />
13
+        <result property="roleId"    column="role_id"    />
14
+    </resultMap>
15
+
16
+    <sql id="selectCmcAgentVo">
17
+        select agent_id, agent_name, description, create_by, create_time, role_id from cmc_agent
18
+    </sql>
19
+
20
+    <select id="selectCmcAgentList" parameterType="CmcAgent" resultMap="CmcAgentResult">
21
+        <include refid="selectCmcAgentVo"/>
22
+        <where>  
23
+            <if test="agentName != null  and agentName != ''"> and agent_name like concat('%', #{agentName}, '%')</if>
24
+            <if test="description != null  and description != ''"> and description = #{description}</if>
25
+            <if test="roleId != null "> and role_id = #{roleId}</if>
26
+        </where>
27
+    </select>
28
+    
29
+    <select id="selectCmcAgentByAgentId" parameterType="Integer" resultMap="CmcAgentResult">
30
+        <include refid="selectCmcAgentVo"/>
31
+        where agent_id = #{agentId}
32
+    </select>
33
+
34
+    <insert id="insertCmcAgent" parameterType="CmcAgent" useGeneratedKeys="true" keyProperty="agentId">
35
+        insert into cmc_agent
36
+        <trim prefix="(" suffix=")" suffixOverrides=",">
37
+            <if test="agentName != null">agent_name,</if>
38
+            <if test="description != null">description,</if>
39
+            <if test="createBy != null">create_by,</if>
40
+            <if test="createTime != null">create_time,</if>
41
+            <if test="roleId != null">role_id,</if>
42
+         </trim>
43
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
44
+            <if test="agentName != null">#{agentName},</if>
45
+            <if test="description != null">#{description},</if>
46
+            <if test="createBy != null">#{createBy},</if>
47
+            <if test="createTime != null">#{createTime},</if>
48
+            <if test="roleId != null">#{roleId},</if>
49
+         </trim>
50
+    </insert>
51
+
52
+    <update id="updateCmcAgent" parameterType="CmcAgent">
53
+        update cmc_agent
54
+        <trim prefix="SET" suffixOverrides=",">
55
+            <if test="agentName != null">agent_name = #{agentName},</if>
56
+            <if test="description != null">description = #{description},</if>
57
+            <if test="createBy != null">create_by = #{createBy},</if>
58
+            <if test="createTime != null">create_time = #{createTime},</if>
59
+            <if test="roleId != null">role_id = #{roleId},</if>
60
+        </trim>
61
+        where agent_id = #{agentId}
62
+    </update>
63
+
64
+    <delete id="deleteCmcAgentByAgentId" parameterType="Integer">
65
+        delete from cmc_agent where agent_id = #{agentId}
66
+    </delete>
67
+
68
+    <delete id="deleteCmcAgentByAgentIds" parameterType="String">
69
+        delete from cmc_agent where agent_id in 
70
+        <foreach item="agentId" collection="array" open="(" separator="," close=")">
71
+            #{agentId}
72
+        </foreach>
73
+    </delete>
74
+</mapper>

+ 68
- 0
llm-back/ruoyi-system/src/main/resources/mapper/llm/CmcAgentToolMapper.xml View File

@@ -0,0 +1,68 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.llm.mapper.CmcAgentToolMapper">
6
+    
7
+    <resultMap type="CmcAgentTool" id="CmcAgentToolResult">
8
+        <result property="agentToolId"    column="agent_tool_id"    />
9
+        <result property="toolName"    column="tool_name"    />
10
+        <result property="agentId"    column="agent_id"    />
11
+        <result property="toolSort"    column="tool_sort"    />
12
+    </resultMap>
13
+
14
+    <sql id="selectCmcAgentToolVo">
15
+        select agent_tool_id, tool_name, agent_id, tool_sort from cmc_agent_tool
16
+    </sql>
17
+
18
+    <select id="selectCmcAgentToolList" parameterType="CmcAgentTool" resultMap="CmcAgentToolResult">
19
+        <include refid="selectCmcAgentToolVo"/>
20
+        <where>  
21
+            <if test="toolName != null  and toolName != ''"> and tool_name like concat('%', #{toolName}, '%')</if>
22
+            <if test="agentId != null "> and agent_id = #{agentId}</if>
23
+            <if test="toolSort != null  and toolSort != ''"> and tool_sort = #{toolSort}</if>
24
+        </where>
25
+    </select>
26
+    
27
+    <select id="selectCmcAgentToolByAgentToolId" parameterType="Integer" resultMap="CmcAgentToolResult">
28
+        <include refid="selectCmcAgentToolVo"/>
29
+        where agent_tool_id = #{agentToolId}
30
+    </select>
31
+
32
+    <insert id="insertCmcAgentTool" parameterType="CmcAgentTool">
33
+        insert into cmc_agent_tool
34
+        <trim prefix="(" suffix=")" suffixOverrides=",">
35
+            <if test="agentToolId != null">agent_tool_id,</if>
36
+            <if test="toolName != null">tool_name,</if>
37
+            <if test="agentId != null">agent_id,</if>
38
+            <if test="toolSort != null">tool_sort,</if>
39
+         </trim>
40
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
41
+            <if test="agentToolId != null">#{agentToolId},</if>
42
+            <if test="toolName != null">#{toolName},</if>
43
+            <if test="agentId != null">#{agentId},</if>
44
+            <if test="toolSort != null">#{toolSort},</if>
45
+         </trim>
46
+    </insert>
47
+
48
+    <update id="updateCmcAgentTool" parameterType="CmcAgentTool">
49
+        update cmc_agent_tool
50
+        <trim prefix="SET" suffixOverrides=",">
51
+            <if test="toolName != null">tool_name = #{toolName},</if>
52
+            <if test="agentId != null">agent_id = #{agentId},</if>
53
+            <if test="toolSort != null">tool_sort = #{toolSort},</if>
54
+        </trim>
55
+        where agent_tool_id = #{agentToolId}
56
+    </update>
57
+
58
+    <delete id="deleteCmcAgentToolByAgentToolId" parameterType="Integer">
59
+        delete from cmc_agent_tool where agent_tool_id = #{agentToolId}
60
+    </delete>
61
+
62
+    <delete id="deleteCmcAgentToolByAgentToolIds" parameterType="String">
63
+        delete from cmc_agent_tool where agent_tool_id in 
64
+        <foreach item="agentToolId" collection="array" open="(" separator="," close=")">
65
+            #{agentToolId}
66
+        </foreach>
67
+    </delete>
68
+</mapper>

+ 40
- 17
llm-back/sql/cmc_llm.sql View File

@@ -23,14 +23,14 @@ SET FOREIGN_KEY_CHECKS = 0;
23 23
 DROP TABLE IF EXISTS `cmc_chat`;
24 24
 CREATE TABLE `cmc_chat`  (
25 25
   `chat_id` char(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '聊天记录id',
26
-  `topic_id` char(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '聊天主题id',
26
+  `topic_id` char(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '聊天主题id',
27 27
   `user_id` bigint NULL DEFAULT NULL COMMENT '用户id',
28 28
   `input` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '输入',
29 29
   `input_time` datetime NULL DEFAULT NULL COMMENT '输入时间',
30 30
   `output` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '输出',
31 31
   `output_time` datetime NULL DEFAULT NULL COMMENT '输出时间',
32 32
   PRIMARY KEY (`chat_id`) USING BTREE
33
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'cmc聊天记录表' ROW_FORMAT = Dynamic;
33
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '聊天记录表' ROW_FORMAT = Dynamic;
34 34
 
35 35
 -- ----------------------------
36 36
 -- Records of cmc_chat
@@ -45,7 +45,7 @@ CREATE TABLE `cmc_document`  (
45 45
   `chat_id` char(19) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '聊天记录id',
46 46
   `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附件',
47 47
   PRIMARY KEY (`document_id`) USING BTREE
48
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'cmc聊天附件表' ROW_FORMAT = Dynamic;
48
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '聊天附件表' ROW_FORMAT = Dynamic;
49 49
 
50 50
 -- ----------------------------
51 51
 -- Records of cmc_document
@@ -60,24 +60,45 @@ CREATE TABLE `cmc_topic`  (
60 60
   `topic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主题',
61 61
   `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
62 62
   PRIMARY KEY (`topic_id`) USING BTREE
63
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'cmc聊天主题表' ROW_FORMAT = Dynamic;
63
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '聊天主题表' ROW_FORMAT = Dynamic;
64 64
 
65 65
 -- ----------------------------
66 66
 -- Records of cmc_topic
67 67
 -- ----------------------------
68
-INSERT INTO `cmc_topic` VALUES ('1', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-12 14:49:13');
69
-INSERT INTO `cmc_topic` VALUES ('10', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-01 14:49:13');
70
-INSERT INTO `cmc_topic` VALUES ('11', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-01 14:49:13');
71
-INSERT INTO `cmc_topic` VALUES ('12', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-05-11 14:49:13');
72
-INSERT INTO `cmc_topic` VALUES ('13', '招标文件招标文件招标文件招标文件招标文件招标文件招标文件', '2025-05-11 15:40:35');
73
-INSERT INTO `cmc_topic` VALUES ('2', '招标文件招标文件招标文件招标文件招标文件招标文件招标文件', '2025-06-11 15:40:35');
74
-INSERT INTO `cmc_topic` VALUES ('3', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-10 14:49:13');
75
-INSERT INTO `cmc_topic` VALUES ('4', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-10 14:49:13');
76
-INSERT INTO `cmc_topic` VALUES ('5', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-10 14:49:13');
77
-INSERT INTO `cmc_topic` VALUES ('6', '招标文件招标文件招标文件招标文件招标文件招标文件招标文件', '2025-06-09 15:40:35');
78
-INSERT INTO `cmc_topic` VALUES ('7', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-09 14:49:13');
79
-INSERT INTO `cmc_topic` VALUES ('8', '技术方案技术方案技术方案技术方案技术方案技术方案技术方案', '2025-06-08 14:49:13');
80
-INSERT INTO `cmc_topic` VALUES ('9', '招标文件招标文件招标文件招标文件招标文件招标文件招标文件', '2025-06-08 15:40:35');
68
+
69
+-- ----------------------------
70
+-- Table structure for cmc_agent
71
+-- ----------------------------
72
+DROP TABLE IF EXISTS `cmc_agent`;
73
+CREATE TABLE `cmc_agent`  (
74
+  `agent_id` int NOT NULL AUTO_INCREMENT COMMENT '智能体id',
75
+  `agent_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称',
76
+  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
77
+  `create_by` bigint NULL DEFAULT NULL COMMENT '创建人',
78
+  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
79
+  `role_id` int NULL DEFAULT NULL COMMENT '角色id',
80
+  PRIMARY KEY (`agent_id`) USING BTREE
81
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '智能体表' ROW_FORMAT = Dynamic;
82
+
83
+-- ----------------------------
84
+-- Records of cmc_agent
85
+-- ----------------------------
86
+
87
+-- ----------------------------
88
+-- Table structure for cmc_agent_tool
89
+-- ----------------------------
90
+DROP TABLE IF EXISTS `cmc_agent_tool`;
91
+CREATE TABLE `cmc_agent_tool`  (
92
+  `agent_tool_id` int NOT NULL COMMENT '智能体工具id',
93
+  `tool_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '工具描述',
94
+  `agent_id` int NULL DEFAULT NULL COMMENT '智能体id',
95
+  `tool_sort` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '顺序',
96
+  PRIMARY KEY (`agent_tool_id`) USING BTREE
97
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '智能体工具表' ROW_FORMAT = Dynamic;
98
+
99
+-- ----------------------------
100
+-- Records of cmc_agent_tool
101
+-- ----------------------------
81 102
 
82 103
 -- ----------------------------
83 104
 -- Table structure for gen_table
@@ -922,6 +943,8 @@ INSERT INTO `sys_menu` VALUES (116, '代码生成', 3, 2, 'gen', 'tool/gen/index
922 943
 INSERT INTO `sys_menu` VALUES (117, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', '2025-04-08 14:15:15', '', NULL, '系统接口菜单');
923 944
 INSERT INTO `sys_menu` VALUES (118, '对话', 4, 1, 'chat', 'llm/chat/index', NULL, '', 1, 0, 'C', '0', '0', NULL, 'wechat', 'admin', '2025-06-11 11:07:36', '', NULL, '');
924 945
 INSERT INTO `sys_menu` VALUES (119, '知识库', 4, 2, 'knowledge', 'llm/knowledge/index', NULL, '', 1, 0, 'C', '0', '0', NULL, 'education', 'admin', '2025-06-11 11:06:33', '', NULL, '');
946
+INSERT INTO `sys_menu` VALUES (120, '智能体', 4, 3, 'agent', 'llm/agent/index', NULL, '', 1, 0, 'C', '0', '0', NULL, 'peoples', 'admin', '2025-07-17 18:15:42', '', NULL, '');
947
+
925 948
 INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', '2025-04-08 14:15:15', '', NULL, '操作日志菜单');
926 949
 INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', '2025-04-08 14:15:15', '', NULL, '登录日志菜单');
927 950
 INSERT INTO `sys_menu` VALUES (1000, '用户查询', 100, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', '2025-04-08 14:15:15', '', NULL, '');

+ 50
- 0
llm-ui/src/api/llm/agent.js View File

@@ -0,0 +1,50 @@
1
+/*
2
+ * @Author: wrh
3
+ * @Date: 2025-07-17 18:06:24
4
+ * @LastEditors: wrh
5
+ * @LastEditTime: 2025-07-17 18:07:30
6
+ */
7
+import request from '@/utils/request'
8
+
9
+// 查询智能体列表
10
+export function listAgent(query) {
11
+  return request({
12
+    url: '/llm/agent/list',
13
+    method: 'get',
14
+    params: query
15
+  })
16
+}
17
+
18
+// 查询智能体详细
19
+export function getAgent(agentId) {
20
+  return request({
21
+    url: '/llm/agent/' + agentId,
22
+    method: 'get'
23
+  })
24
+}
25
+
26
+// 新增智能体
27
+export function addAgent(data) {
28
+  return request({
29
+    url: '/llm/agent',
30
+    method: 'post',
31
+    data: data
32
+  })
33
+}
34
+
35
+// 修改智能体
36
+export function updateAgent(data) {
37
+  return request({
38
+    url: '/llm/agent',
39
+    method: 'put',
40
+    data: data
41
+  })
42
+}
43
+
44
+// 删除智能体
45
+export function delAgent(agentId) {
46
+  return request({
47
+    url: '/llm/agent/' + agentId,
48
+    method: 'delete'
49
+  })
50
+}

+ 44
- 0
llm-ui/src/api/llm/tool.js View File

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询智能体工具列表
4
+export function listTool(query) {
5
+  return request({
6
+    url: '/llm/tool/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询智能体工具详细
13
+export function getTool(agentToolId) {
14
+  return request({
15
+    url: '/llm/tool/' + agentToolId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增智能体工具
21
+export function addTool(data) {
22
+  return request({
23
+    url: '/llm/tool',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改智能体工具
30
+export function updateTool(data) {
31
+  return request({
32
+    url: '/llm/tool',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除智能体工具
39
+export function delTool(agentToolId) {
40
+  return request({
41
+    url: '/llm/tool/' + agentToolId,
42
+    method: 'delete'
43
+  })
44
+}

+ 11
- 0
llm-ui/src/views/llm/agent/index.vue View File

@@ -0,0 +1,11 @@
1
+<!--
2
+ * @Author: wrh
3
+ * @Date: 2025-07-17 18:16:50
4
+ * @LastEditors: wrh
5
+ * @LastEditTime: 2025-07-17 18:17:33
6
+-->
7
+<<template>
8
+  <div>
9
+    
10
+  </div>
11
+</template>>

Loading…
Cancel
Save