Explorar o código

增加原始数据,去掉开源注释,修复智能体跟删除接口

zhangenzhi hai 1 mes
pai
achega
9edd204dae

+ 0 - 16
pavis-module-aigc/src/main/java/com/pavis/admin/aigc/common/utils/FloatArrayTypeHandler.java

@@ -1,19 +1,3 @@
-/*
- * Copyright (c) 2022-present zez Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
 package com.pavis.admin.aigc.common.utils;
 
 import com.fasterxml.jackson.core.type.TypeReference;

+ 1 - 15
pavis-module-aigc/src/main/java/com/pavis/admin/aigc/model/req/SimilaritySearchReq.java

@@ -1,18 +1,4 @@
-/*
- * Copyright (c) 2022-present zez Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+
 
 package com.pavis.admin.aigc.model.req;
 

+ 1 - 15
pavis-module-aigc/src/main/java/com/pavis/admin/aigc/model/resp/SimilaritySearchResp.java

@@ -1,18 +1,4 @@
-/*
- * Copyright (c) 2022-present zez Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+
 
 package com.pavis.admin.aigc.model.resp;
 

+ 4 - 3
pavis-module-aigc/src/main/java/com/pavis/admin/aigc/service/AgentService.java

@@ -3,6 +3,7 @@ package com.pavis.admin.aigc.service;
 import com.pavis.admin.aigc.model.entity.AgentKnowledgeDO;
 import com.pavis.admin.aigc.model.entity.KnowledgeDO;
 import com.pavis.admin.aigc.model.entity.ToolDO;
+import com.pavis.admin.aigc.model.req.AgentToolReq;
 import top.continew.starter.extension.crud.service.BaseService;
 import com.pavis.admin.aigc.model.query.AgentQuery;
 import com.pavis.admin.aigc.model.req.AgentReq;
@@ -50,12 +51,12 @@ public interface AgentService extends BaseService<AgentResp, AgentDetailResp, Ag
      */
     List<ToolDO> selTool(Long agentId);
 
+
     /**
      * 删除智能体关联工具
-     *
-     * @param toolId 工具类Id
+     * @param agentToolReq 智能体ID跟工具ID的实体
      */
-    void delToolToAgent(Long toolId);
+    void delToolToAgent(AgentToolReq agentToolReq);
 
 
 }

+ 8 - 3
pavis-module-aigc/src/main/java/com/pavis/admin/aigc/service/impl/AgentServiceImpl.java

@@ -13,6 +13,7 @@ import com.pavis.admin.aigc.model.entity.KnowledgeDO;
 import com.pavis.admin.aigc.model.entity.ToolDO;
 import com.pavis.admin.aigc.model.query.AgentQuery;
 import com.pavis.admin.aigc.model.req.AgentReq;
+import com.pavis.admin.aigc.model.req.AgentToolReq;
 import com.pavis.admin.aigc.model.resp.AgentDetailResp;
 import com.pavis.admin.aigc.model.resp.AgentResp;
 import com.pavis.admin.aigc.service.AgentService;
@@ -71,14 +72,18 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentMapper, AgentDO, Agen
                 .eq("agent_id", agentId));
         if (!agentToolList.isEmpty()) {
             for (AgentToolDO agentToolDO : agentToolList) {
-                list.add(toolMapper.selectById(agentToolDO.getToolId()));
+                ToolDO toolDO = toolMapper.selectById(agentToolDO.getToolId());
+                list.add(toolDO);
             }
         }
         return list;
     }
 
-    public void delToolToAgent(Long toolId){
+    @Override
+    public void delToolToAgent(AgentToolReq agentToolReq){
         agentToolMapper.delete(new QueryWrapper<AgentToolDO>()
-                .eq("tool_id",toolId));
+                .eq("tool_id",agentToolReq.getToolId())
+                .eq("agent_id",agentToolReq.getAgentId())
+        );
     }
 }

+ 0 - 3
pavis-module-aigc/src/main/java/com/pavis/admin/aigc/service/impl/DocChunkServiceImpl.java

@@ -6,16 +6,13 @@ import com.pavis.admin.aigc.model.entity.DocDO;
 import com.pavis.admin.aigc.model.req.SimilaritySearchReq;
 import com.pavis.admin.aigc.model.resp.SimilaritySearchResp;
 import dev.langchain4j.data.embedding.Embedding;
-import dev.langchain4j.data.segment.TextSegment;
 import dev.langchain4j.model.embedding.EmbeddingModel;
 import dev.langchain4j.store.embedding.CosineSimilarity;
-import dev.langchain4j.store.embedding.EmbeddingStore;
 import dev.langchain4j.store.embedding.RelevanceScore;
 import jakarta.annotation.Resource;
 import lombok.RequiredArgsConstructor;
 
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 
 import top.continew.starter.cache.redisson.util.RedisUtils;

+ 4 - 3
pavis-webapi/src/main/java/com/pavis/admin/controller/aigc/AgentController.java

@@ -3,6 +3,7 @@ package com.pavis.admin.controller.aigc;
 import com.pavis.admin.aigc.model.entity.AgentKnowledgeDO;
 import com.pavis.admin.aigc.model.entity.KnowledgeDO;
 import com.pavis.admin.aigc.model.entity.ToolDO;
+import com.pavis.admin.aigc.model.req.AgentToolReq;
 import io.swagger.v3.oas.annotations.Operation;
 import top.continew.starter.extension.crud.enums.Api;
 
@@ -43,8 +44,8 @@ public class AgentController extends BaseController<AgentService, AgentResp, Age
     }
 
     @Operation(summary = "根据工具ID删除智能体关联工具tool", description = "根据工具ID删除智能体关联工具tool")
-    @PostMapping(value = "/delToolToAgent/{toolId}")
-    public void delToolToAgent(@PathVariable Long toolId) {
-        baseService.delToolToAgent(toolId);
+    @PostMapping(value = "/delToolToAgent")
+    public void delToolToAgent(@RequestBody AgentToolReq agentToolReq) {
+        baseService.delToolToAgent(agentToolReq);
     }
 }

+ 11 - 0
pavis-webapi/src/main/resources/db/changelog/mysql/main_data.sql

@@ -457,3 +457,14 @@ VALUES (722203598359887888, 'BROWSER_USE', 'BROWSER_USE', 'default-tool-group',
   }
 }', 0, 1, 1, '2025-06-09 11:01:58', null, null);
 
+
+INSERT INTO `aigc_model_secret`(`id`, `model_id`, `api_key`, `secret_key`, `base_url`, `api_version`, `dimension`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (723177214253764612, 723177214056632323, 'sk-e9855234f47346049809ce23ed3ebe3f', 'secretKey', '', '', NULL, 1, '2025-06-11 14:08:04', 1, '2025-06-12 16:49:08');
+INSERT INTO `aigc_model_secret`(`id`, `model_id`, `api_key`, `secret_key`, `base_url`, `api_version`, `dimension`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (723482042322423842, 723482042041405473, 'sk-e9855234f47346049809ce23ed3ebe3f', 'secretKey', NULL, '', 1024, 1, '2025-06-12 10:19:21', 1, '2025-06-17 11:15:16');
+INSERT INTO `aigc_model_secret`(`id`, `model_id`, `api_key`, `secret_key`, `base_url`, `api_version`, `dimension`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (725341942807834639, 725341942283546638, 'sk-3f91d3517b3648e8b4414f34de0696ea', NULL, 'https://api.deepseek.com/v1', NULL, NULL, 1, '2025-06-17 13:29:55', NULL, NULL);
+INSERT INTO `aigc_model_secret`(`id`, `model_id`, `api_key`, `secret_key`, `base_url`, `api_version`, `dimension`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (728305713230692499, 728305712945479826, 'sk-e9855234f47346049809ce23ed3ebe3f', NULL, NULL, NULL, NULL, 1, '2025-06-25 17:46:53', 1, '2025-06-25 17:53:02');
+INSERT INTO `aigc_model_secret`(`id`, `model_id`, `api_key`, `secret_key`, `base_url`, `api_version`, `dimension`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (728306205247717378, 728306205046390785, 'sk-e9855234f47346049809ce23ed3ebe3f', NULL, NULL, NULL, NULL, 1, '2025-06-25 17:48:51', NULL, NULL);
+
+
+INSERT INTO `aigc_embed_store`(`id`, `name`, `provider`, `endpoints`, `auth_config`, `database_config`, `vector_config`, `pool_config`, `proxy_config`, `last_health`, `health_status`, `vector_count`, `storage_usage`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (723469589962330143, 'redis向量库', 'Redis', '{\"host\": \"192.168.1.202\", \"port\": 6599}', '{\"password\": \"redis-stack\", \"username\": \"default\"}', '{\"table\": \"\", \"database\": \"0\"}', '{\"max_conn\": 16, \"dimension\": 1024, \"index_type\": \"HNSW\", \"metric_type\": \"L2\"}', NULL, NULL, NULL, 0, 0, 0, 1, '2025-06-12 09:29:52', 1, '2025-06-25 17:54:30');
+INSERT INTO `aigc_embed_store`(`id`, `name`, `provider`, `endpoints`, `auth_config`, `database_config`, `vector_config`, `pool_config`, `proxy_config`, `last_health`, `health_status`, `vector_count`, `storage_usage`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (727822627422388537, 'redis向量库一库', 'Redis', '{\"host\": \"192.168.1.202\", \"port\": 6599}', '{\"password\": \"redis-stack\", \"username\": \"default\"}', '{\"table\": \"\", \"database\": \"1\"}', '{\"max_conn\": 16, \"dimension\": 1024, \"index_type\": \"HNSW\", \"metric_type\": \"L2\"}', NULL, NULL, NULL, 0, 0, 0, 1, '2025-06-24 09:47:17', NULL, NULL);
+INSERT INTO `aigc_embed_store`(`id`, `name`, `provider`, `endpoints`, `auth_config`, `database_config`, `vector_config`, `pool_config`, `proxy_config`, `last_health`, `health_status`, `vector_count`, `storage_usage`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (728548067913023489, 'redis向量库五库', 'Redis', '{\"host\": \"192.168.1.202\", \"port\": 6599}', '{\"password\": \"redis-stack\", \"username\": \"default\"}', '{\"table\": \"\", \"database\": \"5\"}', '{\"max_conn\": 16, \"dimension\": 1024, \"index_type\": \"HNSW\", \"metric_type\": \"L2\"}', NULL, NULL, NULL, 0, 0, 0, 1, '2025-06-26 09:49:55', 1, '2025-06-26 09:50:30');