Progressive enhancement chain: GeoIP auto-detect -> browser GPS -> manual entry -> works without any location. When set, the observer coordinates are injected into chat requests so the LLM can answer "Where is Jupiter?" with actual azimuth/elevation from the user's location instead of placeholder coordinates. Backend: - GeoIP service (MaxMind GeoLite2-City) with lazy init, private IP filtering, and IPv4-mapped IPv6 unwrapping - GET /api/geolocate endpoint (sync to avoid blocking event loop on mmap I/O, rightmost X-Forwarded-For for Caddy trust chain) - ObserverContext model on both chat endpoints with shared _observer_prefix() helper that sanitizes label against prompt injection Frontend: - Location bar between header and messages with pin icon, GPS button, edit/clear controls, and inline manual entry parser (accepts "40.7N 74.0W", decimal lat/lon, pg_orrery observer format) - GeoIP auto-detect on first visit, localStorage persistence - Observer coordinates sent with every chat request Infrastructure: - api-data volume for GeoIP database, Caddy handle_4 for /api/geolocate - update_geoip.sh using MaxMind Basic auth (key stays out of ps/proc)
52 lines
1.1 KiB
TOML
52 lines
1.1 KiB
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "orrery-search"
|
|
version = "2026.03.01"
|
|
description = "Semantic search and chat API for the pg_orrery documentation"
|
|
license = "MIT"
|
|
requires-python = ">=3.12"
|
|
authors = [{name = "Ryan Malloy", email = "ryan@supported.systems"}]
|
|
dependencies = [
|
|
"fastapi>=0.115.0",
|
|
"uvicorn[standard]>=0.32.0",
|
|
"sqlalchemy[asyncio]>=2.0.36",
|
|
"asyncpg>=0.30.0",
|
|
"pgvector>=0.4.2",
|
|
"pgai[sqlalchemy]>=0.12.0",
|
|
"tiktoken>=0.7.0",
|
|
"alembic>=1.14.0",
|
|
"pydantic-settings>=2.6.0",
|
|
"openai>=1.60.0",
|
|
"anthropic>=0.40.0",
|
|
"pyyaml>=6.0",
|
|
"fastmcp>=3.0.0",
|
|
"httpx>=0.28.0",
|
|
"geoip2>=4.8.0",
|
|
]
|
|
|
|
[project.scripts]
|
|
orrery-search = "orrery_search.main:run"
|
|
|
|
[tool.ruff]
|
|
target-version = "py312"
|
|
src = ["src"]
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
ignore = ["B008"]
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/orrery_search"]
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"pytest>=9.0.2",
|
|
"pytest-asyncio>=1.3.0",
|
|
]
|