mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-06 20:51:36 +02:00
22 lines
588 B
TypeScript
22 lines
588 B
TypeScript
import { Router } from "express";
|
|
import {
|
|
AI_CAPABILITY_DEFS,
|
|
type AiCapability
|
|
} from "@server/lib/aiCapabilities";
|
|
import { handleAiGatewayProxy } from "@server/routers/aiGateway/pipeline";
|
|
|
|
export function createAiGatewayRouter() {
|
|
const router = Router();
|
|
|
|
for (const def of Object.values(AI_CAPABILITY_DEFS)) {
|
|
const capability = def.id as AiCapability;
|
|
for (const route of def.routes) {
|
|
router.post(route.path, (req, res) =>
|
|
handleAiGatewayProxy(req, res, capability)
|
|
);
|
|
}
|
|
}
|
|
|
|
return router;
|
|
}
|