Commit 88efbb4f by 彭顺

fix: get-used-agents auth error

parent 1217d4e3
No preview for this file type
...@@ -73,12 +73,14 @@ public class AgentChatController { ...@@ -73,12 +73,14 @@ public class AgentChatController {
@PostMapping("/create-agent-records") @PostMapping("/create-agent-records")
@Operation(summary = "创建对话过的智能体记录") @Operation(summary = "创建对话过的智能体记录")
@PermitAll
public CommonResult<Long> createChatAgentRecord(@RequestBody @Valid AgentCreateReqVO createReqVO) { public CommonResult<Long> createChatAgentRecord(@RequestBody @Valid AgentCreateReqVO createReqVO) {
return success(chatConversationService.createUsedAgentRecord(createReqVO, getLoginUserId())); return success(chatConversationService.createUsedAgentRecord(createReqVO, getLoginUserId()));
} }
@GetMapping("/get-used-agents") @GetMapping("/get-used-agents")
@Operation(summary = "获得对话过的智能体列表") @Operation(summary = "获得对话过的智能体列表")
@PermitAll
public CommonResult<List<AgentUsedRespVO>> getChatAgentList() { public CommonResult<List<AgentUsedRespVO>> getChatAgentList() {
List<AiChatConversationDO> list = chatConversationService.getChatAgentListByUserId(getLoginUserId()); List<AiChatConversationDO> list = chatConversationService.getChatAgentListByUserId(getLoginUserId());
......
...@@ -174,6 +174,9 @@ public class AiChatConversationServiceImpl implements AiChatConversationService ...@@ -174,6 +174,9 @@ public class AiChatConversationServiceImpl implements AiChatConversationService
@Override @Override
public Long createUsedAgentRecord(AgentCreateReqVO createReqVO, Long userId) { public Long createUsedAgentRecord(AgentCreateReqVO createReqVO, Long userId) {
if (userId == null){
throw exception(USER_NOT_LOGIN);
}
// 1.1 获得 AiChatRoleDO 聊天角色 // 1.1 获得 AiChatRoleDO 聊天角色
AiChatRoleDO role = chatRoleService.validateChatRole(createReqVO.getRoleId()); AiChatRoleDO role = chatRoleService.validateChatRole(createReqVO.getRoleId());
// 1.2 获得 AiChatModelDO 聊天模型 // 1.2 获得 AiChatModelDO 聊天模型
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment