# RayAI and Backend Server This project contains the RayAI bot source code as well as the backend server that supports its operations. **Note**: A `llama-cpp-python` OpenAI Emulation Server is required alongside the backend server. The server in this code is configured to run on `127.0.0.1:8002`. ## Prerequisites - Node.js installed - Python installed - `llama-cpp-python` server ### Running the llama-cpp-python Server 1. Install `llama-cpp-python` with server capabilities: ```bash pip install llama-cpp-python[server] ``` 2. Start the server: ```bash python3 -m llama_cpp.server --model ``` ## Cloning the Repository 1. Clone the repository: ```bash git clone https://git.ssh.surf/snxraven/rayai cd rayai ``` ## Backend Server Setup 1. Navigate to the backend server directory and install dependencies: ```bash cd backend-server npm install ``` 2. Create a `.env` file in the `backend-server` directory with the following environment variables: ```env PROMPT= ABUSE_KEY= MAX_CONTENT_LENGTH=2000 (optional) API_KEY= PATH_KEY= ``` 3. Start the backend server: ```bash node backend-server.js ``` ## Discord Bot Setup 1. Navigate to the bot directory and install dependencies: ```bash cd ../bot npm install ``` 2. Create a `.env` file in the `bot` directory with the following environment variables: ```env THE_TOKEN= CHANNEL_IDS= ROOT_IP= ROOT_PORT= API_PATH= MAX_CONTENT_LENGTH=8000 (optional, default is 8000) MAX_TOKENS= REPEAT_PENALTY= OVERFLOW_DELAY=3 (optional, delay in seconds between message chunks) ``` 3. Start the Discord bot: ```bash node discord-bot.js ``` ## Summary 1. **Run the llama-cpp-python server** to emulate the OpenAI API. 2. **Set up and run the backend server** to handle API requests, conversation history, and additional functionalities. 3. **Set up and run the Discord bot** to interact with users and utilize the backend server for processing. Ensure all environment variables are correctly configured, dependencies are installed, and both servers are running to enable full functionality of RayAI and its backend server.