feat: 增加服务商远端模型发现与一键添加

- 支持 OpenAI 兼容、Ollama 和阿里百炼模型目录适配

- 使用静态模型库识别能力并过滤未接入的生成模型

- 增加扁平模型列表、搜索筛选和幂等添加
This commit is contained in:
2026-07-21 19:01:33 +08:00
parent 9436cc5397
commit 53fb63802b
35 changed files with 15397 additions and 3 deletions

View File

@@ -37,6 +37,47 @@ export async function verifyModelConfig(id: string) {
return api.get('/api/v1/model/verifyLlmConfig', { params: { id } });
}
export type ModelCapabilitySource = 'CATALOG' | 'DEFAULT' | 'RULE';
export interface RemoteModelDescriptor {
addable: boolean;
added: boolean;
capabilitySource: ModelCapabilitySource;
displayName: string;
family: string;
modelId: string;
modelType: 'chatModel' | 'embeddingModel' | 'rerankModel';
supportImage?: boolean | null;
supportThinking?: boolean | null;
supportTool?: boolean | null;
unavailableReason?: null | string;
}
export interface RemoteModelListData {
models: RemoteModelDescriptor[];
providerId: string;
truncated: boolean;
}
export type RemoteModelImportStatus = 'ALREADY_EXISTS' | 'CREATED';
export interface RemoteModelImportData {
localModelId: string;
modelId: string;
modelType: RemoteModelDescriptor['modelType'];
status: RemoteModelImportStatus;
}
export async function getRemoteModels(providerId: string) {
return api.get(`/api/v1/modelProvider/${providerId}/remoteModels`);
}
export async function importRemoteModel(providerId: string, modelId: string) {
return api.post(`/api/v1/modelProvider/${providerId}/remoteModels/import`, {
modelId,
});
}
export type ModelVerificationStageStatus =
| 'FAILED'
| 'PARTIAL'