Skip to content

Commit

Permalink
fix: allow removing item from queue if no labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dinmukhamedm committed Jan 6, 2025
1 parent 4db0162 commit b5d08f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const removeQueueItemSchema = z.object({
id: z.string()
}),
reasoning: z.string().optional().nullable()
})).nonempty(),
})),
action: z.null().or(z.object({
resultId: z.string().optional(),
datasetId: z.string().optional()
Expand Down Expand Up @@ -61,14 +61,16 @@ export async function POST(request: Request, { params }: { params: { projectId:
labelSource: "MANUAL" as const,
}));

const insertedLabels = await db.insert(labels).values(newLabels).onConflictDoUpdate({
target: [labels.spanId, labels.classId, labels.userId],
set: {
value: sql`excluded.value`,
labelSource: sql`excluded.label_source`,
reasoning: sql`COALESCE(excluded.reasoning, labels.reasoning)`,
}
}).returning();
const insertedLabels = newLabels.length > 0
? await db.insert(labels).values(newLabels).onConflictDoUpdate({
target: [labels.spanId, labels.classId, labels.userId],
set: {
value: sql`excluded.value`,
labelSource: sql`excluded.label_source`,
reasoning: sql`COALESCE(excluded.reasoning, labels.reasoning)`,
}
}).returning()
: [];

if (action?.resultId) {
const resultId = action.resultId;
Expand Down
2 changes: 0 additions & 2 deletions frontend/app/api/projects/[projectId]/queues/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export async function POST(
): Promise<Response> {
const projectId = params.projectId;



const body = await req.json();
const { name } = body;

Expand Down

0 comments on commit b5d08f7

Please sign in to comment.