From d3c6e6e44984dfa335c6aa612309cbcd8fc4287f Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 22 Oct 2025 03:57:16 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CLAUDE.md | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..1ee8869 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,154 @@ +# 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 +- 使用中文回答 \ No newline at end of file