more_agent/app/main.py

72 lines
1.9 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
MACP 主应用入口模块。
创建 FastAPI 应用实例,注册路由,提供健康检查接口。
"""
from __future__ import annotations
import uvicorn
from fastapi import FastAPI
from app.routes import router
# 创建 FastAPI 应用
app = FastAPI(
title="MACP - 军工智能化文档编制与辅助研发平台",
description="面向军工领域的智能化文档编制与辅助研发平台集成文档模板管理、GJB合规验证、"
"在线编辑、MCP工具接入、Skills流程编排、智能体记忆管理、安全沙箱执行、"
"知识库交互、统一大模型接入、多模态输入处理等模块。",
version="1.0.0",
)
# =============================================================================
# 全局路由注册
# =============================================================================
app.include_router(router)
# =============================================================================
# 健康检查接口
# =============================================================================
@app.get("/api/health", tags=["系统"], summary="健康检查")
async def health_check():
"""系统健康检查接口"""
return {
"status": "ok",
"service": "MACP Platform",
"version": "1.0.0",
}
@app.get("/", tags=["系统"], summary="根路径")
async def root():
"""根路径重定向到文档"""
return {
"message": "欢迎使用MACP - 军工智能化文档编制与辅助研发平台",
"docs": "/docs",
"redoc": "/redoc",
}
# =============================================================================
# 主入口
# =============================================================================
def main():
"""启动 MACP 服务"""
uvicorn.run(
"app.main:app",
host="0.0.0.0",
port=8000,
reload=False,
log_level="info",
)
if __name__ == "__main__":
main()