21 lines
544 B
Python
21 lines
544 B
Python
"""
|
|
FastAPI application factory for Sanguo Quant API
|
|
"""
|
|
from fastapi import FastAPI
|
|
from .routes import router, set_orchestrator
|
|
from sanguo_orchestrator.runner import Orchestrator
|
|
|
|
|
|
def create_app(db_path: str, file_dir=None) -> FastAPI:
|
|
"""Create FastAPI application with orchestrator"""
|
|
app = FastAPI(title="Sanguo Quant API")
|
|
|
|
# Initialize orchestrator
|
|
orch = Orchestrator(db_path=db_path, file_dir=file_dir)
|
|
set_orchestrator(orch)
|
|
|
|
# Include routes
|
|
app.include_router(router, prefix="/api/v1")
|
|
|
|
return app
|