Installation#

Note

Before proceeding, ensure Visual Studio Code (VSCode) is installed on your system. If it’s not set up yet, please follow our VSCode guide.

Create Project Directory#

For Windows users, opt for WSL2 with Ubuntu 22.04 or Debian. For setup details, refer to our WSL2 installation guide.

After setting up WSL2:

  1. Launch VSCode.

  2. Activate the Remote extension using one of the following methods: - Click on the green remote indicator in the bottom-left corner and select Remote-WSL: New Window. - Use the command palette (Ctrl+Shift+P) and run:

    Remote-WSL: New Window
    
  3. Once inside WSL, update the system’s package list:

    sudo apt update
    
  4. Navigate to the chosen directory for the project:

    cd path/to/your/directory
    

Clone Git Repository#

  1. In your chosen directory within VSCode’s integrated terminal, execute the following command to clone the TianGong AI Chat repository:

    git clone https://github.com/linancn/TianGong-AI-Chat.git
    
  2. After cloning, you have two options to open the project in VSCode:

    1. In the VSCode menu, select File > Open Folder and choose the TianGong-AI-Chat directory.

    2. Or, navigate into the project directory using the terminal:

    cd TianGong-AI-Chat
    

You should now have the TianGong AI Chat project files ready in your VSCode workspace.

Setup Project#

Note

Before we start, you need to ensure that Python is installed on your system. If you have not installed Python yet, please refer to our Python installation guide.

Setup Virtual Environment#

  1. Create a virtual environment: This step sets up an isolated Python environment in the current directory.

    python3.11 -m venv .venv
    
  2. Activate the virtual environment: Activating the environment ensures that the Python interpreter used is from this isolated environment.

    source .venv/bin/activate
    

Install Dependencies#

Ensuring that you have the right packages is crucial for the functionality of the TianGong AI Chat.

  1. Upgrade pip: Keeping pip (the Python package installer) up-to-date ensures compatibility and the latest features.

    pip install --upgrade pip
    
  2. Install required packages: This will fetch and install the packages listed in requirements.txt.

    pip install -r requirements.txt
    

    Tip

    If you encounter network-related issues during package installation, consider using alternative mirrors. Here are some options:

    • Tsinghua University mirror:

      pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
      
    • Aliyun mirror:

      pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
      
    • Douban mirror:

      pip install -r requirements.txt -i https://pypi.douban.com/simple/
      
  3. Upgrade project packages: This ensures that all the packages are at their latest compatible versions.

    pip install -r requirements.txt --upgrade
    

With the installation process successfully completed, you’ve laid a solid foundation for TianGong AI Chat on your system. Next, let’s proceed with the essential configuration to get your chatbot up and running.