From f764b76694b03e3f362e1888d95e233e1607bf0a Mon Sep 17 00:00:00 2001 From: w_xiaolizu Date: Sun, 23 Apr 2023 11:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E9=80=82=E9=85=8D=E7=AC=94=E8=AE=B0=E6=9C=AC=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BD=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __main__.py | 21 +++++++++------------ toolbox.py | 4 ++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/__main__.py b/__main__.py index fd47d2a..5a626c6 100644 --- a/__main__.py +++ b/__main__.py @@ -103,11 +103,10 @@ class ChatBot(ChatBotFrame): def draw_public_chat(self): with gr.Tab('Public'): - with gr.Tab('Public'): - with gr.Accordion("上传本地文件可供高亮函数插件调用", open=False) as self.area_file_up: - self.file_upload = gr.Files(label="任何文件, 但推荐上传压缩文件(zip, tar)", - file_count="multiple") - self.file_upload.style() + with gr.Accordion("上传本地文件可供高亮函数插件调用", open=False) as self.area_file_up: + self.file_upload = gr.Files(label="任何文件, 但推荐上传压缩文件(zip, tar)", + file_count="multiple") + self.file_upload.style() with gr.Row(): self.upload_history = gr.Button("Get Upload History", variant="secondary") self.get_download = gr.Button('Get Download Link', variant='stop') @@ -123,16 +122,14 @@ class ChatBot(ChatBotFrame): with gr.Accordion("更多函数插件", open=True): dropdown_fn_list = [k for k in crazy_fns.keys() if not crazy_fns[k].get("AsButton", True)] - with gr.Column(scale=1): - self.dropdown = gr.Dropdown(dropdown_fn_list, value=r"打开插件列表", label="").style( + self.dropdown = gr.Dropdown(dropdown_fn_list, value=r"打开插件列表", label="").style( container=False) - with gr.Column(scale=1): - self.switchy_bt = gr.Button(r"请先从插件列表中选择", variant="secondary") + self.switchy_bt = gr.Button(r"请先从插件列表中选择", variant="secondary") def draw_setting_chat(self): with gr.Tab('Setting'): with gr.Accordion("展开SysPrompt & 交互界面布局 & Github地址", open=True): - self.system_prompt = gr.Textbox(show_label=True, placeholder=f"System Prompt", label="System prompt", value=self.initial_prompt) + self.system_prompt = gr.Textbox(show_label=True, lines=2, placeholder=f"System Prompt", label="System prompt", value=self.initial_prompt) self.top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.01, interactive=True, label="Top-p (nucleus sampling)", ) self.temperature = gr.Slider(minimum=-0, maximum=2.0, value=1.0, step=0.01, interactive=True, label="Temperature", ) self.max_length_sl = gr.Slider(minimum=256, maximum=4096, value=512, step=1, interactive=True, label="MaxLength", ) @@ -234,10 +231,10 @@ class ChatBot(ChatBotFrame): # 绘制一个ROW,row会让底下的元素自动排部 with gr.Row(): # 绘制列2 - with gr.Column(scale=2): + with gr.Column(scale=100): self.draw_chatbot() # 绘制列1 - with gr.Column(scale=1): + with gr.Column(scale=51): # 绘制对话模组 with gr.Tab('对话模式'): self.draw_input_chat() diff --git a/toolbox.py b/toolbox.py index 3147ce9..22570b8 100644 --- a/toolbox.py +++ b/toolbox.py @@ -32,7 +32,7 @@ def ArgsGeneralWrapper(f): 装饰器函数,用于重组输入参数,改变输入参数的顺序与结构。 """ def decorated(cookies, max_length, llm_model, txt, top_p, temperature, - chatbot, history, system_prompt, plugin_advanced_arg, models, ipaddr: gr.Request, *args): + chatbot, history, system_prompt, models, ipaddr: gr.Request, *args): """""" # 引入一个有cookie的chatbot cookies.update({ @@ -48,7 +48,7 @@ def ArgsGeneralWrapper(f): 'ipaddr': ipaddr.client.host } plugin_kwargs = { - "advanced_arg": plugin_advanced_arg, + # "advanced_arg": plugin_advanced_arg, 意义不明的功能,后续再解决冲突 } chatbot_with_cookie = ChatBotWithCookies(cookies) chatbot_with_cookie.write_list(chatbot)