From ac45f1036b700ef15061e9ad6965aaf323f6cd73 Mon Sep 17 00:00:00 2001 From: w_xiaolizu Date: Tue, 23 May 2023 18:38:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=8D=E6=89=93=E5=BC=80?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=EF=BC=8C=E5=A4=AA=E9=BA=BB=E7=83=A6?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E6=AF=8F=E6=AC=A1=E9=83=A8=E7=BD=B2=E4=B8=8A?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=83=BD=E8=A6=81=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __main__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/__main__.py b/__main__.py index 8adc54c..3a78070 100644 --- a/__main__.py +++ b/__main__.py @@ -327,19 +327,19 @@ class ChatBot(ChatBotFrame): self.submit_start.click(fn=agent_main, inputs=self.auto_input_combo, outputs=self.auto_output_combo) # gradio的inbrowser触发不太稳定,回滚代码到原始的浏览器打开函数 - def auto_opentab_delay(self): + def auto_opentab_delay(self, is_open=False): import threading, webbrowser, time print(f"如果浏览器没有自动打开,请复制并转到以下URL:") print(f"\t(亮色主题): http://localhost:{PORT}") print(f"\t(暗色主题): {self.__url}/?__theme=dark") + if is_open: + def open(): + time.sleep(2) # 打开浏览器 + webbrowser.open_new_tab(f"http://localhost:{PORT}/?__theme=dark") - def open(): - time.sleep(2) # 打开浏览器 - webbrowser.open_new_tab(f"http://localhost:{PORT}/?__theme=dark") - - threading.Thread(target=open, name="open-browser", daemon=True).start() - threading.Thread(target=auto_update, name="self-upgrade", daemon=True).start() + threading.Thread(target=open, name="open-browser", daemon=True).start() + threading.Thread(target=auto_update, name="self-upgrade", daemon=True).start() # threading.Thread(target=warm_up_modules, name="warm-up", daemon=True).start()