修复客户端资源图标显示

This commit is contained in:
baiyanyun
2026-07-13 17:30:51 +08:00
parent d59bd66dcc
commit c3d6c6dc8e
11 changed files with 157 additions and 79 deletions

View File

@@ -38,6 +38,7 @@ import {
UploadOutlined,
} from "@ant-design/icons";
import type { ColumnsType } from "antd/es/table";
import ImageWithFallback from "../common/ImageWithFallback";
import {
AiAgentContext,
AiManualComponent,
@@ -1213,22 +1214,18 @@ export default function KnowledgePage() {
const renderKnowledgeIcon = (
knowledge: KnowledgeComponent | KnowledgeInfo | null,
) => {
if (knowledge?.icon) {
return (
<img
className={styles.knowledgeIconImage}
src={knowledge.icon}
alt=""
/>
);
}
return (
<span className={styles.knowledgeIconText}>
{getInitial(knowledge?.name)}
</span>
);
};
) => (
<ImageWithFallback
className={styles.knowledgeIconImage}
src={knowledge?.icon}
alt=""
fallback={
<span className={styles.knowledgeIconText}>
{getInitial(knowledge?.name)}
</span>
}
/>
);
const renderCreateButton = (variant: "header" | "toolbar" | "empty") => (
<Button
@@ -1809,7 +1806,11 @@ export default function KnowledgePage() {
onClick={() => iconFileInputRef.current?.click()}
>
<span className={styles.iconPreview}>
{iconUrl ? <img src={iconUrl} alt="" /> : <PictureOutlined />}
<ImageWithFallback
src={iconUrl}
alt=""
fallback={<PictureOutlined />}
/>
</span>
<span className={styles.iconUploadText}>
<strong>