bhyve-projects / tests /dev_server.py
akashdahad's picture
Deploy contract-workspace MVP (FastAPI + uv, Docker)
9301e20 verified
Raw History Blame Contribute Delete
909 Bytes
"""Dev-only launcher: runs the real app with a deterministic FakeLLM injected, so the full UI
flow can be exercised in a browser WITHOUT a Gemini API key.
This is test scaffolding, NOT part of the shipped application (the app always wires the real
Gemini client). Run it with:
uv run python tests/dev_server.py # serves http://127.0.0.1:8765
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import uvicorn
from app.deps import get_llm, get_session_manager
from app.main import app
from app.services.session import SessionManager
from tests.fakes import FakeLLM
_fake = FakeLLM(token_count=5000)
_sessions = SessionManager()
app.dependency_overrides[get_llm] = lambda: _fake
app.dependency_overrides[get_session_manager] = lambda: _sessions
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8765, log_level="warning")