added debug
This commit is contained in:
parent
d7090b1644
commit
1a7dd550ec
5
main.py
5
main.py
@ -12,8 +12,8 @@ app = FastAPI()
|
|||||||
# Configuration from environment variables
|
# Configuration from environment variables
|
||||||
# We use removesuffix to ensure we have the base URL without the /v1 part,
|
# 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)
|
# 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")
|
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://llama-slm: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_BASE = "https://api.openai.com"
|
||||||
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
|
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
|
||||||
|
|
||||||
@ -60,6 +60,7 @@ async def proxy(
|
|||||||
if not target_url:
|
if not target_url:
|
||||||
return Response(content="No valid target available (Main PC offline, SLM unavailable, and no OpenAI key)", status_code=503)
|
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
|
# Prepare request for proxying
|
||||||
body = await request.body()
|
body = await request.body()
|
||||||
headers = dict(request.headers)
|
headers = dict(request.headers)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user