fix(model-catalog): refine summary capability filters
This commit is contained in:
@@ -60,9 +60,15 @@ export function ModelsPage(props: { data: ConsoleData }) {
|
||||
|
||||
<main className="modelsContent">
|
||||
<div className="modelsToolbar">
|
||||
<div className="searchField modelHeaderSearch">
|
||||
<div className="searchField modelHeaderSearch" role="search">
|
||||
<Search size={16} />
|
||||
<Input value={query} onChange={(event) => setQuery(event.target.value)} placeholder="模型名称、能力或厂商" />
|
||||
<Input
|
||||
aria-label="搜索模型"
|
||||
size="sm"
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder="模型名称、能力或厂商"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -235,21 +241,37 @@ function ModelIcon(props: { iconPath?: string; label: string }) {
|
||||
|
||||
function modelMatchesCapability(model: ModelCatalogItem, capability: string) {
|
||||
if (model.modelType.some((type) => modelTypeMatchesCapability(type, capability))) return true;
|
||||
if (capability === 'tools') return model.capabilityTags.includes('工具调用');
|
||||
if (capability === 'omni') return model.capabilityTags.includes('全模态');
|
||||
if (model.capabilityTags.some((tag) => capabilityValueForTag(tag) === capability)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function modelTypeMatchesCapability(value: string, capability: string) {
|
||||
const type = value.trim().toLowerCase();
|
||||
if (capability === 'chat') return type === 'text_generate' || type === 'chat' || type === 'responses' || type.includes('text');
|
||||
if (capability === 'image') return type.includes('image') && !type.includes('video');
|
||||
if (capability === 'video') return type.includes('video');
|
||||
if (capability === 'audio') return type.includes('audio') || type.includes('speech');
|
||||
if (capability === 'embedding') return type === 'text_embedding' || type === 'embedding';
|
||||
if (capability === 'tools') return type === 'tools_call';
|
||||
if (capability === 'omni') return type === 'omni' || type === 'omni_video';
|
||||
return type === capability;
|
||||
return canonicalCapabilityValue(value) === capability;
|
||||
}
|
||||
|
||||
function canonicalCapabilityValue(value: string) {
|
||||
const type = value.trim().toLowerCase().replaceAll('-', '_');
|
||||
if (type === 'embedding') return 'text_embedding';
|
||||
if (type === 'model') return 'model_3d';
|
||||
return type;
|
||||
}
|
||||
|
||||
function capabilityValueForTag(tag: string) {
|
||||
const values: Record<string, string> = {
|
||||
工具调用: 'tools_call',
|
||||
全模态: 'omni',
|
||||
全模态视频: 'omni_video',
|
||||
多模态: 'multimodal',
|
||||
推理: 'reasoning',
|
||||
结构化输出: 'structured_output',
|
||||
数字人: 'digital_human',
|
||||
'3D 模型': 'model_3d',
|
||||
'文生 3D': 'text_to_model',
|
||||
'图生 3D': 'image_to_model',
|
||||
'多视角 3D': 'multiview_to_model',
|
||||
'3D 模型编辑': 'mesh_edit',
|
||||
};
|
||||
return values[tag] ?? '';
|
||||
}
|
||||
|
||||
function providerInitials(label: string) {
|
||||
|
||||
Reference in New Issue
Block a user