chore: compatibility api

This commit is contained in:
jialin
2025-03-31 16:21:40 +08:00
parent f9469a1ea3
commit bd6c689d91
24 changed files with 848 additions and 374 deletions
+19 -3
View File
@@ -5,6 +5,8 @@ import qs from 'query-string';
import {
CatalogItem,
CatalogSpec,
EvaluateResult,
EvaluateSpec,
FormData,
GPUListItem,
ListItem,
@@ -16,6 +18,8 @@ export const MODELS_API = '/models';
export const MODEL_INSTANCE_API = '/model-instances';
export const MODEL_EVALUATIONS = '/model-evaluations';
const setProxyUrl = (url: string) => {
return `/proxy?url=${encodeURIComponent(url)}`;
};
@@ -189,7 +193,7 @@ export async function queryModelScopeModels(
...params,
...Criterion,
Name: `${params.Name}`,
PageSize: 100,
PageSize: 10,
PageNumber: 1
})
});
@@ -251,7 +255,7 @@ export async function queryHuggingfaceModels(
for await (const model of listModels({
...params,
...options,
limit: 100,
limit: 10,
additionalFields: ['sha', 'tags'],
fetch(_url: string, config: any) {
const url = params.search.sort
@@ -289,7 +293,6 @@ export async function queryHuggingfaceModelFiles(
signal: options?.signal
});
} catch (error) {
console.log('queryHuggingfaceModels error===', error);
// ignore
return [];
}
@@ -363,3 +366,16 @@ export async function queryCatalogItemSpec(
}
);
}
export async function evaluationsModelSpec(
data: {
model_specs: EvaluateSpec[];
},
options: { token: any }
) {
return request<{ results: EvaluateResult[] }>(`${MODEL_EVALUATIONS}`, {
method: 'POST',
data,
cancelToken: options?.token
});
}