feat: allow user-configurable AI model selection with server-side validation

This commit is contained in:
2025-09-10 20:10:48 -03:00
parent 86f511cd8e
commit f4e996d753
10 changed files with 251 additions and 9 deletions

View File

@@ -1,13 +1,21 @@
import { protectedProcedure, publicProcedure, router } from "../lib/trpc";
import { ALLOWED_MODELS, DEFAULT_MODEL } from "../lib/ai-models";
export const appRouter = router({
healthCheck: publicProcedure.query(() => {
return "OK";
}),
allowedModels: publicProcedure.query(() => {
return {
models: ALLOWED_MODELS,
defaultModel: DEFAULT_MODEL,
} as const;
}),
privateData: protectedProcedure.query(({ ctx }) => {
return {
message: "This is private",
user: ctx.user,
aiModel: ctx.aiModel ?? null,
};
}),
});