cc 1 semana atrás
pai
commit
3dcee1eb15

+ 1 - 7
ai-server/src/main/java/com/zsjz/ai/module/agent/controller/AgentChatController.java

@@ -47,13 +47,7 @@ public class AgentChatController {
     public ChatAttachmentService.AttachmentVO uploadAttachment(@RequestPart("file") MultipartFile file,
                                                                @RequestParam Long workspaceId,
                                                                @RequestParam(required = false) Long sessionId) {
-        Long userId;
-        try {
-            userId = StpUtil.getLoginIdAsLong();
-        } catch (Exception e) {
-            throw new ServerException(401, "未登录");
-        }
-        return chatAttachmentService.upload(file, userId, workspaceId, sessionId == null ? 0L : sessionId);
+        return chatAttachmentService.upload(file, StpUtil.getLoginIdAsLong(), workspaceId, sessionId == null ? 0L : sessionId);
     }
 
     /**