Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
shun peng
/
lufa-ai
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bd8a139e
authored
Jul 09, 2025
by
patrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: send-stream api login error
parent
e3730e94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
ruoyi-vue-pro-master-jdk17/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/chat/AiChatMessageController.java
+5
-3
ruoyi-vue-pro-master-jdk17/yudao-server/.DS_Store
+0
-0
No files found.
ruoyi-vue-pro-master-jdk17/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/chat/AiChatMessageController.java
View file @
bd8a139e
...
@@ -80,8 +80,10 @@ public class AiChatMessageController {
...
@@ -80,8 +80,10 @@ public class AiChatMessageController {
@PostMapping
(
value
=
"/send-stream"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@PostMapping
(
value
=
"/send-stream"
,
produces
=
MediaType
.
TEXT_EVENT_STREAM_VALUE
)
@PermitAll
// 解决 SSE 最终响应的时候,会被 Access Denied 拦截的问题
@PermitAll
// 解决 SSE 最终响应的时候,会被 Access Denied 拦截的问题
public
Flux
<
CommonResult
<
AiChatMessageSendRespVO
>>
sendChatMessageStream
(
@Valid
@RequestBody
AiChatMessageSendReqVO
sendReqVO
)
throws
MalformedURLException
{
public
Flux
<
CommonResult
<
AiChatMessageSendRespVO
>>
sendChatMessageStream
(
@Valid
@RequestBody
AiChatMessageSendReqVO
sendReqVO
)
throws
MalformedURLException
{
if
(
getLoginUserId
()
==
null
){
Long
userId
=
getLoginUserId
();
throw
exception
(
USER_NOT_LOGIN
);
if
(
userId
==
null
)
{
// 将错误包装在流中返回
return
Flux
.
just
(
CommonResult
.
error
(
USER_NOT_LOGIN
.
getCode
(),
USER_NOT_LOGIN
.
getMsg
()));
}
}
// 禁用ruoyi的上下文能力
// 禁用ruoyi的上下文能力
sendReqVO
.
setUseContext
(
false
);
sendReqVO
.
setUseContext
(
false
);
...
@@ -101,7 +103,7 @@ public class AiChatMessageController {
...
@@ -101,7 +103,7 @@ public class AiChatMessageController {
if
(
sendReqVO
.
getResponseChatItemId
()
==
null
)
{
if
(
sendReqVO
.
getResponseChatItemId
()
==
null
)
{
sendReqVO
.
setResponseChatItemId
(
generateBase62UniqueId
(
20
));
sendReqVO
.
setResponseChatItemId
(
generateBase62UniqueId
(
20
));
}
}
return
chatMessageService
.
sendChatMessageStream
(
sendReqVO
,
getLoginUserId
()
,
originalUrls
);
return
chatMessageService
.
sendChatMessageStream
(
sendReqVO
,
userId
,
originalUrls
);
}
}
@Operation
(
summary
=
"获得指定对话的消息列表"
)
@Operation
(
summary
=
"获得指定对话的消息列表"
)
...
...
ruoyi-vue-pro-master-jdk17/yudao-server/.DS_Store
View file @
bd8a139e
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment