fix: add LITELLM_API_KEY support for authenticated LiteLLM calls
Run Tests / Backend Tests (push) Failing after 22s
Run Tests / Frontend Tests (push) Failing after 36s
Run Tests / Test Summary (push) Failing after 40s
Deploy Dashboard (Dev) / deploy-dev (push) Failing after 7m14s

This commit is contained in:
Gan, Jimmy
2026-04-02 22:06:12 +08:00
parent 971cf34087
commit 54bfea16f2
2 changed files with 7 additions and 0 deletions
@@ -18,6 +18,7 @@ class BaseAgent:
self.system_prompt = system_prompt
self.config = config
self.litellm_url = os.getenv("LITELLM_URL", "http://litellm:4005")
self.litellm_api_key = os.getenv("LITELLM_API_KEY", "")
async def execute(self, task: Dict[str, Any], context: Dict[str, Any]) -> Dict[str, Any]:
"""
@@ -79,9 +80,14 @@ Only propose actions you can actually execute. Be specific and actionable."""
temperature = self.config.get("temperature", 0.7)
try:
headers = {}
if self.litellm_api_key:
headers["Authorization"] = f"Bearer {self.litellm_api_key}"
async with httpx.AsyncClient(timeout=60.0) as client:
response = await client.post(
f"{self.litellm_url}/chat/completions",
headers=headers,
json={
"model": model,
"messages": [
+1
View File
@@ -28,6 +28,7 @@ services:
- WEBAUTHN_RP_ID=jimmygan.com
- WEBAUTHN_ORIGINS=https://dev.nas.jimmygan.com,https://dev.nas.jimmygan.com:8443,https://auth.jimmygan.com:8443
- LITELLM_URL=http://litellm:4005
- LITELLM_API_KEY=${LITELLM_API_KEY:-}
- LITELLM_HEALTH_API_KEY=${LITELLM_HEALTH_API_KEY:-}
- GITEA_DB_PASSWORD=${GITEA_DB_PASSWORD}
volumes: