From a8b4fdc059acb32d1d4abb185167db8c3a55988c Mon Sep 17 00:00:00 2001 From: 0xd3d0c3d <0xd3d0c3d@protonmail.com> Date: Sat, 25 Jun 2022 17:27:51 -0500 Subject: [PATCH] gpt3 reprocessor --- plugins/openai_plugin.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/openai_plugin.py b/plugins/openai_plugin.py index f111214..8d7e858 100644 --- a/plugins/openai_plugin.py +++ b/plugins/openai_plugin.py @@ -99,7 +99,13 @@ class Plugin: USER=mask.nick MESSAGE=term ################################################################################### REPROCESSOR SOF - # SIMILARITY + # SIMILARITY - QUERY SENT VS QUERY ANSWER + if MESSAGE_OK: + if self.bot.openai_history.similar(openai_message.lower(),term.lower())>0.4: + self.openai_io.append({'user':USER,'message':MESSAGE,'target':target}) + print(f'openai - logic ! rejected // openai similarity - response too similar to query') + TRAP_OK=False + # SIMILARITY - HISTORY if MESSAGE_OK: for i in range(len(self.bot.openai_history.openai_messages)): if self.bot.openai_history.similar(openai_message,str(self.bot.openai_history.openai_messages[i]))>0.8: @@ -148,7 +154,7 @@ class Plugin: COLOR=GREY for i,_ in enumerate(_msg): if i==0: - self.bot.privmsg(target, f"\x02\x0302{USER:}\x0F\x02\x0304 ▶ {COLOR}{_.strip()}\x0F") + self.bot.privmsg(target, f"\x02\x0302{USER:}\x0F\x02\x0309 ▶ {COLOR}{_.strip()}\x0F") else: self.bot.privmsg(target, f"{COLOR}{_.strip()}\x0F") MESSAGE_OK=False