Components / Prompt Builders
Prompt Test Bench
A split-panel interface for testing AI prompts with real-time input and simulated output comparison.
Components / Prompt Builders
A split-panel interface for testing AI prompts with real-time input and simulated output comparison.
GPT-4o
Correct JSON format detected.
Llama-3
Minor hallucination in field 'date'.
Claude 3.5
Perfect alignment with system prompt.
Install the core libraries required for this component.
npm install react lucide-react"use client";
import React, { useState } from "react";
import { Play, RotateCcw, CheckCircle, AlertTriangle, Clock } from "lucide-react";
export default function PromptTestBench() {
const [isRunning, setIsRunning] = useState(false);
return (
<div className="rounded-xl border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-6 shadow-sm w-full max-w-xl mx-auto">
<div className="flex items-center justify-between mb-8">
<h3 className="text-sm font-bold text-zinc-900 dark:text-zinc-100 uppercase tracking-widest flex items-center gap-2">
<Play className="h-4 w-4 text-blue-500 fill-current" />
Prompt Test Bench
</h3>
<div className="flex gap-2">
<button onClick={() => setIsRunning(true)} className="px-4 py-1.5 rounded-lg bg-blue-600 text-white text-[10px] font-bold hover:bg-blue-700 transition-all">
RUN TEST
</button>
<button className="p-1.5 rounded-lg border border-zinc-200 dark:border-zinc-800 hover:bg-zinc-50 transition-colors text-zinc-500">
<RotateCcw className="h-4 w-4" />
</button>
</div>
</div>
<div className="space-y-4">
{[
{ model: "GPT-4o", status: "passed", time: "1.2s", result: "Correct JSON format detected." },
{ model: "Llama-3", status: "warning", time: "0.8s", result: "Minor hallucination in field 'date'." },
{ model: "Claude 3.5", status: "passed", time: "1.5s", result: "Perfect alignment with system prompt." },
].map((t) => (
<div key={t.model} className="p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 bg-zinc-50/50 dark:bg-zinc-900/50 flex items-start justify-between group">
<div className="flex gap-3">
<div className="mt-0.5">
{t.status === "passed" ? <CheckCircle className="h-4 w-4 text-emerald-500" /> : <AlertTriangle className="h-4 w-4 text-amber-500" />}
</div>
<div>
<p className="text-xs font-bold text-zinc-900 dark:text-zinc-100">{t.model}</p>
<p className="text-[11px] text-zinc-500 mt-1">{t.result}</p>
</div>
</div>
<div className="text-right">
<div className="flex items-center gap-1.5 text-[10px] text-zinc-400 font-bold mb-1">
<Clock className="h-3 w-3" />
{t.time}
</div>
<span className={`text-[9px] font-black uppercase tracking-widest ${t.status === "passed" ? "text-emerald-500" : "text-amber-500"}`}>
{t.status.toUpperCase()}
</span>
</div>
</div>
))}
</div>
</div>
);
} "use client";
import React, { useState } from "react";
import { Play, RotateCcw, CheckCircle, AlertTriangle, Clock } from "lucide-react";
export default function PromptTestBench() {
const [isRunning, setIsRunning] = useState(false);
return (
<div className="rounded-xl border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-6 shadow-sm w-full max-w-xl mx-auto">
<div className="flex items-center justify-between mb-8">
<h3 className="text-sm font-bold text-zinc-900 dark:text-zinc-100 uppercase tracking-widest flex items-center gap-2">
<Play className="h-4 w-4 text-blue-500 fill-current" />
Prompt Test Bench
</h3>
<div className="flex gap-2">
<button onClick={() => setIsRunning(true)} className="px-4 py-1.5 rounded-lg bg-blue-600 text-white text-[10px] font-bold hover:bg-blue-700 transition-all">
RUN TEST
</button>
<button className="p-1.5 rounded-lg border border-zinc-200 dark:border-zinc-800 hover:bg-zinc-50 transition-colors text-zinc-500">
<RotateCcw className="h-4 w-4" />
</button>
</div>
</div>
<div className="space-y-4">
{[
{ model: "GPT-4o", status: "passed", time: "1.2s", result: "Correct JSON format detected." },
{ model: "Llama-3", status: "warning", time: "0.8s", result: "Minor hallucination in field 'date'." },
{ model: "Claude 3.5", status: "passed", time: "1.5s", result: "Perfect alignment with system prompt." },
].map((t) => (
<div key={t.model} className="p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 bg-zinc-50/50 dark:bg-zinc-900/50 flex items-start justify-between group">
<div className="flex gap-3">
<div className="mt-0.5">
{t.status === "passed" ? <CheckCircle className="h-4 w-4 text-emerald-500" /> : <AlertTriangle className="h-4 w-4 text-amber-500" />}
</div>
<div>
<p className="text-xs font-bold text-zinc-900 dark:text-zinc-100">{t.model}</p>
<p className="text-[11px] text-zinc-500 mt-1">{t.result}</p>
</div>
</div>
<div className="text-right">
<div className="flex items-center gap-1.5 text-[10px] text-zinc-400 font-bold mb-1">
<Clock className="h-3 w-3" />
{t.time}
</div>
<span className={`text-[9px] font-black uppercase tracking-widest ${t.status === "passed" ? "text-emerald-500" : "text-amber-500"}`}>
{t.status.toUpperCase()}
</span>
</div>
</div>
))}
</div>
</div>
);
} Internal functions used to handle component logic.
| Function | Parameters |
|---|---|
| PromptTestBench() | None |
React state variables managed within this component.
| Variable | Initial Value |
|---|---|
| isRunning | false |
Every JSX/HTML tag used in this component, with usage count and source.
| Tag | Count | Type | Source |
|---|---|---|---|
| <AlertTriangle> | 1× | | lucide-react |
| <CheckCircle> | 1× | | lucide-react |
| <Clock> | 1× | | lucide-react |
| <Play> | 1× | | lucide-react |
| <RotateCcw> | 1× | | lucide-react |
| <button> | 2× | | Native HTML |
| <div> | 10× | | Native HTML |
| <h3> | 1× | | Native HTML |
| <p> | 2× | | Native HTML |
| <span> | 1× | | Native HTML |