本次同步 09-12 至 09-28 的代码变更,主要内容: 新增功能 - 修改密码:后端新增 ChangePasswordRequest DTO 与UserController/UserService 对应接口,前端新增 ChangePasswordDialog 并在 Header 接入入口 - 文件预览组件重构:file-preview 目录拆分出 VideoPreview(支持 blobUrl 直传)、 ImagePreview、AudioPreview,index.tsx 统一调度各类型预览器 - 新增 my_ops 算子模块:markitdown_parser、mineru_pdf_parser、text_quality_evaluator - 新增 tools/minio-file-server MinIO 文件服务 功能增强 - 数据清洗:cleaning_task_service/scheduler/routes 重构, data_juicer_executor 与 wrapper 增强,OperatorTable/LogsTable/TaskDetail 同步调整 - 数据标注:annotation sync.py、project.py 接口与schema 更新 - 数据采集、算子市场、首页与菜单路由相关页面调整 - DataJuicer 算子接入(useOperatorOperations、dj_ops_schema) 结构调整 - deepflow/ 更名为 deep-flow/(419 个文件重命名) - 新增 helm 部署编排、GitHub Actions 之外的自建镜像构建脚本 未纳入本次提交 - scripts-backup/、runtime/python-executor-backup/、components_backup/(备份目录) - *.backup*、__pycache__ 产物 - zh_core_web_sm-3.8.0-py3-none-any.whl(46MB 构建产物) - DataX/(内嵌独立仓库,远程亦未收录其源码)
5.5 KiB
5.5 KiB
Agent.md
This file provides guidance to AI agents when working with code in this repository.
Architecture Overview
DeepFlow is a multi-agent research framework built on LangGraph that orchestrates AI agents to conduct deep research, generate reports, and create content like podcasts and presentations.
Core Architecture
The system uses a modular multi-agent architecture with these key components:
- Coordinator: Entry point managing workflow lifecycle
- Planner: Decomposes research objectives into structured plans
- Research Team: Specialized agents (Researcher, Coder) executing plans
- Reporter: Aggregates findings and generates final reports
- Human-in-the-loop: Interactive plan modification and approval
Graph Structure
Built on LangGraph with state-based workflows:
- StateGraph manages agent communication
- MemorySaver provides conversation persistence
- Checkpointing supports MongoDB/PostgreSQL storage
- Nodes: coordinator → planner → research_team → reporter
Key Directories
src/
├── agents/ # Agent definitions and behaviors
├── config/ # Configuration management (YAML, env vars)
├── crawler/ # Web crawling and content extraction
├── graph/ # LangGraph workflow definitions
├── llms/ # LLM provider integrations (OpenAI, DeepSeek, etc.)
├── prompts/ # Agent prompt templates
├── server/ # FastAPI web server and endpoints
├── tools/ # External tools (search, TTS, Python REPL)
└── rag/ # RAG integration for private knowledgebases
web/ # Next.js web UI (React, TypeScript)
├── src/app/ # Next.js pages and API routes
├── src/components/ # UI components and design system
└── src/core/ # Frontend utilities and state management
Development Commands
Backend (Python)
# Install dependencies
uv sync
# Development server
uv run server.py --reload
# Console UI
uv run main.py
# Run tests
make test # Run all tests
make coverage # Run tests with coverage
pytest tests/unit/test_*.py # Run specific test file
# Code quality
make lint # Ruff linting
make format # Ruff formatting
# LangGraph Studio (debugging)
make langgraph-dev # Start LangGraph development server
Frontend (Web UI)
cd web/
pnpm install # Install dependencies
pnpm dev # Development server (localhost:3000)
pnpm build # Production build
pnpm typecheck # Type checking
pnpm lint # ESLint
pnpm format:write # Prettier formatting
Full Stack Development
# Run both backend and frontend
./bootstrap.sh -d # macOS/Linux
bootstrap.bat -d # Windows
Docker
# Build and run
make build # Build Docker image
docker compose up # Run with Docker Compose
# Production deployment
docker build -t deep-flow-api .
docker run -p 8000:8000 deep-flow-api
Fix GitHub issues
create a branch named fix/<issue-number> to address specific GitHub issues.
Configuration
Environment Setup
# Required: Copy example configs
cp .env.example .env
cp conf.yaml.example conf.yaml
# Key environment variables:
# TAVILY_API_KEY # Web search
# BRAVE_SEARCH_API_KEY # Alternative search
# LANGSMITH_API_KEY # LangSmith tracing (optional)
# LANGGRAPH_CHECKPOINT_DB_URL # MongoDB/PostgreSQL for persistence
LangGraph Studio
# Local debugging with checkpointing
uvx --refresh --from "langgraph-cli[inmem]" --with-editable . --python 3.12 langgraph dev --allow-blocking
Common Development Tasks
Testing
# Unit tests
pytest tests/unit/
# Integration tests
pytest tests/integration/
# Specific component
pytest tests/unit/config/test_configuration.py
# With coverage
pytest --cov=src tests/ --cov-report=html
Code Quality
# Format code
make format
# Check linting
make lint
# Type checking (frontend)
cd web && pnpm typecheck
Adding New Features
- New Agent: Add agent in
src/agents/+ update graph insrc/graph/builder.py - New Tool: Add tool in
src/tools/+ register in agent prompts - New Workflow: Create graph builder in
src/[feature]/graph/builder.py - Frontend Component: Add to
web/src/components/+ update API inweb/src/core/api/
Configuration Changes
- LLM Models: Update
conf.yamlwith new providers - Search Engines: Modify
.envSEARCH_API variable - RAG Integration: Configure RAGFLOW_API_URL in
.env - MCP Servers: Add MCP settings in configuration
Architecture Patterns
Agent Communication
- Message Passing: Agents communicate via LangGraph state
- Tool Access: Each agent has specific tool permissions
- State Management: Persistent checkpoints for conversation history
Content Generation Pipeline
- Planning: Planner creates research plan
- Research: Researcher gathers information
- Processing: Coder analyzes data/code
- Reporting: Reporter synthesizes findings
- Post-processing: Optional podcast/PPT generation
External Integrations
- Search: Tavily, Brave Search, DuckDuckGo
- Crawling: Jina for web content extraction
- TTS: Volcengine TTS API
- RAG: RAGFlow and VikingDB support
- MCP: Model Context Protocol integration