增加默认执行all命令

This commit is contained in:
xaoyaoo 2024-01-04 15:34:55 +08:00
parent bbd1d96bc5
commit 7c1a076b4d

View File

@ -7,6 +7,7 @@
# -------------------------------------------------------------------------------
import argparse
import os
import subprocess
import sys
import time
@ -220,6 +221,18 @@ class MainShowChatRecords():
app.register_blueprint(api)
# 自动打开浏览器
url = "http://127.0.0.1:5000/"
# 根据操作系统使用不同的命令打开默认浏览器
if sys.platform.startswith('darwin'): # macOS
subprocess.call(['open', url])
elif sys.platform.startswith('win'): # Windows
subprocess.call(['start', url], shell=True)
elif sys.platform.startswith('linux'): # Linux
subprocess.call(['xdg-open', url])
else:
print("Unsupported platform, can't open browser automatically.")
print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录")
app.run(host='0.0.0.0', port=5000, debug=False)
@ -450,7 +463,7 @@ def console_run():
# 检查是否需要显示帮助信息
if len(sys.argv) == 1:
sys.argv.append('-h')
sys.argv.append('-all')
elif len(sys.argv) == 2 and sys.argv[1] in modes.keys() and sys.argv[1] not in [main_all.mode, main_wx_info.mode,
main_wx_db_path.mode]:
sys.argv.append('-h')