generated from kgod/ai-review-template
44 lines
1.9 KiB
Markdown
44 lines
1.9 KiB
Markdown
# Resume Agent backend
|
|
|
|
FastAPI service for the conversational resume builder: sessions, turns, resumes, imports,
|
|
and light-optimization state, persisted in SQLite (pilot) or PostgreSQL (production).
|
|
|
|
## Run locally
|
|
|
|
Python 3.11 or newer is required.
|
|
|
|
```bash
|
|
python -m pip install -r requirements.txt
|
|
cp .env.example .env
|
|
# Leave OPENAI_API_KEY empty for offline rules, or fill in the live LLM gateway values.
|
|
python -m uvicorn app.asgi:application --reload --port 8000
|
|
```
|
|
|
|
`app.asgi:application` wraps `app.main:app` and hides `/docs`, `/redoc`, and `/openapi.json`
|
|
by default; set `RESUME_AGENT_API_DOCS=1` to expose them (development only).
|
|
|
|
The runtime expects `DATABASE_URL` (PostgreSQL) and uses the `resume_agent` schema by
|
|
default; override with `RESUME_AGENT_DATABASE_SCHEMA`. Run `alembic upgrade head` to create
|
|
the tables, and `python scripts/migrate_sqlite_to_postgres.py` to move existing SQLite data.
|
|
SQLite is used only when `database_path` is passed explicitly (tests, local pilot).
|
|
CORS defaults to `http://localhost:5173`; set a comma-separated `RESUME_AGENT_CORS_ORIGINS`.
|
|
|
|
Set `OFFERPAI_AUTH_BASE_URL` to enable the OfferPai landing-token bridge. The frontend
|
|
passes the in-memory landing token on every session request via `Authorization: Bearer`;
|
|
the backend validates it with `GET /api/public/checkLogin`, loads
|
|
`GET /api/user/manage/info` using the upstream `Token` cookie, and persists the account
|
|
identity/default phone without persisting the token itself. Resume content uses a
|
|
three-way OfferPai reconciliation baseline: remote-only changes are pulled, local-only
|
|
changes are pushed, and concurrent changes return a conflict instead of overwriting.
|
|
|
|
The health check at `GET /health` is always open.
|
|
|
|
## Tests
|
|
|
|
```bash
|
|
python -m pytest tests -q
|
|
```
|
|
|
|
Postgres-backed tests require `RESUME_AGENT_TEST_DATABASE_URL`; the rest run on SQLite
|
|
temporary files. Tests force the rule-based LLM provider, so no API key is needed.
|