Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

improve evals pages organization

Abi Raja1b258fc9be49
diff --git a/frontend/src/components/evals/AllEvalsPage.tsx b/frontend/src/components/evals/AllEvalsPage.tsx
index 2384f9ae..835d718a 100644
--- a/frontend/src/components/evals/AllEvalsPage.tsx
+++ b/frontend/src/components/evals/AllEvalsPage.tsx
@@ -4,12 +4,20 @@ function AllEvalsPage() {
return (
<div className="flex flex-col items-center justify-center min-h-screen bg-gray-50">
<div className="max-w-md w-full space-y-8 p-8">
- <h1 className="text-3xl font-bold text-center text-gray-900">
- Evals Dashboard
- </h1>
+ <div className="flex justify-between items-center mb-4">
+ <h1 className="text-3xl font-bold text-gray-900">
+ Evals Dashboard
+ </h1>
+ <Link
+ to="/"
+ className="text-sm text-gray-500 hover:text-gray-700 flex items-center"
+ >
+ ← Back to app
+ </Link>
+ </div>
<div className="space-y-4">
<Link
- to="/run-evals"
+ to="/evals/run"
className="block w-full p-4 bg-white rounded-lg shadow hover:shadow-md transition-shadow border border-gray-200"
>
<h2 className="text-xl font-semibold text-gray-800">Run Evals</h2>
@@ -19,7 +27,7 @@ function AllEvalsPage() {
</Link>
<Link
- to="/pairwise-evals"
+ to="/evals/pairwise"
className="block w-full p-4 bg-white rounded-lg shadow hover:shadow-md transition-shadow border border-gray-200"
>
<h2 className="text-xl font-semibold text-gray-800">
@@ -31,7 +39,7 @@ function AllEvalsPage() {
</Link>
<Link
- to="/best-of-n-evals"
+ to="/evals/best-of-n"
className="block w-full p-4 bg-white rounded-lg shadow hover:shadow-md transition-shadow border border-gray-200"
>
<h2 className="text-xl font-semibold text-gray-800">Best of N</h2>
@@ -41,7 +49,7 @@ function AllEvalsPage() {
</Link>
<Link
- to="/evals"
+ to="/evals/single"
className="block w-full p-4 bg-white rounded-lg shadow hover:shadow-md transition-shadow border border-gray-200"
>
<h2 className="text-xl font-semibold text-gray-800">
diff --git a/frontend/src/components/evals/BestOfNEvalsPage.tsx b/frontend/src/components/evals/BestOfNEvalsPage.tsx
index ba413d08..9800a513 100644
--- a/frontend/src/components/evals/BestOfNEvalsPage.tsx
+++ b/frontend/src/components/evals/BestOfNEvalsPage.tsx
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import { HTTP_BACKEND_URL } from "../../config";
import { Dialog, DialogContent, DialogTrigger } from "../ui/dialog";
+import EvalNavigation from "./EvalNavigation";
interface Eval {
input: string;
@@ -103,6 +104,7 @@ function BestOfNEvalsPage() {
return (
<div className="mx-auto">
+ <EvalNavigation />
<div className="flex flex-col items-center justify-center w-full py-4 bg-zinc-950 text-white">
<div className="flex flex-col gap-4 mb-4 w-full max-w-2xl px-4">
{folderPaths.map((path, index) => (
diff --git a/frontend/src/components/evals/EvalNavigation.tsx b/frontend/src/components/evals/EvalNavigation.tsx
new file mode 100644
index 00000000..5e82d269
--- /dev/null
+++ b/frontend/src/components/evals/EvalNavigation.tsx
@@ -0,0 +1,55 @@
+import { Link } from "react-router-dom";
+
+function EvalNavigation() {
+ return (
+ <div className="flex justify-between items-center w-full py-3 px-4 bg-zinc-900 text-white">
+ <div className="flex items-center space-x-4">
+ <Link
+ to="/evals"
+ className="font-medium hover:text-blue-300 transition-colors"
+ >
+ Evals Home
+ </Link>
+
+ <div className="text-gray-500">|</div>
+
+ <Link
+ to="/evals/run"
+ className="hover:text-blue-300 transition-colors"
+ >
+ Run
+ </Link>
+
+ <Link
+ to="/evals/pairwise"
+ className="hover:text-blue-300 transition-colors"
+ >
+ Pairwise
+ </Link>
+
+ <Link
+ to="/evals/best-of-n"
+ className="hover:text-blue-300 transition-colors"
+ >
+ Best of N
+ </Link>
+
+ <Link
+ to="/evals/single"
+ className="hover:text-blue-300 transition-colors"
+ >
+ Single
+ </Link>
+ </div>
+
+ <Link
+ to="/"
+ className="text-sm text-gray-300 hover:text-white transition-colors"
+ >
+ ← Back to app
+ </Link>
+ </div>
+ );
+}
+
+export default EvalNavigation;
diff --git a/frontend/src/components/evals/EvalsPage.tsx b/frontend/src/components/evals/EvalsPage.tsx
index 7dba2095..f9c71b97 100644
--- a/frontend/src/components/evals/EvalsPage.tsx
+++ b/frontend/src/components/evals/EvalsPage.tsx
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import { HTTP_BACKEND_URL } from "../../config";
import RatingPicker from "./RatingPicker";
+import EvalNavigation from "./EvalNavigation";
interface Eval {
input: string;
@@ -133,6 +134,7 @@ function EvalsPage() {
return (
<div className="mx-auto">
+ <EvalNavigation />
<div className="flex flex-col items-center justify-center w-full py-4 bg-zinc-950 text-white">
<div className="flex flex-col gap-4 mb-4 w-full max-w-2xl px-4">
<input
diff --git a/frontend/src/components/evals/PairwiseEvalsPage.tsx b/frontend/src/components/evals/PairwiseEvalsPage.tsx
index ed841812..45b63d63 100644
--- a/frontend/src/components/evals/PairwiseEvalsPage.tsx
+++ b/frontend/src/components/evals/PairwiseEvalsPage.tsx
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import { HTTP_BACKEND_URL } from "../../config";
import { Dialog, DialogContent, DialogTrigger } from "../ui/dialog";
+import EvalNavigation from "./EvalNavigation";
interface Eval {
input: string;
@@ -88,6 +89,7 @@ function PairwiseEvalsPage() {
return (
<div className="mx-auto">
+ <EvalNavigation />
<div className="flex flex-col items-center justify-center w-full py-4 bg-zinc-950 text-white">
<div className="flex flex-col gap-4 mb-4 w-full max-w-2xl px-4">
<input
diff --git a/frontend/src/components/evals/RunEvalsPage.tsx b/frontend/src/components/evals/RunEvalsPage.tsx
index b54c4eb9..653a76b8 100644
--- a/frontend/src/components/evals/RunEvalsPage.tsx
+++ b/frontend/src/components/evals/RunEvalsPage.tsx
@@ -3,6 +3,7 @@ import { Button } from "../ui/button";
import { HTTP_BACKEND_URL } from "../../config";
import { BsCheckLg, BsChevronDown, BsChevronRight } from "react-icons/bs";
import InputFileSelector from "./InputFileSelector";
+import EvalNavigation from "./EvalNavigation";
interface ModelResponse {
models: string[];
@@ -98,153 +99,157 @@ function RunEvalsPage() {
const canRunEvals = selectedModels.length > 0 && selectedFiles.length > 0;
return (
- <div className="container mx-auto px-4 py-6">
- {/* Unified Header with Configuration Summary */}
- <div className="mb-6 bg-white rounded-lg border border-gray-200 shadow-sm p-4 max-w-5xl mx-auto">
- <div className="flex flex-col gap-4">
- <div className="flex flex-wrap justify-between items-center">
- <h1 className="text-2xl font-bold">Run Evaluations</h1>
-
- <Button
- onClick={runEvals}
- disabled={isRunning || !canRunEvals}
- className={`min-w-[120px] ${isRunning ? "bg-blue-400" : "bg-blue-600 hover:bg-blue-700"}`}
- >
- {isRunning ? "Running..." : "Run Evals"}
- </Button>
- </div>
-
- <div className="grid grid-cols-1 md:grid-cols-3 gap-3 border-t border-gray-100 pt-3">
- <div className="flex flex-col">
- <span className="text-sm font-medium text-gray-700">Models</span>
- <span className="text-sm text-gray-600 font-mono">{formatModelList()}</span>
+ <div>
+ <EvalNavigation />
+
+ <div className="container mx-auto px-4 py-6">
+ {/* Unified Header with Configuration Summary */}
+ <div className="mb-6 bg-white rounded-lg border border-gray-200 shadow-sm p-4 max-w-5xl mx-auto">
+ <div className="flex flex-col gap-4">
+ <div className="flex flex-wrap justify-between items-center">
+ <h1 className="text-2xl font-bold">Run Evaluations</h1>
+
+ <Button
+ onClick={runEvals}
+ disabled={isRunning || !canRunEvals}
+ className={`min-w-[120px] ${isRunning ? "bg-blue-400" : "bg-blue-600 hover:bg-blue-700"}`}
+ >
+ {isRunning ? "Running..." : "Run Evals"}
+ </Button>
</div>
- <div className="flex flex-col">
- <span className="text-sm font-medium text-gray-700">Stack</span>
- <span className="text-sm text-gray-600 font-mono">{selectedStack}</span>
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-3 border-t border-gray-100 pt-3">
+ <div className="flex flex-col">
+ <span className="text-sm font-medium text-gray-700">Models</span>
+ <span className="text-sm text-gray-600 font-mono">{formatModelList()}</span>
+ </div>
+
+ <div className="flex flex-col">
+ <span className="text-sm font-medium text-gray-700">Stack</span>
+ <span className="text-sm text-gray-600 font-mono">{selectedStack}</span>
+ </div>
+
+ <div className="flex flex-col">
+ <span className="text-sm font-medium text-gray-700">Input Files</span>
+ <span className="text-sm text-gray-600">{selectedFiles.length} selected</span>
+ </div>
</div>
- <div className="flex flex-col">
- <span className="text-sm font-medium text-gray-700">Input Files</span>
- <span className="text-sm text-gray-600">{selectedFiles.length} selected</span>
+ <div
+ className="flex items-center gap-1 text-xs text-gray-600 cursor-pointer mt-1 hover:bg-gray-50 inline-block rounded px-2 py-1"
+ onClick={() => setShowPaths(!showPaths)}
+ >
+ {showPaths ? <BsChevronDown size={12} /> : <BsChevronRight size={12} />}
+ <span className="font-medium">Paths</span>
</div>
- </div>
-
- <div
- className="flex items-center gap-1 text-xs text-gray-600 cursor-pointer mt-1 hover:bg-gray-50 inline-block rounded px-2 py-1"
- onClick={() => setShowPaths(!showPaths)}
- >
- {showPaths ? <BsChevronDown size={12} /> : <BsChevronRight size={12} />}
- <span className="font-medium">Paths</span>
- </div>
-
- {showPaths && (
- <div className="grid grid-cols-1 md:grid-cols-2 gap-3 text-xs text-gray-600 mt-2 bg-gray-50 p-2 rounded-md">
- <div>
- <span className="font-medium">Input path:</span>
- <code className="ml-2 bg-gray-100 px-2 py-0.5 rounded">
- backend/evals_data/inputs
- </code>
- </div>
- <div>
- <span className="font-medium">Output path:</span>
- <code className="ml-2 bg-gray-100 px-2 py-0.5 rounded">
- backend/evals_data/outputs
- </code>
+
+ {showPaths && (
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-3 text-xs text-gray-600 mt-2 bg-gray-50 p-2 rounded-md">
+ <div>
+ <span className="font-medium">Input path:</span>
+ <code className="ml-2 bg-gray-100 px-2 py-0.5 rounded">
+ backend/evals_data/inputs
+ </code>
+ </div>
+ <div>
+ <span className="font-medium">Output path:</span>
+ <code className="ml-2 bg-gray-100 px-2 py-0.5 rounded">
+ backend/evals_data/outputs
+ </code>
+ </div>
</div>
- </div>
- )}
+ )}
+ </div>
</div>
- </div>
- {/* Selection Controls */}
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-5xl mx-auto">
- {/* Model Selection Section */}
- <div className="bg-white rounded-lg border border-gray-200 shadow-sm">
- <div className="border-b border-gray-200 px-4 py-3 bg-gray-50 rounded-t-lg">
- <h2 className="font-medium">Select Models</h2>
- </div>
- <div className="p-3">
- <div className="border rounded-md max-h-[300px] overflow-y-auto">
- <div className="grid grid-cols-1 divide-y divide-gray-100">
- {models.map((model) => (
- <div
- key={model}
- className={`flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-gray-50 ${
- selectedModels.includes(model)
- ? "bg-blue-50"
- : ""
- }`}
- onClick={() => handleModelToggle(model)}
- >
- <span className="text-sm truncate" title={model}>{model}</span>
- {selectedModels.includes(model) ? (
- <BsCheckLg className="h-3.5 w-3.5 text-blue-500 flex-shrink-0" />
- ) : (
- <div className="h-3.5 w-3.5 border rounded-sm flex-shrink-0" />
- )}
- </div>
- ))}
- </div>
+ {/* Selection Controls */}
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-5xl mx-auto">
+ {/* Model Selection Section */}
+ <div className="bg-white rounded-lg border border-gray-200 shadow-sm">
+ <div className="border-b border-gray-200 px-4 py-3 bg-gray-50 rounded-t-lg">
+ <h2 className="font-medium">Select Models</h2>
</div>
- <div className="flex justify-between mt-2 text-xs">
- <p className="text-gray-500">
- Selected: {selectedModels.length} / {models.length}
- </p>
- <div className="space-x-2">
- {selectedModels.length < models.length && (
- <Button
- variant="ghost"
- size="sm"
- onClick={handleSelectAll}
- className="text-xs h-6 px-2 text-gray-500 hover:text-gray-700"
- >
- Select all
- </Button>
- )}
- {selectedModels.length > 0 && (
- <Button
- variant="ghost"
- size="sm"
- onClick={() => setSelectedModels([])}
- className="text-xs h-6 px-2 text-gray-500 hover:text-gray-700"
- >
- Clear
- </Button>
- )}
+ <div className="p-3">
+ <div className="border rounded-md max-h-[300px] overflow-y-auto">
+ <div className="grid grid-cols-1 divide-y divide-gray-100">
+ {models.map((model) => (
+ <div
+ key={model}
+ className={`flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-gray-50 ${
+ selectedModels.includes(model)
+ ? "bg-blue-50"
+ : ""
+ }`}
+ onClick={() => handleModelToggle(model)}
+ >
+ <span className="text-sm truncate" title={model}>{model}</span>
+ {selectedModels.includes(model) ? (
+ <BsCheckLg className="h-3.5 w-3.5 text-blue-500 flex-shrink-0" />
+ ) : (
+ <div className="h-3.5 w-3.5 border rounded-sm flex-shrink-0" />
+ )}
+ </div>
+ ))}
+ </div>
+ </div>
+ <div className="flex justify-between mt-2 text-xs">
+ <p className="text-gray-500">
+ Selected: {selectedModels.length} / {models.length}
+ </p>
+ <div className="space-x-2">
+ {selectedModels.length < models.length && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={handleSelectAll}
+ className="text-xs h-6 px-2 text-gray-500 hover:text-gray-700"
+ >
+ Select all
+ </Button>
+ )}
+ {selectedModels.length > 0 && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => setSelectedModels([])}
+ className="text-xs h-6 px-2 text-gray-500 hover:text-gray-700"
+ >
+ Clear
+ </Button>
+ )}
+ </div>
</div>
</div>
</div>
- </div>
- {/* Stack Selection Section */}
- <div className="bg-white rounded-lg border border-gray-200 shadow-sm">
- <div className="border-b border-gray-200 px-4 py-3 bg-gray-50 rounded-t-lg">
- <h2 className="font-medium">Select Stack</h2>
- </div>
- <div className="p-3">
- <select
- value={selectedStack}
- onChange={(e) => setSelectedStack(e.target.value)}
- className="w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
- >
- {stacks.map((stack) => (
- <option key={stack} value={stack}>
- {stack}
- </option>
- ))}
- </select>
+ {/* Stack Selection Section */}
+ <div className="bg-white rounded-lg border border-gray-200 shadow-sm">
+ <div className="border-b border-gray-200 px-4 py-3 bg-gray-50 rounded-t-lg">
+ <h2 className="font-medium">Select Stack</h2>
+ </div>
+ <div className="p-3">
+ <select
+ value={selectedStack}
+ onChange={(e) => setSelectedStack(e.target.value)}
+ className="w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
+ >
+ {stacks.map((stack) => (
+ <option key={stack} value={stack}>
+ {stack}
+ </option>
+ ))}
+ </select>
+ </div>
</div>
- </div>
- {/* Input Files Section */}
- <div className="bg-white rounded-lg border border-gray-200 shadow-sm lg:col-span-1 md:col-span-2">
- <div className="border-b border-gray-200 px-4 py-3 bg-gray-50 rounded-t-lg">
- <h2 className="font-medium">Select Input Files</h2>
- </div>
- <div className="p-3">
- <InputFileSelector onFilesSelected={handleFilesSelected} />
+ {/* Input Files Section */}
+ <div className="bg-white rounded-lg border border-gray-200 shadow-sm lg:col-span-1 md:col-span-2">
+ <div className="border-b border-gray-200 px-4 py-3 bg-gray-50 rounded-t-lg">
+ <h2 className="font-medium">Select Input Files</h2>
+ </div>
+ <div className="p-3">
+ <InputFileSelector onFilesSelected={handleFilesSelected} />
+ </div>
</div>
</div>
</div>
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx
index 006495cd..0df92c9a 100644
--- a/frontend/src/main.tsx
+++ b/frontend/src/main.tsx
@@ -15,11 +15,11 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<Router>
<Routes>
<Route path="/" element={<App />} />
- <Route path="/all-evals" element={<AllEvalsPage />} />
- <Route path="/evals" element={<EvalsPage />} />
- <Route path="/pairwise-evals" element={<PairwiseEvalsPage />} />
- <Route path="/best-of-n-evals" element={<BestOfNEvalsPage />} />
- <Route path="/run-evals" element={<RunEvalsPage />} />
+ <Route path="/evals" element={<AllEvalsPage />} />
+ <Route path="/evals/single" element={<EvalsPage />} />
+ <Route path="/evals/pairwise" element={<PairwiseEvalsPage />} />
+ <Route path="/evals/best-of-n" element={<BestOfNEvalsPage />} />
+ <Route path="/evals/run" element={<RunEvalsPage />} />
</Routes>
</Router>
<Toaster toastOptions={{ className: "dark:bg-zinc-950 dark:text-white" }} />