@@ -1,100 +0,0 @@
|
||||
import { del, get, post, put } from '@/utils/request';
|
||||
import type {
|
||||
AiAppDto,
|
||||
AiAppCreateInput,
|
||||
AiAppUpdateInput,
|
||||
AiAppGetListInput,
|
||||
AiModelDto,
|
||||
AiModelCreateInput,
|
||||
AiModelUpdateInput,
|
||||
AiModelGetListInput,
|
||||
PagedResultDto,
|
||||
} from './types';
|
||||
|
||||
// ==================== AI应用管理 ====================
|
||||
|
||||
// 获取AI应用列表
|
||||
export function getAppList(params?: AiAppGetListInput) {
|
||||
const queryParams = new URLSearchParams();
|
||||
if (params?.searchKey) {
|
||||
queryParams.append('SearchKey', params.searchKey);
|
||||
}
|
||||
if (params?.skipCount !== undefined) {
|
||||
queryParams.append('SkipCount', params.skipCount.toString());
|
||||
}
|
||||
if (params?.maxResultCount !== undefined) {
|
||||
queryParams.append('MaxResultCount', params.maxResultCount.toString());
|
||||
}
|
||||
|
||||
const queryString = queryParams.toString();
|
||||
const url = queryString ? `/channel/app?${queryString}` : '/channel/app';
|
||||
|
||||
return get<PagedResultDto<AiAppDto>>(url).json();
|
||||
}
|
||||
|
||||
// 根据ID获取AI应用
|
||||
export function getAppById(id: string) {
|
||||
return get<AiAppDto>(`/channel/app/${id}`).json();
|
||||
}
|
||||
|
||||
// 创建AI应用
|
||||
export function createApp(data: AiAppCreateInput) {
|
||||
return post<AiAppDto>('/channel/app', data).json();
|
||||
}
|
||||
|
||||
// 更新AI应用
|
||||
export function updateApp(data: AiAppUpdateInput) {
|
||||
return put<AiAppDto>('/channel/app', data).json();
|
||||
}
|
||||
|
||||
// 删除AI应用
|
||||
export function deleteApp(id: string) {
|
||||
return del(`/channel/app/${id}`).json();
|
||||
}
|
||||
|
||||
// ==================== AI模型管理 ====================
|
||||
|
||||
// 获取AI模型列表
|
||||
export function getModelList(params?: AiModelGetListInput) {
|
||||
const queryParams = new URLSearchParams();
|
||||
if (params?.searchKey) {
|
||||
queryParams.append('SearchKey', params.searchKey);
|
||||
}
|
||||
if (params?.aiAppId) {
|
||||
queryParams.append('AiAppId', params.aiAppId);
|
||||
}
|
||||
if (params?.isPremiumOnly !== undefined) {
|
||||
queryParams.append('IsPremiumOnly', params.isPremiumOnly.toString());
|
||||
}
|
||||
if (params?.skipCount !== undefined) {
|
||||
queryParams.append('SkipCount', params.skipCount.toString());
|
||||
}
|
||||
if (params?.maxResultCount !== undefined) {
|
||||
queryParams.append('MaxResultCount', params.maxResultCount.toString());
|
||||
}
|
||||
|
||||
const queryString = queryParams.toString();
|
||||
const url = queryString ? `/channel/model?${queryString}` : '/channel/model';
|
||||
|
||||
return get<PagedResultDto<AiModelDto>>(url).json();
|
||||
}
|
||||
|
||||
// 根据ID获取AI模型
|
||||
export function getModelById(id: string) {
|
||||
return get<AiModelDto>(`/channel/model/${id}`).json();
|
||||
}
|
||||
|
||||
// 创建AI模型
|
||||
export function createModel(data: AiModelCreateInput) {
|
||||
return post<AiModelDto>('/channel/model', data).json();
|
||||
}
|
||||
|
||||
// 更新AI模型
|
||||
export function updateModel(data: AiModelUpdateInput) {
|
||||
return put<AiModelDto>('/channel/model', data).json();
|
||||
}
|
||||
|
||||
// 删除AI模型
|
||||
export function deleteModel(id: string) {
|
||||
return del(`/channel/model/${id}`).json();
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
// 模型类型枚举
|
||||
export enum ModelTypeEnum {
|
||||
Chat = 0,
|
||||
Image = 1,
|
||||
Embedding = 2,
|
||||
PremiumChat = 3,
|
||||
}
|
||||
|
||||
// 模型API类型枚举
|
||||
export enum ModelApiTypeEnum {
|
||||
OpenAi = 0,
|
||||
Claude = 1,
|
||||
}
|
||||
|
||||
// AI应用DTO
|
||||
export interface AiAppDto {
|
||||
id: string;
|
||||
name: string;
|
||||
endpoint: string;
|
||||
extraUrl?: string;
|
||||
apiKey: string;
|
||||
orderNum: number;
|
||||
creationTime: string;
|
||||
}
|
||||
|
||||
// 创建AI应用输入
|
||||
export interface AiAppCreateInput {
|
||||
name: string;
|
||||
endpoint: string;
|
||||
extraUrl?: string;
|
||||
apiKey: string;
|
||||
orderNum: number;
|
||||
}
|
||||
|
||||
// 更新AI应用输入
|
||||
export interface AiAppUpdateInput {
|
||||
id: string;
|
||||
name: string;
|
||||
endpoint: string;
|
||||
extraUrl?: string;
|
||||
apiKey: string;
|
||||
orderNum: number;
|
||||
}
|
||||
|
||||
// 获取AI应用列表输入
|
||||
export interface AiAppGetListInput {
|
||||
searchKey?: string;
|
||||
skipCount?: number;
|
||||
maxResultCount?: number;
|
||||
}
|
||||
|
||||
// AI模型DTO
|
||||
export interface AiModelDto {
|
||||
id: string;
|
||||
handlerName: string;
|
||||
modelId: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
orderNum: number;
|
||||
aiAppId: string;
|
||||
extraInfo?: string;
|
||||
modelType: ModelTypeEnum;
|
||||
modelApiType: ModelApiTypeEnum;
|
||||
multiplier: number;
|
||||
multiplierShow: number;
|
||||
providerName?: string;
|
||||
iconUrl?: string;
|
||||
isPremium: boolean;
|
||||
}
|
||||
|
||||
// 创建AI模型输入
|
||||
export interface AiModelCreateInput {
|
||||
handlerName: string;
|
||||
modelId: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
orderNum: number;
|
||||
aiAppId: string;
|
||||
extraInfo?: string;
|
||||
modelType: ModelTypeEnum;
|
||||
modelApiType: ModelApiTypeEnum;
|
||||
multiplier: number;
|
||||
multiplierShow: number;
|
||||
providerName?: string;
|
||||
iconUrl?: string;
|
||||
isPremium: boolean;
|
||||
}
|
||||
|
||||
// 更新AI模型输入
|
||||
export interface AiModelUpdateInput {
|
||||
id: string;
|
||||
handlerName: string;
|
||||
modelId: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
orderNum: number;
|
||||
aiAppId: string;
|
||||
extraInfo?: string;
|
||||
modelType: ModelTypeEnum;
|
||||
modelApiType: ModelApiTypeEnum;
|
||||
multiplier: number;
|
||||
multiplierShow: number;
|
||||
providerName?: string;
|
||||
iconUrl?: string;
|
||||
isPremium: boolean;
|
||||
}
|
||||
|
||||
// 获取AI模型列表输入
|
||||
export interface AiModelGetListInput {
|
||||
searchKey?: string;
|
||||
aiAppId?: string;
|
||||
isPremiumOnly?: boolean;
|
||||
skipCount?: number;
|
||||
maxResultCount?: number;
|
||||
}
|
||||
|
||||
// 分页结果
|
||||
export interface PagedResultDto<T> {
|
||||
items: T[];
|
||||
totalCount: number;
|
||||
}
|
||||
Reference in New Issue
Block a user