rasAli02 commited on
Commit
39dc846
Β·
1 Parent(s): b3ba301

fix: include token in telemetry heartbeat

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -13,7 +13,7 @@ from fastapi.staticfiles import StaticFiles
13
  from fastapi.middleware.cors import CORSMiddleware
14
 
15
  # Import our agent pipeline
16
- from agents import run_pipeline, AMD_INFERENCE_URL, AMD_MODEL_NAME
17
 
18
  # ── MONGODB PERSISTENCE (optional, falls back to in-memory) ──────────────────
19
  MONGO_URL = os.getenv("MONGO_URL", "")
@@ -138,9 +138,13 @@ async def api_get_telemetry():
138
  t = time.time()
139
  status = "Connected"
140
  error_msg = None
 
 
 
 
141
  try:
142
  async with httpx.AsyncClient(timeout=2.0) as client:
143
- resp = await client.get(f"{AMD_INFERENCE_URL}/v1/models")
144
  if resp.status_code != 200:
145
  status = "Limited"
146
  error_msg = f"HTTP {resp.status_code}"
 
13
  from fastapi.middleware.cors import CORSMiddleware
14
 
15
  # Import our agent pipeline
16
+ from agents import run_pipeline, AMD_INFERENCE_URL, AMD_MODEL_NAME, AMD_INFERENCE_TOKEN
17
 
18
  # ── MONGODB PERSISTENCE (optional, falls back to in-memory) ──────────────────
19
  MONGO_URL = os.getenv("MONGO_URL", "")
 
138
  t = time.time()
139
  status = "Connected"
140
  error_msg = None
141
+ headers = {}
142
+ if AMD_INFERENCE_TOKEN:
143
+ headers["Authorization"] = f"Bearer {AMD_INFERENCE_TOKEN}"
144
+
145
  try:
146
  async with httpx.AsyncClient(timeout=2.0) as client:
147
+ resp = await client.get(f"{AMD_INFERENCE_URL}/v1/models", headers=headers)
148
  if resp.status_code != 200:
149
  status = "Limited"
150
  error_msg = f"HTTP {resp.status_code}"