Spaces:
Running
Running
Z User
chore(biome): eliminate the organizeImports class repo-wide + close every remaining biome error
18afd52 Download api/admin-chatbot.ts from ahmdelbaz28/AHMDRTAP: direct link, hf CLI and curl.
- Browser
- Download file 973 Bytes
-
https://huggingface.co/spaces/ahmdelbaz28/AHMDRTAP/resolve/main/api/admin-chatbot.ts
- Command line
-
hf download hf://spaces/ahmdelbaz28/AHMDRTAP/api/admin-chatbot.ts
-
curl -L -o admin-chatbot.ts https://huggingface.co/spaces/ahmdelbaz28/AHMDRTAP/resolve/main/api/admin-chatbot.ts
973 Bytes
| /** | |
| * ADMIN CHATBOT — feedback review procedures (tRPC) | |
| * | |
| * chatbotFeedback — review feed + up/down stats for the admin "Chatbot" tab. | |
| * Worst conversations (👎) become test fixtures for the | |
| * next prompt iteration of the evolution loop. | |
| */ | |
| import { z } from "zod"; | |
| import { getChatbotFeedbackStats, listChatbotFeedback } from "./lib/chatbot-feedback.js"; | |
| import { adminQuery } from "./middleware"; | |
| export const adminChatbotProcedures = { | |
| chatbotFeedback: adminQuery | |
| .input( | |
| z.object({ | |
| limit: z.number().int().min(1).max(200).default(50), | |
| rating: z.enum(["up", "down", "all"]).default("all"), | |
| }) | |
| ) | |
| .query(async ({ input }) => { | |
| const [items, stats] = await Promise.all([ | |
| listChatbotFeedback({ limit: input.limit, rating: input.rating === "all" ? undefined : input.rating }), | |
| getChatbotFeedbackStats(), | |
| ]); | |
| return { items, stats }; | |
| }), | |
| }; | |