From 5d7fb04ad648684a97134c9016fd1e8368fd8e25 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Sat, 6 May 2023 00:58:48 +0200 Subject: [PATCH] user_name derps --- matrix_pygmalion_bot/bot/ai/langchain.py | 2 ++ matrix_pygmalion_bot/bot/core.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/matrix_pygmalion_bot/bot/ai/langchain.py b/matrix_pygmalion_bot/bot/ai/langchain.py index cb9ec6d..40b03aa 100644 --- a/matrix_pygmalion_bot/bot/ai/langchain.py +++ b/matrix_pygmalion_bot/bot/ai/langchain.py @@ -266,6 +266,8 @@ class AI(object): # output = llm_chain(inputs={"ai_name": self.bot.name, "persona": self.bot.persona, "scenario": self.bot.scenario, "human_name": chat_human_name, "ai_name_chat": self.bot.name, "chat_history": "", "input": message.content})['results'][0]['text'] stop = ['<|endoftext|>', f"\n{chat_human_name}"] + if chat_human_name != message.additional_kwargs['user_name']: + stop.append(f"\n{message.additional_kwargs['user_name']}") #print(f"Message is: \"{message.content}\"") await asyncio.sleep(0) output = await chain.arun({"input":message.content, "stop": stop}) diff --git a/matrix_pygmalion_bot/bot/core.py b/matrix_pygmalion_bot/bot/core.py index 54dbae2..fc48f45 100644 --- a/matrix_pygmalion_bot/bot/core.py +++ b/matrix_pygmalion_bot/bot/core.py @@ -135,7 +135,7 @@ class ChatBot(object): typing_fn = lambda : self.connection.room_typing(room.room_id, True, 15000) message.user_name = message.user_name.title() - if self.name.casefold() == message.user_name.casefold(): + if self.name.casefold() == message.user_name.casefold() and not message.is_from(self.connection.user_id): """Bot and user have the same name""" message.user_name += " 2" # or simply "You" if message.is_from(self.connection.user_id):