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

This commit is contained in:
YunaiV 2024-05-13 13:12:33 +08:00
parent 37952c6a10
commit 6bc1f8d0f9

View File

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