fix(agent): use default placeholder for missing model icons and add constants file

main
sp mac bookpro 2605 2026-05-25 23:29:00 +08:00
parent c23df17355
commit e47cf675f0
2 changed files with 3 additions and 1 deletions

1
src/constants.ts Normal file
View File

@ -0,0 +1 @@
export const DEFAULT_MODEL_ICON = 'https://placehold.co/40x40/f3f4f6/9ca3af?text=RH';

View File

@ -3,6 +3,7 @@ import { Button, Form, Input, InputNumber, Modal, Upload, App as AntApp, List, P
import type { UploadFile } from 'antd/es/upload/interface';
import { useNavigate, useParams } from 'react-router-dom';
import { Agent, AgentAPI, ImageAPI, KnowledgeStatus, SkillType, Team, TeamAPI, AiModel, ModelAPI } from '../api';
import { DEFAULT_MODEL_ICON } from '../constants';
import SkillEditor from '../components/SkillEditor';
import McpPanel from '../components/McpPanel';
import ChatPreview from '../components/ChatPreview';
@ -491,7 +492,7 @@ export default function AgentEditor() {
label: (
<div className="flex items-center justify-between w-full py-1">
<div className="flex items-center gap-2" style={{ flex: 1, minWidth: 0 }}>
<img src={m.icon} alt={m.model_name} style={{ width: 20, height: 20, objectFit: 'contain', borderRadius: 4, flexShrink: 0 }} />
<img src={m.icon || DEFAULT_MODEL_ICON} alt={m.model_name} style={{ width: 20, height: 20, objectFit: 'contain', borderRadius: 4, flexShrink: 0 }} />
<span className="font-medium text-gray-800" style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{m.model_name}</span>
</div>
<div className="flex flex-col items-end justify-center text-[10px] text-gray-400" style={{ flexShrink: 0, marginLeft: 8 }}>