mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-26 17:02:32 +00:00
<h3>Implement comprehensive plugin document rendering support including MCP previews and plugin specific content handling.</h3> <br> <br> <img width="1680" height="471" alt="Screenshot 2026-05-12 at 8 24 49 PM" src="https://github.com/user-attachments/assets/f1294bc2-2841-4833-9f01-ac47b8c52c01" /> <br> <br> <img width="1680" height="963" alt="Screenshot 2026-05-12 at 8 28 25 PM" src="https://github.com/user-attachments/assets/9436c7ab-3b9b-4366-86fd-1465407ff0f9" />
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
"use client"
|
|
|
|
import type { DocumentsWithMemoriesResponseSchema } from "@repo/validation/api"
|
|
import type { z } from "zod"
|
|
import { dmSansClassName } from "@/lib/fonts"
|
|
import { cn } from "@lib/utils"
|
|
import { ClaudeDesktopIcon, MCPIcon } from "@ui/assets/icons"
|
|
import type { ParsedPluginDocument } from "@/lib/plugin-document"
|
|
import { PluginPreview } from "./plugin-preview"
|
|
|
|
type DocumentsResponse = z.infer<typeof DocumentsWithMemoriesResponseSchema>
|
|
type DocumentWithMemories = DocumentsResponse["documents"][0]
|
|
|
|
export function McpPreview({
|
|
document,
|
|
parsed,
|
|
}: {
|
|
document: DocumentWithMemories
|
|
parsed?: ParsedPluginDocument | null
|
|
}) {
|
|
if (parsed) {
|
|
return <PluginPreview parsed={parsed} />
|
|
}
|
|
const clientName =
|
|
typeof document.metadata?.sm_internal_mcp_client_name === "string"
|
|
? document.metadata.sm_internal_mcp_client_name
|
|
.replace(/[_-]+/g, " ")
|
|
.replace(/\b\w/g, (match) => match.toUpperCase())
|
|
: "MCP Client"
|
|
|
|
return (
|
|
<div className="bg-[#0B1017] p-3 rounded-[18px] space-y-2">
|
|
<div className="flex items-center justify-between gap-1">
|
|
<p
|
|
className={cn(
|
|
dmSansClassName(),
|
|
"text-[13px] font-semibold flex items-center gap-1",
|
|
)}
|
|
>
|
|
<ClaudeDesktopIcon className="size-3" />
|
|
{clientName}
|
|
</p>
|
|
<MCPIcon className="size-6" />
|
|
</div>
|
|
<div className="space-y-[6px]">
|
|
{document.title && (
|
|
<p className={cn(dmSansClassName(), "text-[13px] font-semibold")}>
|
|
{document.title}
|
|
</p>
|
|
)}
|
|
{document.content && (
|
|
<p className="text-[11px] text-[#737373] line-clamp-4">
|
|
{document.content}
|
|
</p>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|