mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-05-14 06:47:38 +08:00
- AILogo: `custom` 名称为合法兜底场景,不再以 console.error 上报;其余未匹配名称降级为 console.warn - SettingPage/Model: 双栏加 `min-h-0 overflow-y-auto`,让供应商列表与右侧表单各自可滚动 - ProviderService.add_provider: API 创建一律落到 `type='custom'`,并对同名供应商抛 ValueError,避免再产生伪内置行 - CLAUDE.md: 补充 v2.0.0 子系统(RAG/Chat、可选 Nacos+RabbitMQ、i18n、cookie/transcriber 管理器) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5.2 KiB
5.2 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
BiliNote is an AI video note generation tool. It extracts content from video links (Bilibili, YouTube, Douyin, Kuaishou, local files) and generates structured Markdown notes using LLM models. Full-stack app with a FastAPI backend, React frontend, and optional Tauri desktop packaging.
Development Commands
Backend (Python 3.11 + FastAPI)
cd backend
pip install -r requirements.txt
python main.py # Starts on 0.0.0.0:8483
Frontend (React 19 + Vite + TypeScript)
cd BillNote_frontend
pnpm install
pnpm dev # Dev server on port 3015, proxies /api to backend
pnpm build # Production build
pnpm lint # ESLint
Docker
docker-compose up # Web stack (backend + frontend + nginx)
docker-compose -f docker-compose.gpu.yml up # GPU variant
Desktop (Tauri)
cd backend && ./build.sh # Build PyInstaller backend binary
cd BillNote_frontend && pnpm tauri build
Architecture
Backend (backend/) — FastAPI app, entry point main.py:
app/routers/— API routes:note.py(generation),provider.py,model.py,config.py,chat.py(RAG Q&A on generated notes)app/services/— Business logic:note.py—NoteGeneratororchestrates the full pipeline (download → transcribe → LLM → notes)task_serial_executor.py— task queuechat_service.py+chat_tools.py+vector_store.py— RAG-based AI Q&A with Function Calling, indexing transcripts and video metadatacookie_manager.py— per-platform cookie storage; injected into yt-dlp by downloaders (e.g. Bilibili)transcriber_config_manager.py— persisted transcriber settingsworker_registry.py— optional Nacos registration + heartbeat for distributed worker mode (no-op whenNACOS_SERVER_ADDRunset)
app/messaging/— optional RabbitMQ producer/consumer publishing task progress/results tobilinote.task.feedbackexchange. Silently degrades whenRABBITMQ_URLis unset; always import-safe.app/downloaders/— Platform adapters (bilibili, youtube, douyin, kuaishou, local) with sharedbase.pyinterfaceapp/transcriber/— Speech-to-text engines (fast-whisper, groq, bcut, kuaishou, mlx-whisper) with factory intranscriber_provider.py. YouTube path prefers existing subtitles and skips audio download when available.app/gpt/— LLM integration with factory pattern (gpt_factory.py), prompt templates (prompt.py,prompt_builder.py), andrequest_chunker.pyfor long transcriptsapp/db/— SQLite + SQLAlchemy: DAO pattern (provider_dao.py,model_dao.py,video_task_dao.py), models inmodels/app/utils/—response.py(ResponseWrapper for consistent JSON),video_helper.py(screenshots via FFmpeg),export.py(PDF/DOCX),ppt_generator.py,minio_client.pyapp/i18n/— backend localizationevents/(root level) — Blinker signal system for post-processing (e.g., temp file cleanup after transcription)
Frontend (BillNote_frontend/src/) — React 19 + Vite + Tailwind + shadcn/ui:
pages/HomePage/— Main note generation UI:NoteForm.tsx(input),MarkdownViewer.tsx(preview),MarkmapComponent.tsx(mind map)pages/SettingPage/— LLM provider management, system monitoring, transcriber configstore/— Zustand stores:taskStore,modelStore,configStore,providerStore. Persists to IndexedDB.services/— Axios API clients matching backend routeshooks/useTaskPolling.ts— Polls task status every 3 secondscomponents/ui/— shadcn/ui (Radix-based) componentsi18n/—react-i18nextsetup with locale JSON ini18n/locales/; toggled viacomponents/LanguageSwitcher.tsx- Path alias:
@→./src
Core Workflow: User submits URL → task queued → download video → extract audio (FFmpeg) → transcribe (Whisper/Groq/etc) → generate notes (LLM) → frontend polls for completion → display Markdown + mind map.
Key Configuration
- Ports: Backend 8483, Frontend dev 3015, Docker maps 3015→80
- Environment: Root
.env(copy from.env.example). LLM API keys are configured through the UI, not env vars. - Database: SQLite at
backend/app/db/bili_note.db, auto-initialized on first run - FFmpeg: Required system dependency for video/audio processing
- Vite proxy: Dev server proxies
/apiand/staticto backend (configured invite.config.ts, reads env from parent dir) - Distributed mode (optional): Setting
NACOS_SERVER_ADDRenables Nacos worker registration; settingRABBITMQ_URLenables MQ feedback. Both are no-ops when unset — single-node deployment works without either. Other knobs:WORKER_ID,WORKER_SELF_URL,WORKER_MAX_CONCURRENT,TASK_MAX_WORKERS.
Code Style
- Frontend: ESLint + Prettier (2 spaces, single quotes, 100 char width, Tailwind plugin). TypeScript strict mode.
- Backend: Python with type hints. No configured linter. Uses Pydantic models for validation.
- Note: The frontend directory is named
BillNote_frontend(not "Bili").