feat:【antd】【ai】modal 部分的代码优化

This commit is contained in:
YunaiV
2025-10-26 16:06:45 +08:00
parent 178a0a3bb2
commit e301bee211
5 changed files with 36 additions and 33 deletions

View File

@@ -13,7 +13,7 @@ export namespace AiModelApiKeyApi {
}
}
// 查询 API 密钥分页
/** 查询 API 密钥分页 */
export function getApiKeyPage(params: PageParam) {
return requestClient.get<PageResult<AiModelApiKeyApi.ApiKey>>(
'/ai/api-key/page',
@@ -21,28 +21,29 @@ export function getApiKeyPage(params: PageParam) {
);
}
// 获得 API 密钥列表
/** 获得 API 密钥列表 */
export function getApiKeySimpleList() {
return requestClient.get<AiModelApiKeyApi.ApiKey[]>(
'/ai/api-key/simple-list',
);
}
// 查询 API 密钥详情
/** 查询 API 密钥详情 */
export function getApiKey(id: number) {
return requestClient.get<AiModelApiKeyApi.ApiKey>(`/ai/api-key/get?id=${id}`);
}
// 新增 API 密钥
/** 新增 API 密钥 */
export function createApiKey(data: AiModelApiKeyApi.ApiKey) {
return requestClient.post('/ai/api-key/create', data);
}
// 修改 API 密钥
/** 修改 API 密钥 */
export function updateApiKey(data: AiModelApiKeyApi.ApiKey) {
return requestClient.put('/ai/api-key/update', data);
}
// 删除 API 密钥
/** 删除 API 密钥 */
export function deleteApiKey(id: number) {
return requestClient.delete(`/ai/api-key/delete?id=${id}`);
}

View File

@@ -20,7 +20,7 @@ export namespace AiModelChatRoleApi {
}
// AI 聊天角色 分页请求
export interface ChatRolePageReq {
export interface ChatRolePageReqVO {
name?: string; // 角色名称
category?: string; // 角色类别
publicStatus: boolean; // 是否公开
@@ -29,7 +29,7 @@ export namespace AiModelChatRoleApi {
}
}
// 查询聊天角色分页
/** 查询聊天角色分页 */
export function getChatRolePage(params: PageParam) {
return requestClient.get<PageResult<AiModelChatRoleApi.ChatRole>>(
'/ai/chat-role/page',
@@ -37,49 +37,49 @@ export function getChatRolePage(params: PageParam) {
);
}
// 查询聊天角色详情
/** 查询聊天角色详情 */
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}`);
}
// ======= chat 聊天
// 获取 my role
export function getMyPage(params: AiModelChatRoleApi.ChatRolePageReq) {
/** 获取 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
/** 删除角色 my */
export function deleteMy(id: number) {
return requestClient.delete(`/ai/chat-role/delete-my?id=${id}`);
}

View File

@@ -18,7 +18,7 @@ export namespace AiModelModelApi {
}
}
// 查询模型分页
/** 查询模型分页 */
export function getModelPage(params: PageParam) {
return requestClient.get<PageResult<AiModelModelApi.Model>>(
'/ai/model/page',
@@ -26,7 +26,7 @@ export function getModelPage(params: PageParam) {
);
}
// 获得模型列表
/** 获得模型列表 */
export function getModelSimpleList(type?: number) {
return requestClient.get<AiModelModelApi.Model[]>('/ai/model/simple-list', {
params: {
@@ -35,21 +35,22 @@ export function getModelSimpleList(type?: number) {
});
}
// 查询模型详情
/** 查询模型详情 */
export function getModel(id: number) {
return requestClient.get<AiModelModelApi.Model>(`/ai/model/get?id=${id}`);
}
// 新增模型
/** 新增模型 */
export function createModel(data: AiModelModelApi.Model) {
return requestClient.post('/ai/model/create', data);
}
// 修改模型
/** 修改模型 */
export function updateModel(data: AiModelModelApi.Model) {
return requestClient.put('/ai/model/update', data);
}
// 删除模型
/** 删除模型 */
export function deleteModel(id: number) {
return requestClient.delete(`/ai/model/delete?id=${id}`);
}

View File

@@ -11,33 +11,34 @@ export namespace AiModelToolApi {
}
}
// 查询工具分页
/** 查询工具分页 */
export function getToolPage(params: PageParam) {
return requestClient.get<PageResult<AiModelToolApi.Tool>>('/ai/tool/page', {
params,
});
}
// 查询工具详情
/** 查询工具详情 */
export function getTool(id: number) {
return requestClient.get<AiModelToolApi.Tool>(`/ai/tool/get?id=${id}`);
}
// 新增工具
/** 新增工具 */
export function createTool(data: AiModelToolApi.Tool) {
return requestClient.post('/ai/tool/create', data);
}
// 修改工具
/** 修改工具 */
export function updateTool(data: AiModelToolApi.Tool) {
return requestClient.put('/ai/tool/update', data);
}
// 删除工具
/** 删除工具 */
export function deleteTool(id: number) {
return requestClient.delete(`/ai/tool/delete?id=${id}`);
}
// 获取工具简单列表
/** 获取工具简单列表 */
export function getToolSimpleList() {
return requestClient.get<AiModelToolApi.Tool[]>('/ai/tool/simple-list');
}

View File

@@ -55,7 +55,7 @@ async function handleTabsClick(tab: any) {
/** 获取 my role 我的角色 */
async function getMyRole(append?: boolean) {
const params: AiModelChatRoleApi.ChatRolePageReq = {
const params: AiModelChatRoleApi.ChatRolePageReqVO = {
...myRoleParams,
name: search.value,
publicStatus: false,
@@ -70,7 +70,7 @@ async function getMyRole(append?: boolean) {
/** 获取 public role 公共角色 */
async function getPublicRole(append?: boolean) {
const params: AiModelChatRoleApi.ChatRolePageReq = {
const params: AiModelChatRoleApi.ChatRolePageReqVO = {
...publicRoleParams,
category: activeCategory.value === '全部' ? '' : activeCategory.value,
name: search.value,