Refactor discord_bot.py code a bit and improve comments
This commit is contained in:
@@ -43,36 +43,41 @@ python -m fjerkroa_bot --config config.toml
|
||||
Create a `config.toml` file with the following configuration options:
|
||||
|
||||
```toml
|
||||
openai-token = "your_openai_api_key"
|
||||
openai-key = "OPENAIKEY"
|
||||
discord-token = "DISCORDTOKEN"
|
||||
model = "gpt-3.5-turbo"
|
||||
temperature = 0.3
|
||||
max-tokens = 100
|
||||
top-p = 0.9
|
||||
presence-penalty = 0
|
||||
frequency-penalty = 0
|
||||
history-limit = 50
|
||||
history-per-channel = 3
|
||||
history-directory = "./history"
|
||||
system = "You are conversing with an AI assistant designed to answer questions and provide helpful information."
|
||||
short-path = [
|
||||
["channel_regex_1", "user_regex_1"],
|
||||
["channel_regex_2", "user_regex_2"],
|
||||
]
|
||||
fix-model = "text-davinci-002"
|
||||
fix-description = "Please fix the text to a valid JSON format."
|
||||
max-tokens = 1024
|
||||
temperature = 0.9
|
||||
top-p = 1.0
|
||||
presence-penalty = 1.0
|
||||
frequency-penalty = 1.0
|
||||
history-limit = 10
|
||||
welcome-channel = "welcome"
|
||||
staff-channel = "staff"
|
||||
join-message = "Hi! I am {name}, and I am new here."
|
||||
short-path = [['^news$', '^news-bot$'], ['^mod$', '.*']]
|
||||
system = "You are an smart AI"
|
||||
```
|
||||
|
||||
- `openai-token`: Your OpenAI API key.
|
||||
- `model`: The OpenAI GPT model to use.
|
||||
- `temperature`: Controls the randomness of the generated responses.
|
||||
- `max-tokens`: Maximum number of tokens allowed in a response.
|
||||
- `top-p`: Controls the diversity of the generated responses.
|
||||
- `presence-penalty`: Controls the penalty for new token occurrences.
|
||||
- `frequency-penalty`: Controls the penalty for frequent token occurrences.
|
||||
- `history-limit`: Maximum number of messages to store in the conversation history.
|
||||
- `history-per-channel`: Maximum number of messages per channel in the conversation history.
|
||||
- `history-directory`: Directory to store the conversation history as a file.
|
||||
- `system`: System message to be included in the conversation.
|
||||
- `discord-token`: The token for the Discord bot account.
|
||||
- `openai-token`: The API key for the OpenAI API.
|
||||
- `model`: The OpenAI model name to be used for generating AI responses.
|
||||
- `temperature`: The temperature for the AI model's output.
|
||||
- `history-limit`: The maximum number of messages to maintain in the conversation history.
|
||||
- `history-directory`: The directory where the conversation history will be stored.
|
||||
- `history-per-channel`: The number of history items to keep per channel.
|
||||
- `max-tokens`: The maximum number of tokens in the generated AI response.
|
||||
- `top-p`: The top-p sampling value for the AI model's output.
|
||||
- `presence-penalty`: The presence penalty value for the AI model's output.
|
||||
- `frequency-penalty`: The frequency penalty value for the AI model's output.
|
||||
- `staff-channel`: The name of the channel where staff messages will be sent.
|
||||
- `welcome-channel`: The name of the channel where welcome messages will be sent.
|
||||
- `join-message`: The message template to be sent to AI when a user joins the server, triggers that way the AI to write something to the user.
|
||||
- `ignore-channels`: A list of channels to be ignored by the bot.
|
||||
- `additional-responders`: A list of channels that should have a separate AI responder with separated history.
|
||||
- `short-path`: List of channel and user regex patterns to apply short path (skip sending message to AI, just fill the history).
|
||||
- `fix-model`: OpenAI GPT model to use for fixing invalid JSON responses.
|
||||
- `fix-description`: Description of the fixing process.
|
||||
- `system`: The system message template for the AI conversation.
|
||||
- `fix-model`: The OpenAI model name to be used for fixing the AI responses.
|
||||
- `fix-description`: The description for the fix-model's conversation.
|
||||
|
||||
register-python-argcomplete
|
||||
Reference in New Issue
Block a user