From 03aa2ee115e7610bf748e2910a67a8d8dda4e4b9 Mon Sep 17 00:00:00 2001 From: w_xiaolizu Date: Mon, 29 May 2023 11:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93prompt=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E4=BB=8Estrip=E6=9B=BF=E6=8D=A2=E4=B8=BA=E6=AD=A3?= =?UTF-8?q?=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __main__.py | 3 ++- func_box.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/__main__.py b/__main__.py index 4a1988e..231fd83 100644 --- a/__main__.py +++ b/__main__.py @@ -383,7 +383,8 @@ class ChatBot(ChatBotFrame): # Start self.auto_opentab_delay() - demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION) + demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, + blocked_paths=["config.py", "config_private.py", "docker-compose.yml", "Dockerfile"]) def check_proxy_free(): diff --git a/func_box.py b/func_box.py index 83d303d..c300b9a 100644 --- a/func_box.py +++ b/func_box.py @@ -481,8 +481,9 @@ 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('
/div

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

/div

/p') + + i_say = re.sub(r'^

|<\/p><\/div>$', '', chatbot[-1][0]) + gpt_result = re.sub(r'^

|<\/p><\/div>$', '', chatbot[-1][1]) if private_key in chat_title: SqliteHandle(f'ai_private_{chat_title[-2]}').inset_prompt({i_say: gpt_result}) else: @@ -543,4 +544,4 @@ class JsonHandle: if __name__ == '__main__': - print(JsonHandle('/Users/kilig/Job/Python-project/academic_gpt/test.json').load()) + pass \ No newline at end of file