mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-06 19:40:13 +00:00
feat(model): Support model icon
This commit is contained in:
@@ -1,20 +1,10 @@
|
||||
import { MODEL_ICON_DICT } from '@/utils/constants';
|
||||
import { getModelIcon } from '@/utils/constants';
|
||||
import Image from 'next/image';
|
||||
import React, { memo, useMemo } from 'react';
|
||||
|
||||
const DEFAULT_ICON_URL = '/models/huggingface.svg';
|
||||
|
||||
const ModelIcon: React.FC<{ width?: number; height?: number; model?: string }> = ({ width, height, model }) => {
|
||||
const iconSrc = useMemo(() => {
|
||||
const formatterModal = model?.replaceAll('-', '_').split('_')[0];
|
||||
const dict = Object.keys(MODEL_ICON_DICT);
|
||||
for (let i = 0; i < dict.length; i++) {
|
||||
const element = dict[i];
|
||||
if (formatterModal?.includes(element)) {
|
||||
return MODEL_ICON_DICT[element];
|
||||
}
|
||||
}
|
||||
return DEFAULT_ICON_URL;
|
||||
return getModelIcon(model || 'huggingface');
|
||||
}, [model]);
|
||||
|
||||
if (!model) return null;
|
||||
|
Reference in New Issue
Block a user