Files
my_dataset_demo999/CLAUDE.md
2025-10-31 02:43:54 +00:00

154 lines
4.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is **Langflow** - a low-code app builder for RAG and multi-agent AI applications. It's a Python-based visual IDE that allows users to build, test, and deploy AI workflows through a drag-and-drop interface. The project combines a FastAPI backend with a React frontend.
## Architecture
### Backend Structure
- **Main Backend**: `src/backend/langflow/` - Entry point and versioning
- **Core Backend**: `src/backend/base/langflow/` - Main application logic with these key modules:
- `api/` - REST API endpoints and WebSocket handlers
- `graph/` - Flow graph processing and execution engine
- `components/` - Custom component definitions and implementations
- `services/` - Business logic services (database, auth, etc.)
- `processing/` - Data processing utilities
- `schema/` - Pydantic models and data structures
- `serialization/` - Flow import/export functionality
### Frontend Structure
- **Main Frontend**: `src/frontend/` - React application with:
- Modern React 18 with TypeScript
- Vite build system
- Tailwind CSS for styling
- React Flow for workflow visualization
- Chakra UI and Radix UI components
### Key Technologies
- **Backend**: FastAPI, SQLAlchemy, Pydantic, Celery (for async tasks)
- **Frontend**: React 18, TypeScript, Vite, React Flow, Zustand (state management)
- **Package Management**: UV (Python), NPM (Node.js)
## Development Commands
### Backend Development
```bash
# Install backend dependencies
make install_backend
# Run backend in development mode
make backend
# Run backend with specific settings
make backend log_level=debug host=0.0.0.0 port=7860
# Run backend tests
make unit_tests
make integration_tests
make tests
# Lint and format backend
make format_backend
make lint
```
### Frontend Development
```bash
# Install frontend dependencies
make install_frontend
# Run frontend in development mode
make frontend
# Build frontend for production
make build_frontend
# Run frontend tests
make tests_frontend
# Lint and format frontend
make format_frontend
```
### Full Development Workflow
```bash
# Initialize the entire development environment
make init
# Run both frontend and backend
make run_frontend
make run_backend
# Build and run the complete application
make build_and_run
# Format all code
make format
```
### Testing and Quality
```bash
# Run all tests with coverage
make coverage
# Run linters
make lint
# Format code
make format
# Check spelling
make codespell
```
## Environment Setup
1. **Python**: Requires Python 3.10-3.12
2. **Node.js**: Required for frontend development
3. **Virtual Environment**: Activated via `.venv/bin/activate`
4. **Environment Variables**: Copy from `.env.example` to `.env`
## Database and Storage
- **Database**: SQLAlchemy with PostgreSQL/SQLite support
- **Migrations**: Alembic for database migrations
- **Cache**: Redis for caching and session storage
## Key Features
- **Visual IDE**: Drag-and-drop workflow builder using React Flow
- **Multi-agent Support**: Orchestrates multiple AI agents and conversations
- **RAG Pipelines**: Complete RAG implementation with various vector stores
- **API Publish**: Export flows as APIs
- **Observability**: Integration with LangSmith, LangFuse, LangWatch
- **Component System**: Extensible component architecture for custom integrations
## Testing Structure
- **Unit Tests**: `src/backend/tests/unit/`
- **Integration Tests**: `src/backend/tests/integration/`
- **Frontend Tests**: `src/frontend/__tests__/`
- **Test Framework**: pytest with async support
- **Coverage**: Generated coverage reports with `make coverage`
## Custom Components
The project supports custom components through:
- `src/backend/base/langflow/custom/` - Custom component definitions
- Component registry system for dynamic loading
- Support for Python-based and API-based components
## Deployment
- **Docker**: Multi-stage Docker builds for production
- **Cloud**: DataStax Langflow cloud service integration
- **Self-hosted**: Complete Docker Compose setup available
## 数据库
- 当使用sqlite时数据库路径为src/backend/base/langflow/langflow.db
- 数据库路径为src/backend/base/langflow/langflow.db
- 使用中文回答