- ai-service: Ollama 기반 AI 서비스 (분류, 시맨틱 검색, RAG Q&A, 패턴 분석) - AI 어시스턴트 페이지: 채팅형 Q&A, 시맨틱 검색, 패턴 분석, 분류 테스트 - 권한 시스템에 ai_assistant 페이지 등록 (기본 비활성) - 기존 페이지에 AI 기능 통합 (대시보드, 수신함, 관리함) - docker-compose, gateway, nginx 설정 업데이트 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from contextlib import asynccontextmanager
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from routers import health, embeddings, classification, daily_report, rag
|
|
from db.vector_store import vector_store
|
|
from db.metadata_store import metadata_store
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
vector_store.initialize()
|
|
metadata_store.initialize()
|
|
yield
|
|
|
|
|
|
app = FastAPI(
|
|
title="TK AI Service",
|
|
description="AI 서비스 (유사 검색, 분류, 보고서)",
|
|
version="1.0.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=False,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(health.router, prefix="/api/ai")
|
|
app.include_router(embeddings.router, prefix="/api/ai")
|
|
app.include_router(classification.router, prefix="/api/ai")
|
|
app.include_router(daily_report.router, prefix="/api/ai")
|
|
app.include_router(rag.router, prefix="/api/ai")
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"message": "TK AI Service", "version": "1.0.0"}
|