c5976882be
Root CLAUDE.md now contains only project-wide concerns (stack, architecture, Docker, workflows, security hook). Service-specific details moved to: - backend/CLAUDE.md — DB models, API endpoints, JWT/bcrypt, naming conventions - frontend/CLAUDE.md — routes, TanStack Query patterns, XSS prevention - features/ai-service/CLAUDE.md — queue endpoints, provider notes - features/doc-service/CLAUDE.md — document models, PDF limits, proxy endpoints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
2.2 KiB
Markdown
51 lines
2.2 KiB
Markdown
# ai-service — Claude context
|
|
|
|
AI provider intermediary, port 8010 (internal only — never proxied to the browser). Accepts chat requests from `doc-service` (and potentially other callers). Manages a priority queue and abstracts over multiple AI providers (Anthropic, Ollama/LM Studio). See root `CLAUDE.md` for architecture, Docker, and project-wide workflows.
|
|
|
|
---
|
|
|
|
## File & Folder Tree
|
|
|
|
```
|
|
features/ai-service/
|
|
├── app/
|
|
│ ├── main.py ← FastAPI, queue worker lifespan
|
|
│ ├── core/
|
|
│ │ └── config.py ← Settings via pydantic-settings
|
|
│ ├── providers/
|
|
│ │ ├── base.py ← AIProvider abstract class
|
|
│ │ ├── anthropic_provider.py ← Anthropic API integration
|
|
│ │ └── openai_compat.py ← Ollama / LM Studio compatibility
|
|
│ ├── routers/
|
|
│ │ ├── chat.py ← POST /chat (sync, NORMAL priority queue)
|
|
│ │ ├── health.py ← GET /health
|
|
│ │ ├── queue.py ← GET /queue/status, /pause, /resume, /cancel/{id}
|
|
│ │ └── plugin.py ← GET /plugin/manifest (access rules for ai-service-admin group)
|
|
│ └── services/
|
|
│ └── queue.py ← Priority queue (CRITICAL > HIGH > NORMAL)
|
|
├── Dockerfile ← python:3.12-slim, non-root user 1001
|
|
└── STATUS.md
|
|
```
|
|
|
|
---
|
|
|
|
## API Endpoints (internal only)
|
|
|
|
| Method | Path | Description |
|
|
|--------|------|-------------|
|
|
| POST | `/chat` | Chat request (queued at NORMAL priority) |
|
|
| GET | `/health` | Health check |
|
|
| GET | `/queue/status` | Queue state |
|
|
| POST | `/queue/pause` | Pause queue |
|
|
| POST | `/queue/resume` | Resume queue |
|
|
| POST | `/queue/cancel/{job_id}` | Cancel job |
|
|
| GET | `/plugin/manifest` | Plugin manifest (access rules for ai-service-admin group) |
|
|
|
|
These endpoints are only reachable on `backend-net`. The backend does not expose them to the browser.
|
|
|
|
---
|
|
|
|
## Note on timeout and retry configuration
|
|
|
|
Caller-side timeout and retry settings live in `features/doc-service/app/services/ai_client.py` — see `features/doc-service/CLAUDE.md` for the values.
|