diff --git a/src/cli/main.py b/src/cli/main.py index a1a823c..4ab0fa3 100644 --- a/src/cli/main.py +++ b/src/cli/main.py @@ -168,10 +168,12 @@ def serve( ): # 传递 config 给 uvicorn 子进程 (通过环境变量) os.environ["MD_VECTOR_CONFIG"] = config + # 使用 load_config 而非 get_state(),避免在 CLI 主进程加载嵌入模型 + from src.core.config import load_config + + cfg = load_config(config) typer.echo(f"启动服务: http://localhost:{port}") typer.echo(f"API 文档: http://localhost:{port}/docs") - # 加载配置以获取 SSL 设置 - cfg = get_state().config ssl_kwargs = {} if cfg.server.ssl_keyfile and cfg.server.ssl_certfile: ssl_kwargs["ssl_keyfile"] = cfg.server.ssl_keyfile