mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
[BUG] davinci prompt was returning none
This commit is contained in:
@@ -23,6 +23,7 @@ async def extract_emoji(string):
|
|||||||
# mach any custom emoji that is just after a "+", returns a tuple with the name and the id of the emoji
|
# mach any custom emoji that is just after a "+", returns a tuple with the name and the id of the emoji
|
||||||
custom_emoji_pattern = r"(?<=\+)<:(.+):(\d+)>"
|
custom_emoji_pattern = r"(?<=\+)<:(.+):(\d+)>"
|
||||||
# now we match the pattern with the string
|
# now we match the pattern with the string
|
||||||
|
debug("Extracting emojis from string" + string)
|
||||||
matches = re.findall(pattern, string)
|
matches = re.findall(pattern, string)
|
||||||
custom_emoji_matches = re.findall(custom_emoji_pattern, string)
|
custom_emoji_matches = re.findall(custom_emoji_pattern, string)
|
||||||
found_emojis = []
|
found_emojis = []
|
||||||
@@ -276,7 +277,7 @@ async def chat_process(self, message):
|
|||||||
pretend_to_be = data_dict["pretend_to_be"]
|
pretend_to_be = data_dict["pretend_to_be"]
|
||||||
pretend_to_be = f"In this conversation, the assistant pretends to be {pretend_to_be}" if data_dict[ "pretend_enabled"] else ""
|
pretend_to_be = f"In this conversation, the assistant pretends to be {pretend_to_be}" if data_dict[ "pretend_enabled"] else ""
|
||||||
debug(f"Pretend to be: {pretend_to_be}")
|
debug(f"Pretend to be: {pretend_to_be}")
|
||||||
prompt = get_prompt(guild_data, data_dict, message, pretend_to_be)
|
prompt = get_prompt(guild_data, data_dict, message, pretend_to_be) + "\n"
|
||||||
|
|
||||||
prompt_handlers = {
|
prompt_handlers = {
|
||||||
"gpt-3.5-turbo": gpt_prompt,
|
"gpt-3.5-turbo": gpt_prompt,
|
||||||
@@ -508,11 +509,14 @@ async def gpt_prompt(bot, messages, message, data_dict, prompt, guild_data):
|
|||||||
async def davinci_prompt(self, messages, message, data_dict, prompt, guild_data):
|
async def davinci_prompt(self, messages, message, data_dict, prompt, guild_data):
|
||||||
debug("davinci_prompt")
|
debug("davinci_prompt")
|
||||||
for msg in messages:
|
for msg in messages:
|
||||||
if not await self.check_moderate(data_dict["api_key"], message, msg):
|
if not await check_moderate(data_dict["api_key"], message, msg):
|
||||||
content = await replace_mentions(content, self.bot)
|
content = msg.content
|
||||||
|
content = await replace_mentions(content, self)
|
||||||
prompt += f"{msg.author.name}: {content}\n"
|
prompt += f"{msg.author.name}: {content}\n"
|
||||||
prompt.append(await check_easter_egg(message, prompt))
|
# Disabled eastereggs because of compatibility issues with the gpt-3.5 format
|
||||||
prompt = prompt + f"\n{self.bot.user.name}:"
|
# prompt.append(await check_easter_egg(message, prompt))
|
||||||
|
debug("prompt: " + prompt)
|
||||||
|
prompt = prompt + f"\n{self.user.name}:"
|
||||||
response = ""
|
response = ""
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
try:
|
try:
|
||||||
@@ -540,5 +544,4 @@ async def davinci_prompt(self, messages, message, data_dict, prompt, guild_data)
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
if response != None:
|
if response != None:
|
||||||
break
|
return response
|
||||||
return response
|
|
||||||
Reference in New Issue
Block a user