diff --git a/__main__.py b/__main__.py index 03ea38f..65da218 100644 --- a/__main__.py +++ b/__main__.py @@ -40,8 +40,8 @@ except: print("所有问询记录将自动保存在本地目录./gpt_log/chat_secrets.log, 请注意自我隐私保护哦!") # 建议您复制一个config_private.py放自己的秘密, 如API和代理网址, 避免不小心传github被别人看到 -proxies, WEB_PORT, LLM_MODEL, CONCURRENT_COUNT, AUTHENTICATION, CHATBOT_HEIGHT, LAYOUT, API_KEY, AVAIL_LLM_MODELS = \ - get_conf('proxies', 'WEB_PORT', 'LLM_MODEL', 'CONCURRENT_COUNT', 'AUTHENTICATION', 'CHATBOT_HEIGHT', 'LAYOUT', +proxies, WEB_PORT, LLM_MODEL, CONCURRENT_COUNT, AUTHENTICATION, LAYOUT, API_KEY, AVAIL_LLM_MODELS = \ + get_conf('proxies', 'WEB_PORT', 'LLM_MODEL', 'CONCURRENT_COUNT', 'AUTHENTICATION', 'LAYOUT', 'API_KEY', 'AVAIL_LLM_MODELS') proxy_info = check_proxy(proxies) @@ -73,7 +73,7 @@ class ChatBot(ChatBotFrame): def draw_chatbot(self): self.chatbot = gr.Chatbot(elem_id='main_chatbot', label=f"当前模型:{LLM_MODEL}") - self.chatbot.style(height=CHATBOT_HEIGHT) + self.chatbot.style() self.history = gr.State([]) temp_draw = [gr.HTML() for i in range(4)] with gr.Row(): diff --git a/func_box.py b/func_box.py index 6e309dd..f54ca1a 100644 --- a/func_box.py +++ b/func_box.py @@ -480,10 +480,10 @@ def thread_write_chat(chatbot): 对话记录写入数据库 """ private_key = toolbox.get_conf('private_key')[0] - chat_title = chatbot[0][0].split() - - i_say = re.sub(r'^
|<\/p><\/div>$', '', chatbot[-1][0]) - gpt_result = re.sub(r'^
|<\/p><\/div>$', '', chatbot[-1][1]) + chat_title = chatbot[0][1].split() + pattern = re.compile(r'^
|<\/p><\/div>$') + i_say = pattern.sub('', chatbot[-1][0]) + gpt_result = pattern.sub('', chatbot[-1][1]) if private_key in chat_title: SqliteHandle(f'ai_private_{chat_title[-2]}').inset_prompt({i_say: gpt_result}) else: diff --git a/theme.py b/theme.py index 4736621..e912cff 100644 --- a/theme.py +++ b/theme.py @@ -130,9 +130,15 @@ textarea { #main_chatbot { height: 75vh !important; max-height: 75vh !important; - overflow: auto !important; + /* overflow: auto !important; */ z-index: 2; } +.wrap.svelte-18telvq.svelte-18telvq { + padding: var(--block-padding) !important; + height: 100% !important; + max-height: 95% !important; + overflow-y: auto !important; +} .app.svelte-1mya07g.svelte-1mya07g { max-width: 100%; position: relative; @@ -187,7 +193,7 @@ textarea { max-width: 95%; color: #ccd2db !important; letter-spacing: 0.5px; - font-weight: normal; + font-weight: normal; /* width: auto !important; */ border-bottom-left-radius: 0 !important; } diff --git a/toolbox.py b/toolbox.py index 8b9044d..2db8c8e 100644 --- a/toolbox.py +++ b/toolbox.py @@ -74,14 +74,14 @@ def ArgsGeneralWrapper(f): private_key = get_conf('private_key')[0] if private in models: if chatbot == []: - chatbot.append([f'隐私模式, 你的对话记录无法被他人检索
', None]) + chatbot.append([None, f'隐私模式, 你的对话记录无法被他人检索 ']) else: - chatbot[0] = [f'隐私模式, 你的对话记录无法被他人检索 ', None] + chatbot[0] = [None, f'隐私模式, 你的对话记录无法被他人检索 '] else: if chatbot == []: - chatbot.append(['正常对话模式, 你接来下的对话将会被记录并且可以被所有人检索,你可以到Settings中选择隐私模式', None]) + chatbot.append([None, '正常对话模式, 你接来下的对话将会被记录并且可以被所有人检索,你可以到Settings中选择隐私模式']) else: - chatbot[0] = ['正常对话模式, 你接来下的对话将会被记录并且可以被所有人检索,你可以到Settings中选择隐私模式', None] + chatbot[0] = [None, '正常对话模式, 你接来下的对话将会被记录并且可以被所有人检索,你可以到Settings中选择隐私模式'] chatbot_with_cookie = ChatBotWithCookies(cookies) chatbot_with_cookie.write_list(chatbot) txt_passon = txt