This repository contains the code for the Wittgenstein AI BOT and all you need in order to run it by yourself! It uses PM2 for process management and loads environment variables from a .env
file.
To get started, first clone the repository and install the necessary dependencies. Run the following commands:
git clone https://github.com/your_username/wittgenstein-bot.git
cd wittgenstein-bot
npm install
### Configure Environment Variables
Create a `.env` file from the sample provided and populate it with your API keys:
cp .env.sample .env
sudo nano .env
#Save changes with ctrl+o and return (enter)
### Then, we need to build our /dist directory because of the project is made in TypeScript:
npm run build
Then, just save the file and run it by using PM2 or nohup!
Use PM2 to start the application using the ecosystem configuration file located in the config directory:
- Install PM2 in your server/system
Then, in the root of you recently created build directory, just start the pm2 instance by using:
pm2 start config/ecosystem.config.js
If you need to restart or close the PM2 instance, just follow the commands on the official PM2 website PM2.
Nevertheless, the basic commands are as follow:
- pm2 list
- pm2 status
- pm2 stop
- pm2 restart
- pm2 delete
- pm2 kill
If you leading to use nohup in your Linux system, then you can just run the bot by using the following command in the repository directory:
nohup node index.js > output.log 2>&1 &
Again, if you need to close the background process, you will need to check current NodeJS running process:
ps aux | grep node
Then, check the second column, the PID numeric value, and kill the process:
kill -9 PID
-
ProcessAnyMessage must be more generic to logging through winston dependency.
-
Assignations for config statements like:
-
- Max number of queries per user
-
- Max number of queries per day
-
- Admin/premium users list
-
- More...