Spaces:
Sleeping
Sleeping
File size: 1,876 Bytes
01d5a5d |
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 86 |
import { Request } from '../utils/request';
import type { CommonResponse, EmptyResponse } from '../types/responseModal';
export interface CreateRoleReq {
name: string;
description: string;
system_prompt: string;
icon: string;
enable_l0_retrieval: boolean;
enable_l1_retrieval?: boolean;
}
export interface RoleRes {
id: number;
uuid: string;
name: string;
description: string;
system_prompt: string;
icon: string;
is_active: boolean;
create_time: string;
update_time: string;
enable_l0_retrieval: boolean;
enable_l1_retrieval?: boolean;
}
export interface uploadRoleReq {
role_id: string;
name: string;
description?: string;
system_prompt: string;
icon?: string;
is_active?: boolean;
enable_l0_retrieval?: boolean;
enable_l1_retrieval?: boolean;
}
export interface UpdateRoleReq extends CreateRoleReq {
is_active?: boolean;
}
export const uploadRole = (data: { role_id: string }) => {
return Request<CommonResponse<RoleRes>>({
method: 'POST',
url: '/api/kernel2/roles/share',
data
});
};
export const createRole = (data: CreateRoleReq) => {
return Request<CommonResponse<RoleRes>>({
method: 'POST',
url: '/api/kernel2/roles',
data
});
};
export const getRoleList = () => {
return Request<CommonResponse<RoleRes[]>>({
method: 'GET',
url: '/api/kernel2/roles'
});
};
export const getRole = (uuid: string) => {
return Request<CommonResponse<RoleRes>>({
method: 'GET',
url: `/api/kernel2/roles/${uuid}`
});
};
export const updateRole = (uuid: string, data: UpdateRoleReq) => {
return Request<CommonResponse<RoleRes>>({
method: 'PUT',
url: `/api/kernel2/roles/${uuid}`,
data
});
};
export const deleteRole = (uuid: string) => {
return Request<CommonResponse<EmptyResponse>>({
method: 'DELETE',
url: `/api/kernel2/roles/${uuid}`
});
};
|