chore: add model file ux

This commit is contained in:
jialin
2025-03-25 12:33:29 +08:00
parent 05ef2b8eaa
commit dca7a6f270
26 changed files with 1160 additions and 330 deletions
@@ -1,3 +1,5 @@
import { modelSourceMap, modelTaskMap } from './index';
export const HuggingFaceModels = [
{
type: 'stt',
@@ -178,3 +180,25 @@ export const ModelScopeModels = [
name: 'faster-whisper-large-v1'
}
];
export const identifyModelTask = (source: string, modelName: string) => {
let data = null;
if (source === modelSourceMap.huggingface_value) {
data = HuggingFaceModels.find(
(item) =>
`${item.org}/${item.name}`.indexOf(modelName) > -1 ||
modelName?.indexOf(`${item.org}/${item.name}`) > -1
);
}
if (source === modelSourceMap.modelscope_value) {
data = ModelScopeModels.find(
(item) =>
`${item.org}/${item.name}`.indexOf(modelName) > -1 ||
modelName?.indexOf(`${item.org}/${item.name}`) > -1
);
}
if (data) {
return modelTaskMap.audio;
}
return '';
};