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

feat(chat): render images from markdown ![alt](path) syntax

Louis Beaumont7130e5d8ef5b
diff --git a/apps/screenpipe-app-tauri/components/rewind/chat-message.tsx b/apps/screenpipe-app-tauri/components/rewind/chat-message.tsx
index 1bf536dae..f6e407fc6 100644
--- a/apps/screenpipe-app-tauri/components/rewind/chat-message.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/chat-message.tsx
@@ -18,6 +18,7 @@ import { ChatMessageActions } from "@/components/rewind/chat-message-actions";
import { useSettings } from "@/lib/hooks/use-settings";
import { VideoComponent } from "./video";
import { MermaidDiagram } from "./mermaid-diagram";
+import { convertFileSrc } from "@tauri-apps/api/core";
import { ChevronDown } from "lucide-react";
import { commands } from "@/lib/utils/tauri";
import { toast } from "@/components/ui/use-toast";
@@ -171,6 +172,22 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
p({ children }) {
return <p className="mb-2 last:mb-0">{children}</p>;
},
+ img({ src, alt, ...props }) {
+ if (!src) return null;
+ // Convert local file paths to Tauri asset URLs
+ 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}
+ />
+ );
+ },
a({ node, href, children, ...props }) {
const isMP4Link = href?.toLowerCase().includes(".mp4");