已配置模型显示id的bug修复

This commit is contained in:
2026-01-22 14:21:48 +08:00
parent d7fa8583f7
commit 7109bdc9aa
2 changed files with 9 additions and 3 deletions

View File

@@ -373,12 +373,15 @@
}
container.innerHTML = selectedModelIds.map((modelId, index) => {
const model = allAvailableModels.find(m => m.id === modelId);
// 支持 ID 数字或模型名称字符串匹配
const model = allAvailableModels.find(m =>
String(m.id) === String(modelId) || m.name === modelId
);
const colors = ['bg-blue-100 text-blue-700 border-blue-200', 'bg-green-100 text-green-700 border-green-200', 'bg-purple-100 text-purple-700 border-purple-200', 'bg-orange-100 text-orange-700 border-orange-200'];
const colorClass = colors[index % colors.length];
return `
<span class="model-tag px-3 py-1.5 rounded-lg text-sm font-medium flex items-center ${colorClass}">
${model?.name || `模型 ${modelId}`}
${model?.name || modelId}
</span>
`;
}).join('');