Some checks reported errors
continuous-integration/drone/push Build was killed
- 搭建 api、auth、utils 等逻辑模块 - 通过 tsc、eslint、vitest 测试验证 BREAKING CHANGE: 新镜像分支
30 lines
993 B
TypeScript
30 lines
993 B
TypeScript
import type { AxiosRequestConfig } from 'axios';
|
|
import type { ApiClient } from '../types';
|
|
import type {
|
|
GetAIPlazaRequest,
|
|
GetAIPlazaResponse,
|
|
GetModelDetailRequest,
|
|
GetModelDetailResponse,
|
|
GetModelCommentsRequest,
|
|
GetModelCommentsResponse
|
|
} from '@/types/model/api';
|
|
|
|
// AI模型API服务工厂函数
|
|
export const modelApi = (client: ApiClient) => ({
|
|
// 获取AI模型广场数据
|
|
getAIPlaza: (params?: GetAIPlazaRequest): Promise<GetAIPlazaResponse> => {
|
|
const config: AxiosRequestConfig = params ? { params } : {};
|
|
return client.get('/models/plaza', config);
|
|
},
|
|
|
|
// 获取模型详情
|
|
getModelDetail: ({ modelId, ...params }: GetModelDetailRequest): Promise<GetModelDetailResponse> => {
|
|
return client.get(`/models/${modelId}`, { params });
|
|
},
|
|
|
|
// 获取模型评论
|
|
getModelComments: ({ modelId, ...params }: GetModelCommentsRequest): Promise<GetModelCommentsResponse> => {
|
|
return client.get(`/models/${modelId}/comments`, { params });
|
|
}
|
|
});
|