(modelName, options = {})
| 547 | |
| 548 | // 渲染带有模型图标的标签 |
| 549 | export function renderModelTag(modelName, options = {}) { |
| 550 | const { |
| 551 | color, |
| 552 | size = 'default', |
| 553 | shape = 'circle', |
| 554 | onClick, |
| 555 | suffixIcon, |
| 556 | } = options; |
| 557 | |
| 558 | const categories = getModelCategories(i18next.t); |
| 559 | let icon = null; |
| 560 | |
| 561 | for (const [key, category] of Object.entries(categories)) { |
| 562 | if (key !== 'all' && category.filter({ model_name: modelName })) { |
| 563 | icon = category.icon; |
| 564 | break; |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | return ( |
| 569 | <Tag |
| 570 | color={color || stringToColor(modelName)} |
| 571 | prefixIcon={icon} |
| 572 | suffixIcon={suffixIcon} |
| 573 | size={size} |
no outgoing calls
no test coverage detected