const ValidationIndicator = ({ status }) => {
const styles = {
valid: "text-green-600",
partial: "text-yellow-600",
invalid: "text-red-600",
};
const labels = {
valid: "✅ Validation passed",
partial: "⚠️ Partial validation",
invalid: "❌ Validation failed",
};
return (
{labels[status] || status}
);
};
const validationIcons = {
valid: "✅",
partial: "⚠️",
invalid: "❌",
};
export default function DiagnosticsView({ result }) {
if (!result) return null;
const metrics = [
{ label: "Model", value: result.modelName || "?" },
{ label: "Provider", value: "Ollama" },
{ label: "Prompt version", value: result.promptVersion || "?" },
{
label: "Duration",
value:
result.responseDurationMs != null
? `${result.responseDurationMs}ms`
: "?",
},
{
label: "Validation",
value: (
),
},
];
return (
Diagnostics
{metrics.map(({ label, value }) => (
- {label}
- {value}
))}
{/* Collapsed raw output for debugging */}
{result.rawResponse && (
View raw model response (
{(result.rawResponse?.length || 0).toLocaleString()} chars)
{result.rawResponse}
)}
{/* Errors if present */}
{result.errors && result.errors.length > 0 && (
Validation errors ({result.errors.length})
{result.errors.map((err, i) => (
- {err}
))}
)}
);
}