Files
LangBot/docs/en/develop/dev-config.md
T
2025-05-13 15:25:41 +00:00

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

  1. Fork the LangBot repository on GitHub
  2. Clone your fork:
git clone https://github.com/your-username/LangBot.git
cd LangBot
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
pip install -r requirements-dev.txt
  1. 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:

  1. Navigate to the web directory:
cd web
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. 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

  1. Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
  1. Make your changes and commit them:
git add .
git commit -m "Add your feature or fix"
  1. Push your branch to GitHub:
git push origin feature/your-feature-name
  1. 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