feat: 修复 nohup 等无标准输出流情况下启动失败的问题

This commit is contained in:
Soulter
2023-12-07 15:30:50 +08:00
parent 8dc91cfed4
commit 925a42e2c4
2 changed files with 16 additions and 7 deletions
+14 -5
View File
@@ -439,14 +439,23 @@ def initBot(cfg, prov):
# thread_inst.join()
asyncio.get_event_loop().run_until_complete(cli())
thread_inst.join()
async def cli():
show_hint = False
time.sleep(1)
while True:
prompt = input(">>> ")
if prompt == "":
continue
ngm = await cli_pack_message(prompt)
await oper_msg(ngm, True, PLATFORM_CLI)
try:
prompt = input(">>> ")
if prompt == "":
continue
ngm = await cli_pack_message(prompt)
await oper_msg(ngm, True, PLATFORM_CLI)
except EOFError:
if not show_hint:
show_hint = True
gu.log("您当前所使用的环境不支持 CLI 模式,您将无法在命令行控制台中使用本程序。不影响您在 QQ 上的使用。")
return
async def cli_pack_message(prompt: str) -> NakuruGuildMessage:
ngm = NakuruGuildMessage()
+2 -2
View File
@@ -10,6 +10,6 @@ beautifulsoup4
googlesearch-python
tiktoken
readability-lxml
EdgeGPT
revChatGPT~=6.8.6
baidu-aip~=4.16.9
baidu-aip~=4.16.9
websockets