An AI-powered chatbot for Team Fortress 2 fans and players.
[!NOTE] If you're interested, you can check out the new updated version here, but beware —
here be dragonsnothing is documented yet and stability is not guaranteed.Table Of Contents
Edit configuration file named config.ini and set the required configuration variables in GENERAL
section, such as API
keys and file paths. You can leave the rest as it is.
[GENERAL]
TF2_LOGFILE_PATH=H:\Programs\Steam\steamapps\common\Team Fortress 2\tf\console.log
OPENAI_API_KEY=sk-************************************************
...
-rpt -usercon +ip 0.0.0.0 +rcon_password password +hostport 42465 +con_timestamp 1 +net_start
Clone the project repository:
git clone https://github.com/dborodin836/TF2-GPTChatBot.git
cd TF2-GPTChatBot
Linux:
python3 -m venv venv
source venv/bin/activate
Windows:
py -m venv venv
venv/bin/activate
pip install -r requirements.txt
Edit configuration file named config.ini and set the required configuration variables in GENERAL section, such as API keys and file paths. You can leave the rest as it is.
[GENERAL]
TF2_LOGFILE_PATH=H:\Programs\Steam\steamapps\common\Team Fortress 2\tf\console.log
OPENAI_API_KEY=sk-************************************************
...
-rpt -usercon +ip 0.0.0.0 +rcon_password password +hostport 42465 +con_timestamp 1 +net_start
python main.py
The application should now be running and ready to use.
NOTE: You can create your own executable using this command
Windows:
pyinstaller --onefile --clean -n TF2-GPTChatBot --icon icon.ico -w --add-data "icon.png;." main.py
Program comes with built-in chat commands. You can customize existent ones or add new ones to your liking. This section only commands that are provided by OpenAI. This is because app was originally designed to support OpenAI, but with time it has evolved to support any provider. But there are many other commands and providers (GroqCloud, TextGenerationWebUI, etc.) available, and some of them are free to use. But they are not enabled by default, and you need to enable them manually.
There are also thing so-called prompts which allow you to customize how the model will response.
Check project Wiki for more info.
These commands are used to generate a quick response from a language model.
Available commands: !gpt3
, !gpt4
and more!
!gpt3 What is the meaning of life?
response: As an AI language model, I do not hold personal values or beliefs, but many people believe the meaning of
life varies from person to person and is subjective.
!gpt3 \demoman Hi!
response: Oy, laddie! Yer lookin' for some advice? Well, let me tell ye, blastin' things to bits wit' me sticky bombs is
always a fine solution! Just remember to always have a bottle of scrumpy on hand, and never trust a Spy.
These commands are used to engage in conversations with the AI language model. In this community, chats are divided into two main categories: Global and Private.
Global Chats: 🌍 These are accessible to all users on the server. It's the go-to spot for sharing thoughts, engaging in discussions, and having a good time together.
Private Chats: 🤫 These are your personal zone where you can have uninterrupted conversations. Keep in mind, though, that even though it's private, others might still see it. 👀
Available commands: !cgpt
(global), !pc
(private) and more!
!cgpt Remember this number 42!
response: Okay, I will remember the number 42!
!cgpt What is the number?
response: 42 is a well-known number in pop culture, often referencing the meaning of life in the book
"The Hitchhiker's Guide to the Galaxy.
Simply clears the chat history for specified command(s).
Command: !clear [\global] [\user='username'] [commands]
Description: Clears the chat history for specified command(s).
Calling without arguments clears own private chat history for any user.
Global Option (admin only):
\global Clears global chat history for specified command(s).
User Option (admin only):
\user='username' Clears private chat history for the specified user(s) for specified command(s).
Examples:
For admin:
!clear \global solly
- Will clear global chat for solly command
!clear \global \user='Pootis' \user='Soldier' solly
- Will clear global and private chat for solly command for users with username "Pootis" and "Soldier"
For everyone:
!clear solly heavy
- Will clear private chats for 'solly' and 'heavy' commands
Please follow these steps to set up a custom model for text generation using the oobabooga/text-generation-webui project:
Open the config.ini
file and set the ENABLE_CUSTOM_MODEL
variable to 1
.
Next, install the oobabooga/text-generation-webui
using installer. You can find the installation instructions
easily in the README.md file of that repository.
Download the model of your choice for text generation.
Launch the text-generation-webui
application, ensuring that you include the --api
option in the launch
settings (CMD_FLAGS.txt
file).
NOTE: If you're running the api on a remote server you might try
--public-api
option.
After the application starts, copy the OpenAI-compatible API URL provided by the application.
Open the config.ini
file once more and find the CUSTOM_MODEL_HOST
variable. Paste the previously copied URL as
the value for this variable.
Save the changes made to the config.ini
file.
Of course not! It's impossible to explain everything in one place. If you want to know more here are listed some things that were left unexplained, and some tips and tricks: unexplained_explained.md or at project Wiki.
You cannot have a nickname that starts with a command name, such as !cgpt
In non-English localizations of the game, some of the features may be broken
To successfully launch the applications, you need to start TF2-GptChatBot and TF2 Bot Detector (do NOT launch TF2 via TF2BD). Set the following launch parameters in Steam:
-rpt -high -usercon +developer 1 +contimes 0 +sv_rcon_whitelist_address 127.0.0.1 +sv_quota_stringcmdspersecond 1000000 +alias cl_reload_localization_files +ip 0.0.0.0 +rcon_password password +hostport 42465 +con_timestamp 1 +net_start +con_timestamp 1 -condebug
And then launch TF2 through Steam.
NOTE: TF2BD may partially work without setting the launch parameters, but some features may not function properly.
We welcome contributions to this project!
If you have any questions or problems with the project, please open an issue and we'll be happy to help. Please be respectful to everyone in the project :).