mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-07 02:58:11 +00:00
Address chat source annotation review nits
This commit is contained in:
parent
71577706ae
commit
d84d674986
2 changed files with 11 additions and 9 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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 ?? []
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue