@ -14,6 +14,7 @@ from services.environment_service import EnvService
BOT_NAME = EnvService . get_custom_bot_name ( )
BOT_NAME = EnvService . get_custom_bot_name ( )
class TextService :
class TextService :
def __init__ ( self ) :
def __init__ ( self ) :
pass
pass
@ -230,7 +231,8 @@ class TextService:
] . history
] . history
]
]
)
)
+ " \n " + BOT_NAME
+ " \n "
+ BOT_NAME
)
)
tokens = converser_cog . usage_service . count_tokens ( new_prompt )
tokens = converser_cog . usage_service . count_tokens ( new_prompt )
@ -302,7 +304,11 @@ class TextService:
if not redo_request :
if not redo_request :
converser_cog . conversation_threads [ id ] . history . append (
converser_cog . conversation_threads [ id ] . history . append (
EmbeddedConversationItem (
EmbeddedConversationItem (
" \n " + BOT_NAME + str ( response_text ) + " <|endofstatement|> \n " , 0
" \n "
+ BOT_NAME
+ str ( response_text )
+ " <|endofstatement|> \n " ,
0 ,
)
)
)
)
@ -543,9 +549,12 @@ class TextService:
# Since this is async, we don't want to allow the user to send another prompt while a conversation
# Since this is async, we don't want to allow the user to send another prompt while a conversation
# prompt is processing, that'll mess up the conversation history!
# prompt is processing, that'll mess up the conversation history!
if message . author . id in converser_cog . awaiting_responses :
if message . author . id in converser_cog . awaiting_responses :
message = await message . reply ( embed = discord . Embed (
message = await message . reply (
embed = discord . Embed (
title = f " You are already waiting for a response, please wait and speak afterwards. " ,
title = f " You are already waiting for a response, please wait and speak afterwards. " ,
color = 0x808080 ) )
color = 0x808080 ,
)
)
# get the current date, add 10 seconds to it, and then turn it into a timestamp.
# get the current date, add 10 seconds to it, and then turn it into a timestamp.
# we need to use our deletion service because this isn't an interaction, it's a regular message.
# we need to use our deletion service because this isn't an interaction, it's a regular message.
@ -560,8 +569,12 @@ class TextService:
return
return
if message . channel . id in converser_cog . awaiting_thread_responses :
if message . channel . id in converser_cog . awaiting_thread_responses :
message = await message . reply ( embed = discord . Embed ( title = f " This thread is already waiting for a response, please wait and speak afterwards. " , color = 0x808080 ) )
message = await message . reply (
embed = discord . Embed (
title = f " This thread is already waiting for a response, please wait and speak afterwards. " ,
color = 0x808080 ,
)
)
# get the current date, add 10 seconds to it, and then turn it into a timestamp.
# get the current date, add 10 seconds to it, and then turn it into a timestamp.
# we need to use our deletion service because this isn't an interaction, it's a regular message.
# we need to use our deletion service because this isn't an interaction, it's a regular message.