Commit Graph

90 Commits

Author SHA1 Message Date
e264d5f654 🐛 fix(ChatProcess.py): handle empty name by falling back to msg.author.name to prevent empty names in the chat
🔧 chore(ChatProcess.py): improve regex pattern to remove non-alphanumeric characters from name to match ^[a-zA-Z0-9_-]{1,64}$ pattern
2023-09-02 21:14:22 +02:00
1d2f5a3eed 🐛 fix(ChatProcess.py): add 'flags=re.UNICODE' to the re.sub() function to correctly handle non-ASCII characters in name 2023-09-02 21:12:13 +02:00
f896001305 🐛 fix(ChatProcess.py): handle exceptions and send error message with logs to the user when an error occurs during message processing
🐛 fix(channelSetup.py): format code to improve readability and adhere to PEP 8 style guide
🐛 fix(makeprompt.py): fix spacing issue in if statement
🐛 fix(openaicaller.py): format code to improve readability and adhere to PEP 8 style guide
2023-09-01 11:20:29 +02:00
d60102c0fd 🐛 fix(makeprompt.py): fix off-by-one error in limit check when fetching message history
 feat(makeprompt.py): include the original message in the fetched message history
2023-08-31 13:55:42 +02:00
64f8e69edc 🐛 fix(ChatProcess.py): create a copy of the functions list to prevent modifying the original list 2023-08-23 20:16:20 +02:00
9f4184b503 📝 chore(chat.txt): update guidelines for Botator's communication style in chat prompts
🐛 fix(openaiChat.py): set temperature to 1.3 for generating more diverse and creative responses
2023-08-23 16:05:47 +02:00
ec730ce7c6 📝 chore(chat.txt): update botator-roleplay chat guidelines to mention avoiding the use of gifs 2023-08-23 15:43:43 +02:00
cc28f3d4a1 🐛 fix(openaicaller.py): fix error in generate_response method where error_call argument is not properly handled
 feat(openaicaller.py): add default value for error_call argument in generate_response method to prevent potential errors
2023-08-23 15:39:19 +02:00
c7071ce7af feat(botator-roleplay): add text.txt file to store prompts for botator roleplay feature 2023-08-23 15:27:04 +02:00
2bb5f42df8 🐛 fix(openaicaller.py): fix condition to check for error_call argument in generate_response method 2023-08-23 15:24:12 +02:00
119d791820 🔧 chore(ChatProcess.py): use regular expression to remove non-alphanumeric characters from name to ensure it matches the required pattern 2023-08-23 15:22:15 +02:00
591b918c9f feat(chat.txt): add chat prompt for Botator roleplay to enhance user interaction and entertainment value
🔀 chore(variousclasses.py): add Botator roleplay character option to the list of available characters for premium users
2023-08-23 15:15:18 +02:00
f93e845520 🐛 fix(ChatProcess.py): import is_ignorable function from src.chatUtils.Chat to fix NameError
🔀 chore(ChatProcess.py): add is_ignorable function to returnCriterias in Chat class to handle ignorable messages
2023-08-21 21:40:35 +02:00
cf46727258 🐛 fix(channelSetup.py): change guild_id parameter type from int to str to handle cases where guild_id is not an integer
 feat(channelSetup.py): convert guild_id to string if it is not provided as a parameter to handle cases where guild_id is not passed
2023-08-21 12:34:14 +02:00
c236dfbb29 🐛 fix(channelSetup.py): fix parameter names in premium command to improve clarity and consistency
 feat(channelSetup.py): add optional parameters to premium command to allow setting premium status and expiration date for a specific guild
2023-08-21 12:32:10 +02:00
724a226f24 🐛 fix(ChatProcess.py): add early return if settings is None to prevent further execution when settings are not available
 feat(ChatProcess.py): add early return if getSettings() returns True to prevent further execution when settings retrieval fails
2023-08-21 11:54:30 +02:00
003ff17b9a Merge branch 'dev' of https://github.com/Paillat-dev/Botator into chat-processing-refactor 2023-08-21 11:38:28 +02:00
8771247612 🐛 fix(ChatProcess.py): remove unused imports and variables to improve code readability and maintainability
🐛 fix(ChatProcess.py): fix logic error in the return criteria for determining if the bot should respond to a message
🐛 fix(ChatProcess.py): fix typo in the 'functions' variable name
🐛 fix(ChatProcess.py): fix typo in the 'functions' parameter name in the request function call
🐛 fix(ChatProcess.py): fix typo in the 'functions' parameter name in the processFunctioncallResponse function call
🐛 fix(ChatProcess.py): remove unnecessary print statement in the processMessage function
🐛 fix(prompts.py): remove unnecessary print statement in the createPrompt function
🐛 fix(channelSetup.py): fix logic error in the is_owner function call
🐛 fix(moderation.py): remove unnecessary code for disabling moderation
🐛 fix(config.py): remove unnecessary code for creating tables in the database
🐛 fix(functionscalls.py): fix type hint for the return value of the call_function function
🐛 fix(guild.py): fix handling of serialized data in the load function
🐛 fix(SqlConnector.py): create setup_data table if it does not exist
2023-08-21 11:36:55 +02:00
fb18b7bb9b 📝 feat(chatUtils): add chat and text prompts for Botator and Quantum
- Added `chat.txt` and `text.txt` files for Botator and Quantum in the `chatUtils/prompts/botator` and `chatUtils/prompts/quantum` directories respectively.
- The `chat.txt` files contain instructions and guidelines for the behavior and responses of Botator and Quantum in a Discord chat.
- The `text.txt` files provide a brief introduction and background information about Botator and Quantum.

ℹ️ These prompts will be used to generate chat conversations and text responses for Botator and Quantum in a Discord server.

🔗 [Commit Link](https://github.com/repository/commit/commit-hash)
2023-08-20 12:42:41 +02:00
e4b8e2824b feat(server.ts): change port variable case from lowercase port to uppercase PORT to improve semantics
 feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port
🐛 fix(main.py): remove duplicate cog addition in main.py
 feat(main.py): add cogs.Help(bot) to the list of cogs in main.py
🐛 fix(main.py): remove redundant import statements in main.py
 feat(main.py): add on_guild_remove event handler in main.py
 feat(main.py): add on_guild_join event handler in main.py
 feat(main.py): add support for discord.Intents in main.py
 feat(main.py): add intents.message_content = True in main.py
 feat(main.py): add intents.default() in main.py
 feat(main.py): add discord.Bot(intents=intents, help_command=None) in main.py
 feat(main.py): add import statements in main.py
 feat(main.py): add from src.config import debug, discord_token in main.py
 feat(main.py): add import discord in main.py
 feat(main.py): add import src.config in main.py
 feat(main.py): add import src.cogs in main.py
 feat(main.py): add import src.cogs.chat in main.py
 feat(main.py): add import src.cogs.manage_chat in main.py
 feat(main.py): add import src.cogs.moderation in main.py
 feat(main.py): add import src.cogs.channelSetup in main.py
 feat(main.py): add import src.cogs.help in main.py
 feat(main.py): add import src.cogs.Chat in main.py
 feat(main.py): add import src.cogs.ManageChat in main.py
 feat(main.py): add import src.cogs.Moderation in main.py
 feat(main.py): add import src.cogs.ChannelSetup in main.py
 feat(main.py): add import src.cogs.Help in main.py
 feat(main.py): add import src.cogs.chat in main.py
 feat(main.py): add import src.cogs.manage_chat in main.py
 feat(main.py): add import src.cogs.moderation in main.py
 feat(main.py): add
2023-08-20 12:42:02 +02:00
1d4209dc0f 🔧 chore(requirements.txt): comment out py-cord and add pycord from GitHub repository to use the latest version
🔧 chore(ChatProcess.py): import fetch_messages_history function from Chat module to use it in Chat class
🔧 chore(ChatProcess.py): import moderate and ModerationError from utils.misc module to use them in Chat class
🔧 chore(Chat.py): add fetch_messages_history function to fetch message history from a channel
🔧 chore(Chat.py): add formatContext function to format the context for the bot to use
🔧 chore(Chat.py): raise an exception if no openai api key is set
🔧 chore(Chat.py): add logic to filter and format messages for the context
🔧 chore(Chat.py): fix typo in the import statement for ModerationError
🔧 chore(Chat.py): fix typo in the import statement for moderate
🔧 chore(Chat.py): fix typo in the import statement for fetch_messages_history
🔧 chore(prompts.py): create prompts dictionary and read chat and text prompts from files for each character
🔧 chore(prompts.py): create createPrompt function to create a prompt from the messages list
🔧 chore(prompts.py): create createTextPrompt function to create a text prompt from the messages list
🔧 chore(prompts.py): create createChatPrompt function to create a chat prompt from the messages list
🔧 chore(requesters/llama.py): create llama function as a placeholder
🔧 chore(requesters/llama2.py): create llama2 function as a placeholder
🔧 chore(requesters/openaiChat.py): import openai_caller from utils.openaicaller module
🔧 chore(requesters/openaiChat.py): create openaiChat function as a placeholder
🔧 chore(requesters/openaiText.py): create openaiText function as a placeholder
🔧 chore(requesters/request.py): import openaiChat, openaiText, llama, and llama2 functions from respective modules
🔧 chore(requesters/request.py): create request function to handle different models and make requests
2023-08-19 15:30:57 +02:00
775f8758b7 🎨 chore(*): run black to format the code 2023-08-19 14:17:16 +02:00
3a955d4379 🐛 fix(main.py): handle on_application_command_error with proper error handling and response
 feat(main.py): add ChatProcess module for handling chat-related functionality
🔧 refactor(main.py): import necessary modules and update bot.add_cog calls
🔧 refactor(server.ts): change port variable case from lowercase port to uppercase PORT to improve semantics
 feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port
🔧 refactor(cogs/__init__.py): import ChannelSetup cog
 feat(cogs/channelSetup.py): add ChannelSetup cog for setting up channels and server-wide settings
🔧 refactor(cogs/setup.py): import SlashCommandGroup and guild_only from discord module
 feat(cogs/setup.py): add setup_channel command for adding and removing channels
 feat(cogs/setup.py): add api command for setting API keys
 feat(cogs/setup.py): add premium command for setting guild to premium
🔧 refactor(cogs/settings.py): temporarily disable images command due to maintenance
🔧 refactor(config.py): remove unnecessary code related to moderation table
 feat(guild.py): add Guild class for managing guild-specific data and settings
 feat(SqlConnector.py): add SQLConnection and _sql classes for managing SQLite connections
 feat(variousclasses.py): add models, characters, and apis classes for autocomplete functionality in slash commands
2023-08-19 14:16:30 +02:00
a77253ebdc 🎨 chore(*): run black to format the code 2023-08-18 10:11:14 +02:00
f19fe728da 🔀 refactor(functionscalls.py): refactor font_matches dictionary into a FontMatches class for better readability and maintainability 2023-08-18 10:07:52 +02:00
59725a04c2 📝 docs(gpt-3.5-turbo.txt): update guidelines for using gifs in replies
The guidelines for using gifs in replies have been updated. It is mentioned that gifs are a great way to represent emotion and add flavor to the conversation. However, it is advised not to use them too often to avoid being cringe. Additionally, users are instructed to use the pronouns Master/Brain when addressing the AI.
2023-08-17 17:37:32 +02:00
c8997ab418 🎨 chore(*): run black to format the code 2023-08-16 09:46:28 +02:00
ee825be892 🐛 fix(makeprompt.py): import Hasher class from src.utils.misc to resolve NameError
🔒 chore(makeprompt.py): add user hashing to prevent abuse and enable user banning if necessary
2023-08-16 09:44:01 +02:00
a02bfb5cbc 🐛 fix(makeprompt.py): await the moderate function call to properly handle moderation before increasing depth 2023-08-16 09:31:00 +02:00
9f257b4126 🐛 fix(makeprompt.py): import ModerationError from src.utils.misc to handle moderation errors in chatgpt_process function
🐛 fix(makeprompt.py): raise ModerationError with message "Too many recursive messages" when answering recursively in chatgpt_process function
2023-08-16 09:26:03 +02:00
fa3eb3da0a 🐛 fix(functionscalls.py): await the moderate function calls to properly handle asynchronous moderation checks 2023-08-16 09:25:43 +02:00
7c21934bc0 🔀 chore(functionscalls.py): update import statement for the 'moderate' function to reflect the correct file path
🔀 chore(functionscalls.py): update import statement for the 'tenor_api_key' variable to reflect the correct file path
2023-08-16 09:22:31 +02:00
303d3c07ac 🐛 fix(chat.py): fix typo in message.channel.send() method call
🔒 chore(chat.py): add moderation check for message content in call_function() to prevent sending blocked messages
🔒 chore(chat.py): add moderation check for query in call_function() to prevent sending blocked queries
🔒 chore(makeprompt.py): add moderation check for content in chatgpt_process() to prevent sending blocked content
🔒 chore(makeprompt.py): add depth check to prevent recursive answering in chatgpt_process()
2023-08-16 09:20:29 +02:00
d520b8b87c 🐛 fix(chat.py): add missing import statement for asyncio module
🐛 fix(chat.py): fix import statement for banusr module
 feat(chat.py): add functionality to ban and unban users with botator!ban and botator!unban commands
 feat(chat.py): add functionality to send messages from banned users after a delay
 feat(banusr.py): create banusr module to handle banning and unbanning of users
 feat(banusr.py): add functionality to ban a user by appending their ID to banend_users list
 feat(banusr.py): add functionality to unban a user by removing their ID from banend_users list
2023-08-15 19:20:12 +02:00
f2e1b2ffe3 🔧 chore(makeprompt.py): refactor prepare_messages and chatgpt_process functions to accept an error_call function for error handling
🔧 chore(makeprompt.py): refactor chat_process function to use the error_call function for error handling
2023-08-15 18:53:22 +02:00
df3e01900e 🐛 fix(functionscalls.py): reformat code for better readability and maintainability 2023-08-15 18:50:25 +02:00
30ef28ce49 🐛 fix(functionscalls.py): add timeout parameter to evaluate_math function to limit execution time and prevent potential abuse or infinite loops 2023-08-15 18:49:51 +02:00
d057fc7a78 🎨 chore(*): run black to format the code 2023-08-15 14:22:05 +02:00
be771f7c22 🐛 fix(makeprompt.py): add missing 'depth' parameter to recursive function call to prevent infinite recursion 2023-08-15 14:15:57 +02:00
f79bdd2086 🐛 fix(makeprompt.py): import FuntionCallError from src.functionscalls to fix NameError
 feat(makeprompt.py): add depth parameter to chatgpt_process function to limit recursive function calls and raise FuntionCallError if exceeded
2023-08-15 14:15:35 +02:00
4b8070b413 🔧 chore(requirements.txt): add 'simpleeval' package for math expression evaluation
🔧 chore(functionscalls.py): add 'evaluate_math' function to evaluate math expressions
🔧 chore(makeprompt.py): refactor 'chatgpt_process' to use 'prepare_messages' function for message preparation
2023-08-15 14:11:21 +02:00
6de23a1a33 🔇 chore(makeprompt.py): remove debug print statements for messages and response variables 2023-08-15 12:48:00 +02:00
7bc5f03e14 🔧 fix(functionscalls.py): fix typo in FunctionCallError class name
 feat(functionscalls.py): add call_function function to handle function calls with name and arguments
🔧 fix(makeprompt.py): remove individual function imports from functionscalls and use call_function instead
2023-08-15 12:42:18 +02:00
88d65e9f79 🎨 chore(*): run black to format the code 2023-08-15 12:38:47 +02:00
456e147785 🐛 fix(functionscalls.py): fix typo in FunctionCallError class name
 feat(functionscalls.py): add error handling for missing arguments in function calls
🐛 fix(makeprompt.py): fix typo in function_call variable name
🔀 chore(gpt-3.5-turbo.txt): update instructions to only use provided functions
2023-08-15 12:38:37 +02:00
68ff639f27 🐛 fix(makeprompt.py): reverse the order of fetched messages to ensure correct chronological order
🔥 chore(makeprompt.py): remove unnecessary oldest_first parameter in channel.history() calls
2023-08-15 11:33:29 +02:00
1e8eaf5ae0 🔧 chore(moderation.py): comment out unfinished ban command to prevent errors during development
🔧 chore(moderation.py): import commands from discord.ext to fix missing reference error
2023-08-15 11:23:52 +02:00
737db1aead 🐛 fix(config.py): fix the path to the gpt-3.5-turbo.txt file by using os.path.join instead of os.path.abspath and os.path.dirname 2023-08-15 11:10:12 +02:00
cc5fd3aa7a 🐛 fix(makeprompt.py): refactor condition to check if message is ignorable using a separate function for better readability and maintainability 2023-08-15 11:05:52 +02:00
f04a04801b 🎨 chore(*): run black to format the code 2023-08-15 11:04:33 +02:00