gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import type { PageParam, PageResult } from '..\..\..\..\packages\effects\request\src';
 
import { requestClient } from '#/api/request';
 
export namespace AiModelChatRoleApi {
  export interface ChatRole {
    id: number; // 角色编号
    modelId: number; // 模型编号
    name: string; // 角色名称
    avatar: string; // 角色头像
    category: string; // 角色类别
    sort: number; // 角色排序
    description: string; // 角色描述
    systemMessage: string; // 角色设定
    welcomeMessage: string; // 角色设定
    publicStatus: boolean; // 是否公开
    status: number; // 状态
    knowledgeIds?: number[]; // 引用的知识库 ID 列表
    toolIds?: number[]; // 引用的工具 ID 列表
  }
 
  // AI 聊天角色 分页请求
  export interface ChatRolePageReqVO {
    name?: string; // 角色名称
    category?: string; // 角色类别
    publicStatus: boolean; // 是否公开
    pageNo: number; // 是否公开
    pageSize: number; // 是否公开
  }
}
 
/** 查询聊天角色分页 */
export function getChatRolePage(params: PageParam) {
  return requestClient.get<PageResult<AiModelChatRoleApi.ChatRole>>(
    '/ai/chat-role/page',
    { params },
  );
}
 
/** 查询聊天角色详情 */
export function getChatRole(id: number) {
  return requestClient.get<AiModelChatRoleApi.ChatRole>(
    `/ai/chat-role/get?id=${id}`,
  );
}
 
/** 新增聊天角色 */
export function createChatRole(data: AiModelChatRoleApi.ChatRole) {
  return requestClient.post('/ai/chat-role/create', data);
}
 
/** 修改聊天角色 */
export function updateChatRole(data: AiModelChatRoleApi.ChatRole) {
  return requestClient.put('/ai/chat-role/update', data);
}
 
/** 删除聊天角色 */
export function deleteChatRole(id: number) {
  return requestClient.delete(`/ai/chat-role/delete?id=${id}`);
}
 
/** 获取 my role */
export function getMyPage(params: AiModelChatRoleApi.ChatRolePageReqVO) {
  return requestClient.get('/ai/chat-role/my-page', { params });
}
 
/** 获取角色分类 */
export function getCategoryList() {
  return requestClient.get('/ai/chat-role/category-list');
}
 
/** 创建角色 */
export function createMy(data: AiModelChatRoleApi.ChatRole) {
  return requestClient.post('/ai/chat-role/create-my', data);
}
 
/** 更新角色 */
export function updateMy(data: AiModelChatRoleApi.ChatRole) {
  return requestClient.put('/ai/chat-role/update', data);
}
 
/** 删除角色 my */
export function deleteMy(id: number) {
  return requestClient.delete(`/ai/chat-role/delete-my?id=${id}`);
}