Update server.py
Browse files
server.py
CHANGED
|
@@ -39,6 +39,7 @@ kaggle_metadata = {
|
|
| 39 |
"id": "xovale7506/sillytavern-data",
|
| 40 |
"licenses": [{"name": "CC0-1.0"}]
|
| 41 |
}
|
|
|
|
| 42 |
import subprocess
|
| 43 |
import os
|
| 44 |
from IPython.display import clear_output
|
|
@@ -281,7 +282,7 @@ def check_api1():
|
|
| 281 |
time.sleep(5) # 等待5秒后重试
|
| 282 |
|
| 283 |
print('开始检测接口状态')
|
| 284 |
-
|
| 285 |
# 第二次检查接口状态
|
| 286 |
while True:
|
| 287 |
url = f"{st_url}/v1" # 确保这个 URL 是正确的
|
|
@@ -305,6 +306,9 @@ def check_api1():
|
|
| 305 |
print("接口返回信息:", response_json)
|
| 306 |
|
| 307 |
except requests.exceptions.HTTPError as e:
|
|
|
|
|
|
|
|
|
|
| 308 |
if e.response.status_code == 403:
|
| 309 |
print("接口正常2") # 再次确认服务已启动
|
| 310 |
try:
|
|
@@ -403,6 +407,7 @@ threading.Thread(target=SillyTavern, daemon=True).start()
|
|
| 403 |
check_api1()
|
| 404 |
# threading.Thread(target=repeat_task, daemon=True).start #压缩备份
|
| 405 |
print("开始衔接")
|
|
|
|
| 406 |
frp(config_data2,'/content/frp/frpc2.ini',True)
|
| 407 |
frp(config_data,'/content/frp/frpc.ini',False)
|
| 408 |
# sync()
|
|
|
|
| 39 |
"id": "xovale7506/sillytavern-data",
|
| 40 |
"licenses": [{"name": "CC0-1.0"}]
|
| 41 |
}
|
| 42 |
+
|
| 43 |
import subprocess
|
| 44 |
import os
|
| 45 |
from IPython.display import clear_output
|
|
|
|
| 282 |
time.sleep(5) # 等待5秒后重试
|
| 283 |
|
| 284 |
print('开始检测接口状态')
|
| 285 |
+
Service_status = False
|
| 286 |
# 第二次检查接口状态
|
| 287 |
while True:
|
| 288 |
url = f"{st_url}/v1" # 确保这个 URL 是正确的
|
|
|
|
| 306 |
print("接口返回信息:", response_json)
|
| 307 |
|
| 308 |
except requests.exceptions.HTTPError as e:
|
| 309 |
+
if Service_status:
|
| 310 |
+
print("结束检测")
|
| 311 |
+
break
|
| 312 |
if e.response.status_code == 403:
|
| 313 |
print("接口正常2") # 再次确认服务已启动
|
| 314 |
try:
|
|
|
|
| 407 |
check_api1()
|
| 408 |
# threading.Thread(target=repeat_task, daemon=True).start #压缩备份
|
| 409 |
print("开始衔接")
|
| 410 |
+
Service_status = True
|
| 411 |
frp(config_data2,'/content/frp/frpc2.ini',True)
|
| 412 |
frp(config_data,'/content/frp/frpc.ini',False)
|
| 413 |
# sync()
|