Qilan2 commited on
Commit
c56e7de
·
verified ·
1 Parent(s): 42887b0

Update Card_Hub.py

Browse files
Files changed (1) hide show
  1. Card_Hub.py +26 -4
Card_Hub.py CHANGED
@@ -325,8 +325,7 @@ import logging
325
 
326
  # 配置日志
327
  logging.basicConfig(level=logging.INFO)
328
-
329
- def check_api1():
330
  # 第一次检查 Card_Hub 是否启动
331
  thread_started = False
332
  n = 0
@@ -349,8 +348,31 @@ def check_api1():
349
  print(f"Card_Hub未启动3: {e}, 尝试次数: {n}")
350
 
351
  time.sleep(5)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
 
353
- print('Card_Hub本地已经运行,开始检测接口状态')
354
  Service_status = False
355
  n = 0
356
  nn = 0
@@ -509,7 +531,7 @@ def SillyTavern():
509
  threading.Thread(target=SillyTavern, daemon=True).start()
510
  time.sleep(60)
511
  check_api1()
512
-
513
 
514
  # 创建 ConfigParser 对象
515
  config = configparser.ConfigParser()
 
325
 
326
  # 配置日志
327
  logging.basicConfig(level=logging.INFO)
328
+ def check_api2():
 
329
  # 第一次检查 Card_Hub 是否启动
330
  thread_started = False
331
  n = 0
 
348
  print(f"Card_Hub未启动3: {e}, 尝试次数: {n}")
349
 
350
  time.sleep(5)
351
+ def check_api1():
352
+ # 第一次检查 Card_Hub 是否启动
353
+ # thread_started = False
354
+ # n = 0
355
+ # while True:
356
+ # n += 1
357
+ # if not os.path.exists('/Card_Hub'):
358
+ # logging.error(f"/Card_Hub/ 文件不存在,结束检测")
359
+ # break
360
+ # try:
361
+ # url = "http://localhost:8003"
362
+ # response = requests.get(url, timeout=30)
363
+
364
+ # if response.status_code ==200:
365
+ # print("Card_Hub已经启动")
366
+ # break
367
+
368
+ # print("Card_Hub未启动,状态码:", response.status_code, n)
369
+
370
+ # except requests.exceptions.RequestException as e:
371
+ # print(f"Card_Hub未启动3: {e}, 尝试次数: {n}")
372
+
373
+ # time.sleep(5)
374
 
375
+ # print('Card_Hub本地已经运行,开始检测接口状态')
376
  Service_status = False
377
  n = 0
378
  nn = 0
 
531
  threading.Thread(target=SillyTavern, daemon=True).start()
532
  time.sleep(60)
533
  check_api1()
534
+ check_api2()
535
 
536
  # 创建 ConfigParser 对象
537
  config = configparser.ConfigParser()