From 6034602612eba7caf4fffeb7265add0e30da85b3 Mon Sep 17 00:00:00 2001
From: 18586361686 <1207669650@qq.com>
Date: 星期三, 14 五月 2025 00:27:18 +0800
Subject: [PATCH] chore: 优化插件的选取方式

---
 aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiBotPluginsController.java |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiBotPluginsController.java b/aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiBotPluginsController.java
index 00e3650..85d1d7d 100644
--- a/aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiBotPluginsController.java
+++ b/aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiBotPluginsController.java
@@ -1,5 +1,6 @@
 package tech.aiflowy.ai.controller;
 
+import org.springframework.web.bind.annotation.PostMapping;
 import tech.aiflowy.common.domain.Result;
 import tech.aiflowy.common.tree.Tree;
 import tech.aiflowy.common.web.controller.BaseCurdController;
@@ -9,7 +10,9 @@
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import tech.aiflowy.common.web.jsonbody.JsonBody;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -26,6 +29,9 @@
         super(service);
     }
 
+    @Resource
+    private AiBotPluginsService aiBotPluginsService;
+
     @GetMapping("list")
     public Result list(AiBotPlugins entity, Boolean asTree, String sortKey, String sortType){
 
@@ -36,7 +42,20 @@
 
         List<AiBotPlugins> list = Tree.tryToTree(aiBotPlugins, asTree);
 
-        return Result.success(list);
+         return Result.success(list);
     }
 
-}
\ No newline at end of file
+    @PostMapping("/getList")
+    public Result getList(@JsonBody(value = "botId", required = true) String botId){
+//        QueryWrapper queryWrapper = QueryWrapper.create().select("plugin_id").where("bot_id = ?", botId);
+//        List<AiBotPlugins> list = service.list(queryWrapper);
+        return aiBotPluginsService.getList(botId);
+    }
+
+    @PostMapping("/doRemove")
+    public Result doRemove(@JsonBody(value = "botId", required = true) String botId,
+                           @JsonBody(value = "pluginId", required = true) String pluginId){
+        return aiBotPluginsService.doRemove(botId, pluginId);
+    }
+
+}

--
Gitblit v1.8.0