From 95ae0c83d2aa58d86b4039e3f7f16ee93afb8f00 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 23 十月 2026 17:01:00 +0800
Subject: [PATCH] feat(ai): 完善模型管理和智能体导入功能

---
 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/agent/imports/SystemAgentGenericImportService.java |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/agent/imports/SystemAgentGenericImportService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/agent/imports/SystemAgentGenericImportService.java
index 3a924ab..31c73b1 100644
--- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/agent/imports/SystemAgentGenericImportService.java
+++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/agent/imports/SystemAgentGenericImportService.java
@@ -93,19 +93,18 @@
         validateAttachment(request.getAttachmentId(), request.getSourceSha256());
         validateRows(request);
 
-        Long tenantId = principal.tenantId();
         Long ownerUserId = principal.userId();
         String digest = requestDigest(moduleId, request);
 
         // 1. 骞傜瓑鍛戒腑锛氬懡浠� ID 浼樺厛锛屽叾娆″箓绛夐敭
         AgentImportCommandDO existing = commandMapper.selectByCommandId(
-                tenantId, ownerUserId, moduleId, request.getCommandId());
+                ownerUserId, moduleId, request.getCommandId());
         if (existing != null) {
             requireSameDigest(existing, digest);
             return toReceipt(existing);
         }
         existing = commandMapper.selectByIdempotencyKey(
-                tenantId, ownerUserId, moduleId, request.getIdempotencyKey());
+                ownerUserId, moduleId, request.getIdempotencyKey());
         if (existing != null) {
             requireSameDigest(existing, digest);
             return toReceipt(existing);
@@ -129,7 +128,6 @@
                 .idempotencyKey(request.getIdempotencyKey())
                 .requestDigest(digest)
                 .moduleId(moduleId)
-                .tenantId(tenantId)
                 .ownerUserId(ownerUserId)
                 .sessionId(request.getSessionId())
                 .attachmentId(request.getAttachmentId())
@@ -145,10 +143,10 @@
             commandMapper.insert(command);
         } catch (DuplicateKeyException ex) {
             AgentImportCommandDO raced = commandMapper.selectByCommandId(
-                    tenantId, ownerUserId, moduleId, request.getCommandId());
+                    ownerUserId, moduleId, request.getCommandId());
             if (raced == null) {
                 raced = commandMapper.selectByIdempotencyKey(
-                        tenantId, ownerUserId, moduleId, request.getIdempotencyKey());
+                        ownerUserId, moduleId, request.getIdempotencyKey());
             }
             if (raced == null) {
                 throw ex;
@@ -226,7 +224,7 @@
     public AgentImportReceiptRespVO getCommand(String moduleId, String commandId, AgentPrincipal principal) {
         requireAdapter(moduleId);
         AgentImportCommandDO command = commandMapper.selectByCommandId(
-                principal.tenantId(), principal.userId(), moduleId, commandId);
+                principal.userId(), moduleId, commandId);
         if (command == null) {
             throw new AgentBridgeException(HttpStatus.NOT_FOUND, "COMMAND_NOT_FOUND", "瀵煎叆鍛戒护涓嶅瓨鍦�");
         }
@@ -297,9 +295,11 @@
     }
 
     private void requirePermission(AgentImportModuleAdapter adapter) {
-        if (!securityFrameworkService.hasPermission(adapter.permission())) {
-            throw new AgentBridgeException(HttpStatus.FORBIDDEN, "FORBIDDEN",
-                    "褰撳墠鐢ㄦ埛缂哄皯璇ユā鍧楃殑瀵煎叆鏉冮檺锛�" + adapter.permission() + "锛�");
+        for (String permission : adapter.permissions()) {
+            if (!securityFrameworkService.hasPermission(permission)) {
+                throw new AgentBridgeException(HttpStatus.FORBIDDEN, "FORBIDDEN",
+                        "褰撳墠鐢ㄦ埛缂哄皯璇ユā鍧楃殑瀵煎叆鏉冮檺锛�" + permission + "锛�");
+            }
         }
     }
 

--
Gitblit v1.9.3