AI 에이전트 (Layer 2): - GONGSA: 공사 담당 (공정 브리핑, 공기 지연 감지, 날씨 연동 작업 조정) - PUMJIL: 품질 담당 (시공 전 체크리스트, Vision 보조 판독, 시험 기한 추적) - ANJEON: 안전 담당 (위험 공정 경보, TBM 생성, 중대재해처벌법 Q&A) - GUMU: 공무 담당 (인허가 능동 추적, 기성청구 제안, 보고서 초안) - 에이전트 라우터 (키워드 기반 자동 분배), 아침 브리핑 엔드포인트 EVMS 기본: - PV·EV·AC·SPI·CPI 산출 (WBS/Task 기반) - EAC·ETC 예측, 스냅샷 이력 저장 Vision AI: - Level 1: 현장 사진 분류 (Claude Vision), 작업일보 자동 첨부 - Level 2: 안전장비(안전모/조끼) 착용 감지 Geofence 위험구역: - 구역 CRUD (굴착면, 크레인 반경, 밀폐공간 등) - 진입 이벤트 웹훅 (익명 — 개인 이동 경로 비수집) 인허가 자동도출: - 공종 입력 → AI가 필요 인허가 목록 자동 도출 + 체크리스트 생성 DB 마이그레이션 (002): - agent_conversations, agent_messages, evms_snapshots, geofence_zones Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 lines
2.1 KiB
Python
66 lines
2.1 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from contextlib import asynccontextmanager
|
|
from app.config import settings
|
|
from app.api import (
|
|
auth, projects, tasks, daily_reports, reports, inspections,
|
|
weather, rag, kakao, permits, quality, settings as settings_router,
|
|
agents, evms, vision, geofence,
|
|
)
|
|
from app.services.scheduler import start_scheduler, stop_scheduler
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
# Startup
|
|
start_scheduler()
|
|
yield
|
|
# Shutdown
|
|
stop_scheduler()
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
app = FastAPI(
|
|
title="CONAI API",
|
|
description="소형 건설업체를 위한 AI 기반 토목공사 통합관리 플랫폼",
|
|
version=settings.APP_VERSION,
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
# CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.CORS_ORIGINS,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# API routers
|
|
api_prefix = "/api/v1"
|
|
app.include_router(auth.router, prefix=api_prefix)
|
|
app.include_router(projects.router, prefix=api_prefix)
|
|
app.include_router(tasks.router, prefix=api_prefix)
|
|
app.include_router(daily_reports.router, prefix=api_prefix)
|
|
app.include_router(reports.router, prefix=api_prefix)
|
|
app.include_router(inspections.router, prefix=api_prefix)
|
|
app.include_router(weather.router, prefix=api_prefix)
|
|
app.include_router(rag.router, prefix=api_prefix)
|
|
app.include_router(kakao.router, prefix=api_prefix)
|
|
app.include_router(permits.router, prefix=api_prefix)
|
|
app.include_router(quality.router, prefix=api_prefix)
|
|
app.include_router(agents.router, prefix=api_prefix)
|
|
app.include_router(evms.router, prefix=api_prefix)
|
|
app.include_router(vision.router, prefix=api_prefix)
|
|
app.include_router(geofence.router, prefix=api_prefix)
|
|
app.include_router(settings_router.router, prefix=api_prefix)
|
|
|
|
@app.get("/health")
|
|
async def health():
|
|
return {"status": "ok", "version": settings.APP_VERSION}
|
|
|
|
return app
|
|
|
|
|
|
app = create_app()
|