import React from 'react'; import { Badge, Button } from "../common/index"; export default function ConfigCard({ config, onAdd, isStaged, disabled }) { const chunkParamEntries = Object.entries(config.chunk_params || {}).slice(0, 3); const status = config.indexingStatus || "idle"; const statusLabel = status === "indexing" ? "Indexing..." : status === "ready" ? "Ready ✅" : status === "already_exists" ? "Already indexed ✅" : status === "error" ? "Index failed" : "Not indexed"; const statusColor = status === "indexing" ? "orange" : status === "ready" || status === "already_exists" ? "green" : status === "error" ? "red" : "gray"; const canAdd = !disabled && !isStaged && status !== "indexing"; return (

{config.name}

top_k: {config.top_k} threshold: {Number(config.threshold).toFixed(2)} {config.chunk_strategy} {config.embedding_model} {chunkParamEntries.map(([key, value]) => ( {key}: {Array.isArray(value) ? `[${value.length}]` : String(value)} ))} {statusLabel}

{config.isPreset ? "Preset configuration" : "Custom configuration"}

); }