Commit 6bc1f8d0f949cd3f09d7b4d39f55633eb85f02f7

Authored by YunaiV
1 parent 37952c6a

【修复】AI:临时解决 send-stream 被权限拦截 Access Denied 问题

yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/chat/AiChatMessageController.java
... ... @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.Operation;
7 7 import io.swagger.v3.oas.annotations.Parameter;
8 8 import io.swagger.v3.oas.annotations.tags.Tag;
9 9 import jakarta.annotation.Resource;
  10 +import jakarta.annotation.security.PermitAll;
10 11 import lombok.extern.slf4j.Slf4j;
11 12 import org.springframework.http.MediaType;
12 13 import org.springframework.validation.annotation.Validated;
... ... @@ -37,6 +38,7 @@ public class AiChatMessageController {
37 38 // TODO @fan:要不要使用 Flux 来返回;可以使用 Flux<AiChatMessageRespVO>
38 39 @Operation(summary = "发送消息(流式)", description = "流式返回,响应较快")
39 40 @PostMapping(value = "/send-stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
  41 + @PermitAll // 解决 SSE 最终响应的时候,会被 Access Denied 拦截的问题
40 42 public Flux<AiChatMessageRespVO> sendMessageStream(@Validated @RequestBody AiChatMessageSendStreamReqVO sendReqVO) {
41 43 return chatService.chatStream(sendReqVO);
42 44 }
... ...