feat(ai): add ai chat to dashboard

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-04-15 14:30:21 +02:00
parent 804a9c8056
commit 34769a5d58
46 changed files with 2624 additions and 1449 deletions

View File

@@ -0,0 +1,28 @@
import * as controller from '@/controllers/ai.controller';
import { activateRateLimiter } from '@/utils/rate-limiter';
import type { FastifyPluginCallback, FastifyRequest } from 'fastify';
const aiRouter: FastifyPluginCallback = async (fastify) => {
await activateRateLimiter<
FastifyRequest<{
Querystring: {
projectId: string;
};
}>
>({
fastify,
max: process.env.NODE_ENV === 'production' ? 20 : 100,
timeWindow: '300 seconds',
keyGenerator: (req) => {
return req.query.projectId;
},
});
fastify.route({
method: 'POST',
url: '/chat',
handler: controller.chat,
});
};
export default aiRouter;