diff --git a/app/(main)/assessment/page.tsx b/app/(main)/assessment/page.tsx index ad9e8b08..239e85a8 100644 --- a/app/(main)/assessment/page.tsx +++ b/app/(main)/assessment/page.tsx @@ -168,12 +168,11 @@ function PageContent() { showToastError("Dataset is required"); return; } - if (columnMapping.textColumns.length === 0) { - showToastError("Map at least one text column"); - return; - } - if (!promptTemplate.trim()) { - showToastError("Prompt is required"); + if ( + columnMapping.textColumns.length === 0 && + columnMapping.attachments.length === 0 + ) { + showToastError("Map at least one text or attachment column"); return; } if (!outputSchema.some((field) => field.name.trim())) { @@ -271,17 +270,16 @@ function PageContent() { }; const hasDataset = !!datasetId && columns.length > 0; - const hasMapperSelection = columnMapping.textColumns.length > 0; - const hasPromptTemplate = promptTemplate.trim().length > 0; + const hasMapperSelection = + columnMapping.textColumns.length > 0 || + columnMapping.attachments.length > 0; const hasConfiguredResponseFormat = outputSchema.some((field) => field.name.trim(), ); - const canReachReview = - hasPromptTemplate && configs.length > 0 && hasConfiguredResponseFormat; + const canReachReview = configs.length > 0 && hasConfiguredResponseFormat; const canSubmitAssessment = !!datasetId && hasMapperSelection && - hasPromptTemplate && hasConfiguredResponseFormat && configs.length > 0 && experimentName.trim().length > 0 && @@ -289,16 +287,14 @@ function PageContent() { const submitBlockerMessage = !datasetId ? "Select a dataset to submit" : !hasMapperSelection - ? "Map at least one text column to submit" - : !hasPromptTemplate - ? "Write a prompt to submit" - : !hasConfiguredResponseFormat - ? "Set response format to submit" - : configs.length === 0 - ? "Select at least one configuration to submit" - : !experimentName.trim() - ? "Enter an experiment name to submit" - : ""; + ? "Map at least one text or attachment column to submit" + : !hasConfiguredResponseFormat + ? "Set response format to submit" + : configs.length === 0 + ? "Select at least one configuration to submit" + : !experimentName.trim() + ? "Enter an experiment name to submit" + : ""; const effectiveCompletedConfigSteps = useMemo(() => { const merged = new Set(completedConfigSteps); if (hasMapperSelection) merged.add(1); diff --git a/app/api/assessment/runs/[run_id]/post-processing/route.ts b/app/api/assessment/runs/[run_id]/post-processing/route.ts new file mode 100644 index 00000000..3b24ec4e --- /dev/null +++ b/app/api/assessment/runs/[run_id]/post-processing/route.ts @@ -0,0 +1,27 @@ +// BFF proxy — PATCH /api/v1/assessment/runs/:id/post-processing +import { NextRequest } from "next/server"; +import { proxyErrorResponse, proxyJsonResponse } from "@/app/api/_routeProxy"; +import type { RouteContext } from "@/app/lib/types/assessment"; + +export async function PATCH( + request: NextRequest, + context: RouteContext<"run_id">, +) { + try { + const { run_id } = await context.params; + const body = await request.json(); + return await proxyJsonResponse( + request, + `/api/v1/assessment/runs/${run_id}/post-processing`, + { + method: "PATCH", + body: JSON.stringify(body), + }, + ); + } catch (error: unknown) { + return proxyErrorResponse( + "Assessment run post-processing proxy error:", + error, + ); + } +} diff --git a/app/components/assessment/ColumnMapperStep.tsx b/app/components/assessment/ColumnMapperStep.tsx index fbb59118..80623f2d 100644 --- a/app/components/assessment/ColumnMapperStep.tsx +++ b/app/components/assessment/ColumnMapperStep.tsx @@ -137,7 +137,9 @@ export default function ColumnMapperStep({ const mappedCount = columnConfigs.filter( (config) => config.role !== "unmapped", ).length; - const hasText = columnConfigs.some((config) => config.role === "text"); + const hasMappedColumn = columnConfigs.some( + (config) => config.role === "text" || config.role === "attachment", + ); return (
@@ -383,17 +385,17 @@ export default function ColumnMapperStep({
- {hasText + {hasMappedColumn ? "Ready to continue." - : "Select at least one Text column."} + : "Map at least one Text or Attachment column."}