diff --git a/cogs/text_service_cog.py b/cogs/text_service_cog.py index eab03c2..02bdf3e 100644 --- a/cogs/text_service_cog.py +++ b/cogs/text_service_cog.py @@ -841,7 +841,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): elif not private: message_thread = await ctx.respond( embed=discord.Embed( - title=f"{user.name} 's conversation with GPT3", color=0x808080 + title=f"{user.name}'s conversation with GPT3", color=0x808080 ) ) # Get the actual message object for the message_thread @@ -920,6 +920,10 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): self.conversation_thread_owners[user_id_normalized] = thread.id overrides = self.conversation_threads[thread.id].get_overrides() + await thread.send( + f"<@{str(ctx.user.id)}> is the thread owner." + ) + await thread.send( embed=EmbedStatics.generate_conversation_embed( self.conversation_threads, thread, opener, overrides @@ -938,7 +942,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): if not self.pinecone_service: self.conversation_threads[thread.id].history.append( EmbeddedConversationItem( - f"\n'{ctx.author.display_name}': {opener} <|endofstatement|>\n", + f"\n{ctx.author.display_name}: {opener} <|endofstatement|>\n", 0, ) ) @@ -958,6 +962,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): top_p_override=overrides["top_p"], frequency_penalty_override=overrides["frequency_penalty"], presence_penalty_override=overrides["presence_penalty"], + user=user, model=self.conversation_threads[thread.id].model, custom_api_key=user_api_key, ) diff --git a/conversation_starter_pretext_minimal.txt b/conversation_starter_pretext_minimal.txt index 2c7ab53..9befb86 100644 --- a/conversation_starter_pretext_minimal.txt +++ b/conversation_starter_pretext_minimal.txt @@ -1,11 +1,13 @@ -Instructions for GPTie: +Instructions for you: The conversations are in this format, there can be an arbitrary amount of newlines between chat entries. can be any name, pay attention to who's talking. The text "<|endofstatement|>" is used to separate chat entries and make it easier for you to understand the context: : [MESSAGE 1] <|endofstatement|> -GPTie: [RESPONSE TO MESSAGE 1] <|endofstatement|> +: [RESPONSE TO MESSAGE 1] <|endofstatement|> : [MESSAGE 2] <|endofstatement|> -GPTie: [RESPONSE TO MESSAGE 2] <|endofstatement|> +: [RESPONSE TO MESSAGE 2] <|endofstatement|> + + will be given to you in an actual conversation. ... -Never say "<|endofstatement|>". Never say "GPTie:" in your response either. +Never say "<|endofstatement|>". Never say or in your response either. diff --git a/models/openai_model.py b/models/openai_model.py index e2b0f2c..794dbf7 100644 --- a/models/openai_model.py +++ b/models/openai_model.py @@ -533,6 +533,7 @@ class Model: presence_penalty_override=None, max_tokens_override=None, model=None, + stop=None, custom_api_key=None, ) -> ( Tuple[dict, bool] @@ -554,6 +555,7 @@ class Model: payload = { "model": self.model if model is None else model, "prompt": prompt, + "stop": "" if stop is None else stop, "temperature": self.temp if temp_override is None else temp_override, "top_p": self.top_p if top_p_override is None else top_p_override, "max_tokens": self.max_tokens - tokens diff --git a/services/text_service.py b/services/text_service.py index e2d367d..6e7e6ea 100644 --- a/services/text_service.py +++ b/services/text_service.py @@ -35,6 +35,7 @@ class TextService: from_edit_command=False, codex=False, model=None, + user=None, custom_api_key=None, edited_request=False, redo_request=False, @@ -68,6 +69,8 @@ class TextService: else prompt ) + stop = f"{ctx.author.display_name if user is None else user.display_name}:" + from_context = isinstance(ctx, discord.ApplicationContext) if not instruction: @@ -273,6 +276,7 @@ class TextService: frequency_penalty_override=frequency_penalty_override, presence_penalty_override=presence_penalty_override, model=model, + stop=stop if not from_ask_command else None, custom_api_key=custom_api_key, ) @@ -282,9 +286,7 @@ class TextService: ) if from_ask_command or from_action: - # Append the prompt to the beginning of the response, in italics, then a new line - response_text = response_text.strip() - response_text = f"***{prompt}***\n\n{response_text}" + response_text = f"***{prompt}***{response_text}" elif from_edit_command: if codex: response_text = response_text.strip() @@ -597,7 +599,7 @@ class TextService: message.channel.id ].history.append( EmbeddedConversationItem( - f"\n'{message.author.display_name}': {prompt} <|endofstatement|>\n", + f"\n{message.author.display_name}: {prompt} <|endofstatement|>\n", 0, ) )