Resolve ai-service directly from the RAG routes, never the gateway
This commit is contained in:
@@ -2,11 +2,16 @@ import { NextResponse } from "next/server";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
const API_GATEWAY_URL =
|
||||
process.env.API_GATEWAY_URL ?? process.env.AI_SERVICE_URL ?? "http://localhost:8000";
|
||||
// RAG never goes through api-gateway. The gateway proxies `/auth/*` only --
|
||||
// apps/api-gateway/src/proxy/ holds a single AuthProxyController -- so
|
||||
// preferring AI_SERVICE_URL here pointed every RAG call at a service with no
|
||||
// such route the moment apiGateway was enabled, breaking chat, suggest,
|
||||
// history, sections, section-text and feedback at once. Resolve ai-service
|
||||
// directly and let AI_SERVICE_URL mean what its name says: auth only.
|
||||
const AI_SERVICE_URL = process.env.AI_SERVICE_URL ?? "http://localhost:8000";
|
||||
|
||||
function ragBaseUrl() {
|
||||
return API_GATEWAY_URL.replace(/\/v1\/rag(?:\/query)?\/?$/, "");
|
||||
return AI_SERVICE_URL.replace(/\/v1\/rag(?:\/query)?\/?$/, "");
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
|
||||
Reference in New Issue
Block a user