English | 中文
Mind-Analyst is a locally deployable content analysis + RAG (Retrieval-Augmented Generation) project. It provides source adapters to ingest author/video content and enables transcription, structured summarization, and citation-style Q&A (the built-in adapter in this repository primarily targets Bilibili author pages; more sources can be added).
Important disclaimer: This project is for learning and research purposes only. Make sure you have proper authorization and comply with applicable laws and platform terms when collecting/storing/processing content. This project does not promise or guarantee bypassing access controls/paywalls/anti-bot restrictions. The authors and contributors are not responsible for users' actions.
- Ingestion: Ingest author/video metadata and content into PostgreSQL.
- Object storage: Store media and avatars in MinIO (S3-compatible).
- ASR & segmentation: Generate transcripts and split into retrievable segments.
- Summaries & reports: Generate structured summaries, author reports, and category reports via prompt templates.
- RAG Q&A: Retrieval + citation-style answering over author content.
- Web UI: Vue + Vite frontend for authors, videos, reports, and chat.
This project follows a layered architecture (a mix of clean architecture and adapters):
src/api/: FastAPI routers (entry layer).src/services/: use-case orchestration (service layer).src/repositories/: data access (repository layer).src/adapters/: external dependency adapters (LLM / Storage / ASR / Sources).src/prompts/: prompt templates & rendering (PromptManager + profiles).src/models/: model/provider registry (e.g.provider_models.yaml).src/rag/: RAG engine (indexing/retrieval/rerank/chat).src/workflows/: long-running workflows (ingestion/processing).
- Python 3.11+ (tested on Python 3.12)
- Node.js 18+
- Docker (for PostgreSQL/Redis; optionally for MinIO)
This repository includes docker-compose.yml:
./scripts/start_infra.sh- PostgreSQL:
localhost:5432(image:pgvector/pgvector:pg16) - Redis:
localhost:6380
Note: On startup, the backend will attempt
CREATE EXTENSION IF NOT EXISTS vectorand runcreate_allto create tables (MVP approach). For production-grade schema management, consider usingalembic/migrations.
MinIO (S3-compatible) is used for media/avatar storage and presigned access URLs.
Example command to run MinIO:
docker run --rm -p 9000:9000 -p 9001:9001 \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
quay.io/minio/minio server /data --console-address ":9001"Default settings are defined in src/core/config.py (MINIO_*).
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtThis project uses pydantic-settings to read .env (gitignored; do not commit real secrets).
Minimal environment variables you may want to set:
-
Database
DATABASE_URL(default:postgresql+asyncpg://user:password@localhost:5432/mind_analyst)
-
MinIO (if enabled)
MINIO_ENDPOINT(default:localhost:9000)MINIO_ACCESS_KEY/MINIO_SECRET_KEYMINIO_SECURE(true/false)MINIO_BUCKET_NAME(default:mind-analyst-files)MINIO_PRESIGN_EXPIRES_S(default: 7 days, general presigned URLs)MINIO_AVATAR_PRESIGN_EXPIRES_S(default: 3600 seconds, short-lived avatar URLs)
-
ASR (default: openai_compatible)
ASR_PROVIDER(default:openai_compatible)ASR_API_KEY/ASR_BASE_URL/ASR_MODEL
-
LLM providers (see
src/models/provider_models.yaml)SILICONFLOW_API_KEY/DEEPSEEK_API_KEY/OPENAI_API_KEY(set based on enabled providers)
LLM models and scene mapping are managed in
src/models/provider_models.yaml. The codebase avoids hardcoded model/base_url/key in business logic.
uvicorn src.api.main:app --reload --host 0.0.0.0 --port 8000API listens at: http://localhost:8000.
cd frontend
npm install
npm run devThe Vite dev server address will be printed in your terminal.
POST /api/v1/ingest- Start author ingestion (background task)
GET /api/v1/authors- List authors (includes status metrics; avatar URLs are presigned on demand)
GET /api/v1/authors/{author_id}- Author detail, latest report, category reports
GET /api/v1/videos/{video_id}- Video detail, summary, segments
GET /api/v1/videos/{video_id}/playback- Presigned playback URL
POST /api/v1/chat- RAG Q&A
POST /api/v1/rag/reindex- Trigger RAG reindex (background task)
- Prompt templates are managed in
src/prompts/templates/(YAML) and rendered viaPromptManager. - Prompt profile mapping lives in
src/prompts/profiles.yaml. - LLM providers/models are configured in
src/models/provider_models.yamland selected by scene.
- Do not store sensitive data, personal data, or copyrighted content without proper authorization.
- Review and validate LLM outputs; this project does not guarantee correctness, completeness, or fitness for any purpose.
- Copyright & platform terms: When collecting/processing content from third-party platforms (e.g. Bilibili), you must comply with applicable laws and platform terms/robots. Use only with proper authorization.
- No affiliation: This project is not affiliated with or endorsed by Bilibili / OpenAI / DeepSeek / SiliconFlow.
- LLM output risks: LLMs may produce inaccurate, misleading, or infringing content. Please review before publishing.
- API key security: Never commit API keys; never log keys/tokens.
- Engineering guidelines:
.windsurf/rules/code-standards.md. - Database schema is currently created via
create_allon startup (src/database/db.py). For production, consider Alembic migrations.
Issues/PRs are welcome:
- Before submitting a PR: include reproduction steps, expected/actual behavior, logs/screenshots (please redact sensitive info).
- Follow project engineering rules (layering, strong typing, error strategy, centralized config, prompt management).
This project is licensed under the MIT License. See LICENSE.
This README is not legal advice. For commercial use or compliance concerns, consult a qualified attorney.