"use client"; import Link from "next/link"; import { useI18n } from "@/i18n/i18n-context"; import type { MemorySearchHit } from "@/types/memory"; export interface MemoryEvidenceScope { appId: string; tenantId: string; agentId: string; runId: string; } interface MemoryEvidenceContentProps { hits: MemorySearchHit[]; memoryStoreName?: string; scope?: MemoryEvidenceScope; } function fileWorkspaceHref( memoryStoreName: string, scope: MemoryEvidenceScope, path: string, ): string { const query = new URLSearchParams({ ...scope, view: "files", file: path }); return `/memory/${encodeURIComponent(memoryStoreName)}/units?${query.toString()}`; } export function MemoryEvidenceContent({ hits, memoryStoreName, scope, }: MemoryEvidenceContentProps) { return (
{hits.map((hit, index) => ( ))}
); } function MemoryHitCard({ hit, index, memoryStoreName, scope, }: { hit: MemorySearchHit; index: number; memoryStoreName?: string; scope?: MemoryEvidenceScope; }) { const { t } = useI18n(); const id = hit.unit.memcell_id; const score = typeof hit.score === "number" ? hit.score : undefined; return (
{index} {id ? ( {id} ) : ( {t("qa.memory.unnamedMemory")} )} {hit.source && memoryStoreName && scope ? ( {hit.source} ) : hit.source ? ( {hit.source} ) : null} {score !== undefined ? score.toFixed(4) : "—"}

{hit.unit.text}

); }