"use client"; import { useTranslations } from "next-intl"; import { Badge } from "@/shared/components"; import type { RetrievePreviewResult } from "@/shared/schemas/memory"; interface Props { result: RetrievePreviewResult; } const TIER_VARIANT: Record = { fts5: "info", vector: "success", "hybrid-rrf": "warning", qdrant: "default", }; export default function RetrievePreview({ result }: Props) { const t = useTranslations("memory"); const { memories, resolution, totalTokensUsed, budgetMaxTokens } = result; return (
{/* Resolution panel */}

{t("playground.resolutionTitle")}

{t("playground.resolutionEmbedding")}:{" "} {resolution.embeddingModel ?? t("playground.none")}

{t("playground.resolutionStore")}:{" "} {resolution.vectorStore}

{t("playground.resolutionStrategy")}:{" "} {resolution.strategyUsed}

{resolution.rerankApplied && (

check {t("playground.rerankApplied")}

)} {resolution.fallbackReason && (

warning {t("playground.fallback")}: {resolution.fallbackReason}

)}
{/* Results list */} {memories.length === 0 ? (
{t("playground.noResults")}
) : (
{memories.map((m) => (
{m.tier} {m.key} score {m.score.toFixed(3)} {m.tokens} tok

{m.content}

{m.vecScore !== null && vec: {m.vecScore.toFixed(3)}} {m.ftsScore !== null && fts: {m.ftsScore.toFixed(3)}}
))}
)} {/* Footer budget */}
{totalTokensUsed.toLocaleString()} / {budgetMaxTokens.toLocaleString()}{" "} {t("playground.tokensUsed")}
); }