Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions app/(main)/assessment/AssessmentWorkspace.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use client";

// Shared body for every /assessment sub-route. The route decides which tab is
// active via `initialTab`; the page shell for each route just renders this.
import { Suspense } from "react";
import { Loader } from "@/app/components/ui";
import PageLayout from "@/app/components/assessment/PageLayout";
import { useAssessmentWorkflow } from "@/app/hooks/useAssessmentWorkflow";
import type { AssessmentTabId } from "@/app/lib/types/assessment";

function WorkspaceContent({ initialTab }: { initialTab: AssessmentTabId }) {
const layoutProps = useAssessmentWorkflow(initialTab);
return <PageLayout {...layoutProps} />;
}

export default function AssessmentWorkspace({
initialTab = "datasets",
}: {
initialTab?: AssessmentTabId;
}) {
return (
<Suspense fallback={<Loader size="lg" message="Loading..." fullScreen />}>
<WorkspaceContent initialTab={initialTab} />
</Suspense>
);
}
14 changes: 14 additions & 0 deletions app/(main)/assessment/[tab]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use client";

import { notFound, useParams } from "next/navigation";
import { ASSESSMENT_ROUTE_SEGMENT_TO_TAB } from "@/app/lib/assessment/constants";
import AssessmentWorkspace from "../AssessmentWorkspace";

// Sub-routes /assessment/config | /assessment/experiment | /assessment/runs.
// Datasets lives at the base /assessment route.
export default function AssessmentTabPage() {
const params = useParams<{ tab: string }>();
const tab = ASSESSMENT_ROUTE_SEGMENT_TO_TAB[params?.tab ?? ""];
if (!tab) notFound();
return <AssessmentWorkspace initialTab={tab} />;
}
18 changes: 2 additions & 16 deletions app/(main)/assessment/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
"use client";

import { Suspense } from "react";
import { Loader } from "@/app/components/ui";
import PageLayout from "@/app/components/assessment/PageLayout";
import { useAssessmentWorkflow } from "@/app/hooks/useAssessmentWorkflow";

function PageContent() {
const layoutProps = useAssessmentWorkflow();
return <PageLayout {...layoutProps} />;
}
import AssessmentWorkspace from "./AssessmentWorkspace";

export default function Page() {
return (
<Suspense fallback={<Loader size="lg" message="Loading..." fullScreen />}>
<PageContent />
</Suspense>
);
return <AssessmentWorkspace initialTab="datasets" />;
}
18 changes: 18 additions & 0 deletions app/api/assessment/datasets/[dataset_id]/rows/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NextRequest } from "next/server";
import { proxyErrorResponse, proxyJsonResponse } from "@/app/api/_routeProxy";

export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ dataset_id: string }> },
) {
try {
const { dataset_id } = await params;
return await proxyJsonResponse(
request,
`/api/v1/assessment/datasets/${dataset_id}/rows`,
{ method: "GET" },
);
} catch (error: unknown) {
return proxyErrorResponse("Assessment dataset rows proxy error:", error);
}
}
1 change: 1 addition & 0 deletions app/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function Sidebar({
const [expandedMenus, setExpandedMenus] = useState<Record<string, boolean>>({
Evaluations: true,
Configurations: false,
Assessment: true,
});
const [showLoginModal, setShowLoginModal] = useState(false);
const [showUserMenu, setShowUserMenu] = useState(false);
Expand Down
15 changes: 15 additions & 0 deletions app/components/assessment/AssessmentChildRunCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ export default function AssessmentChildRunCard({
</div>
)}

{childRun.cost && (
<div className="mt-1.5 text-xs text-text-secondary">
Cost:{" "}
<span className="font-medium text-text-primary">
${childRun.cost.total.toFixed(4)}
</span>
{childRun.cost.pre_filter && (
<span className="ml-1">
· assessment ${childRun.cost.assessment.toFixed(4)} ·
pre-filter ${childRun.cost.pre_filter.total.toFixed(4)}
</span>
)}
</div>
)}

<ChildRunStageProgress stages={stageProgress} />

{configError && (
Expand Down
Loading
Loading