mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-13 00:50:06 +08:00
2a8d38f058
Fix set_label id missing in payload use frontend_message_id pre-commit Refactor api fetcher/poster to axios create lint Remove string literal for path Revert oasst_api_client.ts Fix warning httpStatusCode OasstError optional parameter Refactor remove api base url for local api Lint add blank line
23 lines
732 B
TypeScript
23 lines
732 B
TypeScript
import { Prisma } from "@prisma/client";
|
|
import { withoutRole } from "src/lib/auth";
|
|
import { oasstApiClient } from "src/lib/oasst_api_client";
|
|
import prisma from "src/lib/prismadb";
|
|
|
|
const handler = withoutRole("banned", async (req, res) => {
|
|
// Parse out the local task ID and the interaction contents.
|
|
const { id: frontendId, reason } = req.body;
|
|
|
|
const registeredTask = await prisma.registeredTask.findUniqueOrThrow({ where: { id: frontendId } });
|
|
|
|
const task = registeredTask.task as Prisma.JsonObject;
|
|
const id = task.id as string;
|
|
|
|
// Update the backend with the rejection
|
|
await oasstApiClient.nackTask(id, reason);
|
|
|
|
// Send the results to the client.
|
|
res.status(200).json({});
|
|
});
|
|
|
|
export default handler;
|