mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-30 12:25:29 +08:00
3.1 KiB
3.1 KiB
Development Configuration
This guide explains how to set up a development environment for LangBot and contribute to the project.
Prerequisites
Before you start, make sure you have the following installed:
- Python 3.10 or higher
- Git
- Node.js 16 or higher (for WebUI development)
- A code editor (VS Code recommended)
Setting Up the Development Environment
- Fork the LangBot repository on GitHub
- Clone your fork:
git clone https://github.com/your-username/LangBot.git
cd LangBot
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
pip install -r requirements-dev.txt
- Set up pre-commit hooks:
pre-commit install
Project Structure
The LangBot project is organized as follows:
LangBot/
├── data/ # Data directory (configs, plugins, etc.)
├── langbot/ # Core package
│ ├── bot/ # Bot implementations
│ ├── pipeline/ # Pipeline components
│ ├── model/ # Model providers
│ ├── plugin/ # Plugin system
│ ├── webui/ # WebUI backend
│ └── utils/ # Utility functions
├── tests/ # Test cases
├── web/ # WebUI frontend
├── main.py # Entry point
└── requirements.txt # Dependencies
Running LangBot in Development Mode
To run LangBot in development mode:
python main.py --debug
This will start LangBot with debug logging enabled.
WebUI Development
To develop the WebUI:
- Navigate to the web directory:
cd web
- Install dependencies:
npm install
- Start the development server:
npm run dev
- In another terminal, start LangBot with the WebUI enabled:
python main.py --webui
Testing
LangBot uses pytest for testing. To run the tests:
pytest
To run a specific test:
pytest tests/test_file.py::test_function
Code Style
LangBot follows the PEP 8 style guide with some modifications. We use black for code formatting and isort for import sorting.
To format your code:
black langbot tests
isort langbot tests
Creating a Pull Request
- Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
- Make your changes and commit them:
git add .
git commit -m "Add your feature or fix"
- Push your branch to GitHub:
git push origin feature/your-feature-name
- Create a pull request on GitHub
Documentation
When adding new features, make sure to update the documentation. The documentation is written in Markdown and is located in the QChatGPT-Wiki repository.
Getting Help
If you need help with development, you can:
- Join the community chat
- Open an issue on GitHub
- Check the existing documentation and code for examples