added debug

This commit is contained in:
Tudorel Oprisan 2026-06-09 18:05:10 +01:00
parent d7090b1644
commit 1a7dd550ec

View File

@ -12,8 +12,8 @@ app = FastAPI()
# Configuration from environment variables
# We use removesuffix to ensure we have the base URL without the /v1 part,
# as the incoming path already includes 'v1/...' (e.g. /v1/chat/completions)
MAIN_PC_BASE = os.getenv("MAIN_PC_URL", "http://10.0.4.x:8080/v1").removesuffix("/v1")
LOCAL_SLM_BASE = os.getenv("LOCAL_SLM_URL", "http://llama-slm:8080/v1").removesuffix("/v1")
MAIN_PC_BASE = os.getenv("MAIN_PC_URL", "http://10.0.4.11:8080/v1").removesuffix("/v1")
LOCAL_SLM_BASE = os.getenv("LOCAL_SLM_URL", "http://10.0.4.200:8080/v1").removesuffix("/v1")
OPENAI_BASE = "https://api.openai.com"
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
@ -60,6 +60,7 @@ async def proxy(
if not target_url:
return Response(content="No valid target available (Main PC offline, SLM unavailable, and no OpenAI key)", status_code=503)
print(f"Routing {path} -> {target_url}")
# Prepare request for proxying
body = await request.body()
headers = dict(request.headers)