Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chat): render images inline from markdown ![](path) syntax

Louis Beaumont43688edc0626
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index f5e1244ef..563b93535 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -19,6 +19,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
import { MemoizedReactMarkdown } from "@/components/markdown";
import { VideoComponent } from "@/components/rewind/video";
import { MermaidDiagram } from "@/components/rewind/mermaid-diagram";
+import { convertFileSrc } from "@tauri-apps/api/core";
import { AIPresetsSelector } from "@/components/rewind/ai-presets-selector";
import { AIPreset } from "@/lib/utils/tauri";
import remarkGfm from "remark-gfm";
@@ -583,6 +584,22 @@ function MarkdownBlock({ text, isUser }: { text: string; isUser: boolean }) {
</a>
);
},
+ img({ src, alt, ...props }) {
+ if (!src) return null;
+ if (src.toLowerCase().endsWith(".mp4")) {
+ return <VideoComponent filePath={src} className="my-2" />;
+ }
+ const imgSrc = src.startsWith("/") ? convertFileSrc(src) : src;
+ return (
+ <img
+ src={imgSrc}
+ alt={alt || ""}
+ className="max-w-full h-auto rounded-md my-2"
+ loading="lazy"
+ {...props}
+ />
+ );
+ },
pre({ children, ...props }) {
return (
<pre className="overflow-x-auto rounded-lg bg-neutral-900 dark:bg-neutral-950 p-3 my-2 text-xs max-w-full not-prose" {...props}>