diff --git a/apps/web/app/components/chat-message.tsx b/apps/web/app/components/chat-message.tsx index 77740393e9a..5074e5786fe 100644 --- a/apps/web/app/components/chat-message.tsx +++ b/apps/web/app/components/chat-message.tsx @@ -556,12 +556,16 @@ const mdComponents: Components = { ); }, - // Render images with loading=lazy - img: ({ src, alt, ...props }) => ( - // eslint-disable-next-line @next/next/no-img-element - {alt - ), - // Syntax-highlighted fenced code blocks + // Render images — route local file paths through raw-file API + img: ({ src, alt, ...props }) => { + const resolvedSrc = typeof src === "string" && !src.startsWith("http://") && !src.startsWith("https://") && !src.startsWith("data:") + ? `/api/workspace/raw-file?path=${encodeURIComponent(src)}` + : src; + return ( + // eslint-disable-next-line @next/next/no-img-element + {alt + ); + }, pre: ({ children, ...props }) => { // react-markdown wraps code blocks in
...
 		// Extract the code element to get lang + content