fix(health): correctly resolve prompts dir path for agent health api

This commit is contained in:
Sami Assiri 2026-04-15 21:47:37 +03:00
parent cd89b54b74
commit 1036582ec0

View File

@ -11,9 +11,20 @@ import logging
from app.database import get_db
router = APIRouter(prefix="/agent-health", tags=["Agent Health"])
logger = logging.getLogger("dealix.agent_health")
# The scripts are typically in backend/app/api/v1
# We know the absolute structure from the project root
from pathlib import Path
import os
PROMPTS_DIR = Path(__file__).parent.parent.parent.parent / "ai-agents" / "prompts"
_current_dir = Path(__file__).resolve()
# We are in backned/app/api/v1/agent_health.py -> 4 parents up -> then up out of salesflow-saas to ai-agents
PROMPTS_DIR = _current_dir.parent.parent.parent.parent.parent / "ai-agents" / "prompts"
if not PROMPTS_DIR.exists():
# If the app is run from a different level
PROMPTS_DIR = _current_dir.parent.parent.parent.parent / "ai-agents" / "prompts"
if not PROMPTS_DIR.exists():
PROMPTS_DIR = Path("C:/Users/samim/system-prompts-and-models-of-ai-tools/ai-agents/prompts")
@router.get("/status")