jan/web/utils/model-engine.ts
Louis 68714eeaf9
fix: broken status parse due to empty category (#3233)
* fix: broken status parse due to empty category

* cortex 0.5.0-7

---------

Co-authored-by: Van Pham <64197333+Van-QA@users.noreply.github.com>
2024-08-02 12:19:51 +07:00

40 lines
1.1 KiB
TypeScript

import { ModelHubCategory } from '@/hooks/useModelHub'
export const getTitleByCategory = (category: ModelHubCategory) => {
if (!category || !category.length) return ''
switch (category) {
case 'BuiltInModels':
return 'Built-in Models'
case 'HuggingFace':
return 'Hugging Face'
case 'openai':
return 'OpenAI'
case 'openrouter':
return 'OpenRouter'
default:
return category.charAt(0).toUpperCase() + category.slice(1)
}
}
export const getDescriptionByCategory = (category: ModelHubCategory) => {
switch (category) {
case 'BuiltInModels':
return 'All models used even offline, model performance depends on your device capability.'
case 'HuggingFace':
return 'All models used even offline, model performance depends on your device capability.'
default:
return ''
}
}
export const getLogoByCategory = (category: ModelHubCategory) => {
switch (category) {
case 'BuiltInModels':
return 'icons/app_icon.svg'
case 'HuggingFace':
return 'icons/ic_hugging_face.svg'
default:
return undefined
}
}