在startup中自动执行 create_tables, 确保数据库表被创建
This commit is contained in:
parent
f9348326f5
commit
12113be6ec
|
|
@ -36,6 +36,7 @@ from server.utils import (fschat_controller_address, fschat_model_worker_address
|
||||||
fschat_openai_api_address, set_httpx_config, get_httpx_client,
|
fschat_openai_api_address, set_httpx_config, get_httpx_client,
|
||||||
get_model_worker_config, get_all_model_worker_configs,
|
get_model_worker_config, get_all_model_worker_configs,
|
||||||
MakeFastAPIOffline, FastAPI, llm_device, embedding_device)
|
MakeFastAPIOffline, FastAPI, llm_device, embedding_device)
|
||||||
|
from server.knowledge_base.migrate import create_tables
|
||||||
import argparse
|
import argparse
|
||||||
from typing import Tuple, List, Dict
|
from typing import Tuple, List, Dict
|
||||||
from configs import VERSION
|
from configs import VERSION
|
||||||
|
|
@ -866,6 +867,8 @@ async def start_main_server():
|
||||||
logger.info("Process status: %s", p)
|
logger.info("Process status: %s", p)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
# 确保数据库表被创建
|
||||||
|
create_tables()
|
||||||
|
|
||||||
if sys.version_info < (3, 10):
|
if sys.version_info < (3, 10):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue