fix: resolve image 404 and add favicon

Markdown image src with relative paths (/images/...) now resolves to
backend API URL instead of frontend port. Added SVG favicon to eliminate
404 on /favicon.ico.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 09:57:26 +08:00
parent 1a3730c33c
commit 01a1c55de8
3 changed files with 14 additions and 4 deletions
+2
View File
@@ -69,3 +69,5 @@ Desktop.ini
*.coverage
.coverage
htmlcov/
officefile
+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<rect width="32" height="32" rx="6" fill="#2563eb"/>
<text x="16" y="22" font-family="Arial,sans-serif" font-size="18" font-weight="bold" fill="white" text-anchor="middle"></text>
</svg>

After

Width:  |  Height:  |  Size: 255 B

+8 -4
View File
@@ -252,10 +252,14 @@ export default function MessageItem({ message, selectedModel }: MessageItemProps
td: ({ children }) => (
<td className="border border-border px-2 py-1.5">{children}</td>
),
img: ({ src, alt }: any) => (
<a href={src} target="_blank" rel="noopener noreferrer" className="block my-3 group">
img: ({ src, alt }: any) => {
const resolvedSrc = src && src.startsWith("/")
? `${process.env.NEXT_PUBLIC_API_URL || `${window.location.protocol}//${window.location.hostname}:8000`}${src}`
: src;
return (
<a href={resolvedSrc} target="_blank" rel="noopener noreferrer" className="block my-3 group">
<img
src={src}
src={resolvedSrc}
alt={alt || "图片来源"}
loading="lazy"
className="max-w-full max-h-80 rounded-lg border border-border/50 cursor-pointer
@@ -267,7 +271,7 @@ export default function MessageItem({ message, selectedModel }: MessageItemProps
</span>
)}
</a>
),
)},
}}
>
{preprocessCitations(message.content, String(message.id))}