Address chat source annotation review nits

This commit is contained in:
Dhravya 2026-06-27 02:20:46 +00:00
parent 71577706ae
commit d84d674986
2 changed files with 11 additions and 9 deletions

View file

@ -303,12 +303,14 @@ function makeMarkdownComponents(
return {
a: ({ href, children }: { href?: string; children?: ReactNode }) => {
if (href?.startsWith("#sm-source:")) {
let sourceId = ""
try {
sourceId = decodeURIComponent(href.slice("#sm-source:".length))
} catch {
return <>{children}</>
}
const sourceId = (() => {
try {
return decodeURIComponent(href.slice("#sm-source:".length))
} catch {
return null
}
})()
if (!sourceId) return <>{children}</>
return (
<SourceCitationLink
sourceId={sourceId}

View file

@ -290,9 +290,9 @@ export async function fetchDocumentsByIds(
data?: { documents?: DocumentWithMemories[] } | null
}
if (result.error) {
throw new Error(
result.error.message ?? "Failed to fetch source documents",
)
throw new Error("Failed to fetch source documents", {
cause: result.error,
})
}
return result.data?.documents ?? []
}