mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-08 22:54:59 +08:00
优化:chat角色 - 修改可见性
This commit is contained in:
parent
a0b3bd32b0
commit
cec8cc7a2b
@ -48,16 +48,17 @@ public class ChatRoleController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "chat角色 - 修改可见性")
|
@Operation(summary = "chat角色 - 修改可见性")
|
||||||
@PostMapping("/role/update-visibility")
|
@PostMapping("/role/{id}/update-visibility")
|
||||||
public CommonResult<Void> updateVisibility(@Validated @RequestBody ChatRoleUpdateVisibilityReq req) {
|
public CommonResult<Void> updateVisibility(@PathVariable("id") Long id,
|
||||||
chatRoleService.updateVisibility(req);
|
@Validated @RequestBody ChatRoleUpdateVisibilityReq req) {
|
||||||
|
chatRoleService.updateVisibility(id, req);
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "chat角色 - 修改可见性")
|
@Operation(summary = "chat角色 - 删除")
|
||||||
@DeleteMapping("/role")
|
@DeleteMapping("/role/{id}")
|
||||||
public CommonResult<Void> delete(@RequestParam("chatRoleId") Long chatRoleId) {
|
public CommonResult<Void> delete(@PathVariable("id") Long id) {
|
||||||
chatRoleService.delete(chatRoleId);
|
chatRoleService.delete(id);
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,10 @@ public interface ChatRoleService {
|
|||||||
/**
|
/**
|
||||||
* chat角色 - 修改可见性
|
* chat角色 - 修改可见性
|
||||||
*
|
*
|
||||||
|
* @param id
|
||||||
* @param req
|
* @param req
|
||||||
*/
|
*/
|
||||||
void updateVisibility(ChatRoleUpdateVisibilityReq req);
|
void updateVisibility(Long id, ChatRoleUpdateVisibilityReq req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* chat角色 - 删除
|
* chat角色 - 删除
|
||||||
|
@ -82,14 +82,14 @@ public class ChatRoleServiceImpl implements ChatRoleService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateVisibility(ChatRoleUpdateVisibilityReq req) {
|
public void updateVisibility(Long id, ChatRoleUpdateVisibilityReq req) {
|
||||||
// 转换enum,并校验enum
|
// 转换enum,并校验enum
|
||||||
ChatRoleVisibilityEnum.valueOfType(req.getVisibility());
|
ChatRoleVisibilityEnum.valueOfType(req.getVisibility());
|
||||||
// 检查角色是否存在
|
// 检查角色是否存在
|
||||||
validateChatRoleExists(req.getId());
|
validateChatRoleExists(id);
|
||||||
// 更新
|
// 更新
|
||||||
aiChatRoleMapper.updateById(new AiChatRoleDO()
|
aiChatRoleMapper.updateById(new AiChatRoleDO()
|
||||||
.setId(req.getId())
|
.setId(id)
|
||||||
.setVisibility(req.getVisibility())
|
.setVisibility(req.getVisibility())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,6 @@ import lombok.experimental.Accessors;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class ChatRoleUpdateVisibilityReq extends PageParam {
|
public class ChatRoleUpdateVisibilityReq extends PageParam {
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Schema(description = "编号")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Schema(description = "发布状态,0表示仅自己可见,1表示公开,2表示禁用")
|
@Schema(description = "发布状态,0表示仅自己可见,1表示公开,2表示禁用")
|
||||||
private String visibility;
|
private String visibility;
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
### chat角色 - list
|
||||||
|
GET {{baseUrl}}/ai/chat/role/list?pageNo=1&pageSize=20&search=
|
||||||
|
Authorization: {{token}}
|
||||||
|
|
||||||
|
|
||||||
|
### chat add
|
||||||
|
PUT {{baseUrl}}/ai/chat/role
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: {{token}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"modelId": 1,
|
||||||
|
"roleName": "小红书写作v1",
|
||||||
|
"roleIntroduce": "采用gpt3.5模型,拥有小红书优质作者写作经验。",
|
||||||
|
"roleSource": "system",
|
||||||
|
"classify": "writing",
|
||||||
|
"visibility": "public",
|
||||||
|
"topK": 0.2,
|
||||||
|
"topP": 0.4,
|
||||||
|
"temperature": 0.7
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### chat update
|
||||||
|
POST {{baseUrl}}/ai/chat/role/1
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: {{token}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"modelId": 1,
|
||||||
|
"roleName": "小红书写作v1---hh😄",
|
||||||
|
"roleIntroduce": "采用gpt3.5模型,拥有小红书优质作者写作经验。",
|
||||||
|
"roleSource": "system",
|
||||||
|
"classify": "writing",
|
||||||
|
"visibility": "public",
|
||||||
|
"topK": 0.2,
|
||||||
|
"topP": 0.4,
|
||||||
|
"temperature": 0.7
|
||||||
|
}
|
||||||
|
|
||||||
|
### chat update
|
||||||
|
POST {{baseUrl}}/ai/chat/role/1/update-visibility
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: {{token}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"visibility": "private"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user