From 9f871deb4da602f6d87c797857e21dfb0a7d2ad9 Mon Sep 17 00:00:00 2001 From: w_xiaolizu Date: Mon, 22 May 2023 10:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=AF=B9=E8=AF=9D=E7=9A=84ht?= =?UTF-8?q?ml=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- func_box.py | 6 ++++-- prompt_generator.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/func_box.py b/func_box.py index e6d20b0..2d01871 100644 --- a/func_box.py +++ b/func_box.py @@ -364,10 +364,12 @@ def show_prompt_result(index, data: gr.Dataset, chatbot): def thread_write_chat(chatbot): private_key = toolbox.get_conf('private_key')[0] chat_title = chatbot[0][0].split() + i_say = chatbot[-1][0].strip("

/p") + gpt_result = chatbot[-1][1].strip('

/div') if private_key in chat_title: - SqliteHandle(f'ai_private_{chat_title[-2]}').inset_prompt({chatbot[-1][0]: chatbot[-1][1]}) + SqliteHandle(f'ai_private_{chat_title[-2]}').inset_prompt({i_say: gpt_result}) else: - SqliteHandle(f'ai_common').inset_prompt({chatbot[-1][0]: chatbot[-1][1]}) + SqliteHandle(f'ai_common').inset_prompt({i_say: gpt_result}) base_path = os.path.dirname(__file__) diff --git a/prompt_generator.py b/prompt_generator.py index a53f6e9..b814160 100644 --- a/prompt_generator.py +++ b/prompt_generator.py @@ -41,7 +41,7 @@ class SqliteHandle: self.__connect.close() def create_tab(self): - self.__cursor.execute(f"CREATE TABLE `{self.__table}` ('id' INTEGER PRIMARY KEY AUTOINCREMENT, 'prompt' TEXT, 'result' TEXT)") + self.__cursor.execute(f"CREATE TABLE `{self.__table}` ( 'prompt' TEXT, 'result' TEXT)") def get_tables(self): all_tab = []