feat: add plugin HTTP hooks + Zalo plugin

This commit is contained in:
Peter Steinberger
2026-01-15 05:03:50 +00:00
parent 0e76d21f11
commit 5abe3c2145
36 changed files with 3061 additions and 0 deletions

View File

@@ -190,6 +190,7 @@ export function createGatewayHttpServer(opts: {
controlUiBasePath: string;
openAiChatCompletionsEnabled: boolean;
handleHooksRequest: HooksRequestHandler;
handlePluginRequest?: HooksRequestHandler;
resolvedAuth: import("./auth.js").ResolvedGatewayAuth;
}): HttpServer {
const {
@@ -198,6 +199,7 @@ export function createGatewayHttpServer(opts: {
controlUiBasePath,
openAiChatCompletionsEnabled,
handleHooksRequest,
handlePluginRequest,
resolvedAuth,
} = opts;
const httpServer: HttpServer = createHttpServer((req, res) => {
@@ -206,6 +208,7 @@ export function createGatewayHttpServer(opts: {
void (async () => {
if (await handleHooksRequest(req, res)) return;
if (handlePluginRequest && (await handlePluginRequest(req, res))) return;
if (openAiChatCompletionsEnabled) {
if (await handleOpenAiHttpRequest(req, res, { auth: resolvedAuth })) return;
}