enhance assistant batch responses

This commit is contained in:
ajnart committed 2026-08-13 19:56:32 +02:00
1 parent 6cf34af845
commit 83355510c0
10 files changed
+207 -38

No files matched your search

@@ -0,0 +1,12 @@
export const getSafeAssistantMarkdownImageSource = (source: string | Blob | undefined) => {
if (typeof source !== "string" || !source) return null;
if (source.startsWith("/") && !source.startsWith("//")) return source;
try {
const url = new URL(source);
if ((url.protocol !== "http:" && url.protocol !== "https:") || url.username || url.password) return null;
return url.toString();
} catch {
return null;
}
};