Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

866 B
Raw Blame
import { createAuthedProjectAPIRoute } from "@/src/features/public-api/server/createAuthedProjectAPIRoute";
import { withMiddlewares } from "@/src/features/public-api/server/withMiddlewares";
import { submitFeedback } from "@/src/features/feedback/server/FeedbackService";
import {
  PostFeedbackBody,
  PostFeedbackResponse,
} from "@/src/features/public-api/types/feedback";

export default withMiddlewares({
  POST: createAuthedProjectAPIRoute({
    name: "Submit Feedback",
    action: "feedback:create",
    bodySchema: PostFeedbackBody,
    responseSchema: PostFeedbackResponse,
    successStatusCode: 201,
    fn: async ({ body, auth }) =>
      await submitFeedback({
        input: body,
        scope: auth.scope,
        source: "public-api",
      }),
  }),
});

export const config = {
  api: {
    bodyParser: {
      sizeLimit: "16kb",
    },
  },
};