2.7 KiB
2.7 KiB
AGENTS.md
Repo Shape
- The primary app is now
backend/(Python/FastAPI) plusfrontend/(Next.js/TypeScript/Tailwind);estacion documentos.htmlis a browser-only prototype/reference for behavior. - Runtime data is stored under
data/and is gitignored; do not commit uploaded class files, generated Markdown, SQLite DBs, temporary audio, or API keys. - The included
Griffin(2020).Comportamiento_organizacionalSOLOCAPITULO7.13Ed.pdfis a local sample/source PDF for import behavior.
Commands
- Local setup:
python -m venv .venv,.venv\Scripts\activate,pip install -r requirements.txt, copy.env.exampleto.env. - Run API:
uvicorn backend.app.main:app --reloadfrom the repo root. - Run frontend:
cd frontend,npm install,npm run dev -- -p 3000withNEXT_PUBLIC_API_URL=http://127.0.0.1:8000. - Windows non-technical flow: double-click
abrir_estacion.bat; it chooses free ports, starts backend/frontend, and opens the browser. Usecerrar_estacion.batto stop only this project. - Docker/Coolify check:
docker compose up --build. - Basic syntax check:
python -m compileall backend.
Platform Behavior
- Knowledge is organized as
Materia -> Semana -> fuentes raw -> Markdown procesado -> exportsunderdata/subjects/<materia>/week-XX/. KnowledgeManagerowns filesystem layout and SQLite metadata; processors should not write final Markdown directly.IngestionServiceselects processors bysource_typeand wraps output with Markdown frontmatter for LLM ingestion.- Text and Markdown are read directly;
.docxusespython-docx; PDFs use PyMuPDF text extraction unlessuse_ocr=trueis passed. PDF uploads can also passpage_rangeslike1-5,8,10-12; ranges apply to both standard extraction and Mistral OCR. - OCR uses Mistral
https://api.mistral.ai/v1/chat/completionswith modelpixtral-12b-2409. - Audio uses Deepgram
https://api.deepgram.com/v1/listen?model=nova-3&smart_format=true&language=es. - Video processing requires
ffmpeg; audio is extracted todata/tmp/, transcribed with Deepgram, then deleted. - The frontend calls the backend through
NEXT_PUBLIC_API_URL; when ports change, updatefrontend/.env.localor use the adaptive.bat.
Secrets And Deployment
- Use
.envlocally and Coolify environment variables in production; never hardcode or commitMISTRAL_API_KEYorDEEPGRAM_API_KEY. - For Coolify, mount persistent storage for
/app/dataor all subjects, outputs, and SQLite state will be lost on redeploy.
Prototype Notes
- Preserve the Spanish-language UX and Markdown-first output conventions from
estacion documentos.htmlwhen building the new UI. - The prototype sanitizes preview HTML with DOMPurify after
marked.parse; keep equivalent sanitization in any future web UI.