105 lines
2.4 KiB
TypeScript
105 lines
2.4 KiB
TypeScript
import { api } from '#/api/request.js';
|
|
|
|
// 获取LLM供应商
|
|
export async function getLlmProviderList() {
|
|
return api.get('/api/v1/modelProvider/list');
|
|
}
|
|
|
|
export interface ModelListQuery {
|
|
modelType?: string;
|
|
providerId?: string;
|
|
}
|
|
|
|
export async function getModelList(params: ModelListQuery = {}) {
|
|
return api.get('/api/v1/model/list', { params });
|
|
}
|
|
|
|
export async function getInvokeModelList() {
|
|
return api.get('/api/v1/model/invokeList');
|
|
}
|
|
|
|
// 保存LLM
|
|
export async function saveLlm(data: string) {
|
|
return api.post('/api/v1/model/save', data);
|
|
}
|
|
|
|
// 删除LLM
|
|
export async function deleteLlm(data: any) {
|
|
return api.post(`/api/v1/model/remove`, data);
|
|
}
|
|
|
|
// 修改LLM
|
|
export async function updateLlm(data: any) {
|
|
return api.post(`/api/v1/model/update`, data);
|
|
}
|
|
|
|
export async function verifyModelConfig(id: string) {
|
|
return api.get('/api/v1/model/verifyLlmConfig', { params: { id } });
|
|
}
|
|
|
|
export type ModelVerificationStageStatus =
|
|
| 'FAILED'
|
|
| 'PARTIAL'
|
|
| 'PASSED'
|
|
| 'SKIPPED';
|
|
|
|
export interface ModelVerificationData {
|
|
dimension?: number;
|
|
effectiveHttpVersion?: string;
|
|
message?: string;
|
|
nonStreaming?: ModelVerificationStageStatus;
|
|
status?: ModelVerificationStageStatus;
|
|
streaming?: ModelVerificationStageStatus;
|
|
}
|
|
|
|
export interface ModelInvokeConfigPayload {
|
|
id: string;
|
|
invokeCode?: string;
|
|
publishEnabled: boolean;
|
|
}
|
|
|
|
export async function updateModelInvokeConfig(data: ModelInvokeConfigPayload) {
|
|
return api.post('/api/v1/model/updateInvokeConfig', data);
|
|
}
|
|
|
|
export interface BatchModelInvokePublishPayload {
|
|
ids: string[];
|
|
publishEnabled: boolean;
|
|
}
|
|
|
|
export async function batchUpdateInvokePublishStatus(
|
|
data: BatchModelInvokePublishPayload,
|
|
) {
|
|
return api.post('/api/v1/model/batchUpdateInvokePublishStatus', data);
|
|
}
|
|
|
|
// 一键添加LLM
|
|
export async function quickAddLlm(data: any) {
|
|
return api.post(`/api/v1/model/quickAdd`, data);
|
|
}
|
|
|
|
export interface llmType {
|
|
id: string;
|
|
providerId?: string;
|
|
title: string;
|
|
modelName?: string;
|
|
modelProvider: {
|
|
icon: string;
|
|
providerName: string;
|
|
providerType: string;
|
|
};
|
|
llmModel: string;
|
|
icon: string;
|
|
description: string;
|
|
modelType: string;
|
|
groupName: string;
|
|
invokeCode?: string;
|
|
publishEnabled?: boolean;
|
|
supportTool?: boolean;
|
|
supportImage?: boolean;
|
|
supportImageB64Only?: boolean;
|
|
supportToolMessage?: boolean;
|
|
added: boolean;
|
|
aiLlmProvider: any;
|
|
}
|