feat: add onboarding and calibration features to experiments, including UI updates and database schema changes

This commit is contained in:
averel10
2026-04-02 08:21:15 +02:00
parent 4c40e6a24d
commit 7490b59731
11 changed files with 1088 additions and 7 deletions

View File

@@ -14,13 +14,17 @@ export async function createExperiment({
description,
datasetId,
annotationTool,
published = false
published = false,
onboardingEnabled = false,
calibrationEnabled = false
}: {
name: string;
description?: string;
datasetId: number;
annotationTool?: string;
published?: boolean;
onboardingEnabled?: boolean;
calibrationEnabled?: boolean;
}) {
const result = await requireAdmin();
if (!result.authenticated || !result.admin) {
@@ -38,6 +42,8 @@ export async function createExperiment({
datasetId,
annotationTool: annotationTool?.trim(),
published,
onboardingEnabled,
calibrationEnabled,
});
revalidatePath('/admin/experiments');
return result;
@@ -49,7 +55,7 @@ export async function createExperiment({
export async function updateExperiment(
id: number,
updates: { name?: string; description?: string, annotationTool?: string, published?: boolean }
updates: { name?: string; description?: string, annotationTool?: string, published?: boolean, onboardingEnabled?: boolean, calibrationEnabled?: boolean }
) {
const result = await requireAdmin();
if (!result.authenticated || !result.admin) {
@@ -74,6 +80,12 @@ export async function updateExperiment(
if (updates.published !== undefined) {
updateData.published = updates.published;
}
if (updates.onboardingEnabled !== undefined) {
updateData.onboardingEnabled = updates.onboardingEnabled;
}
if (updates.calibrationEnabled !== undefined) {
updateData.calibrationEnabled = updates.calibrationEnabled;
}
updateData.updatedAt = new Date();
const result = await db