ai 기반 문지기 npc의 조언 및 전투 스킬 생성 기능 구현

This commit is contained in:
2026-06-24 17:42:16 +09:00
parent 1face1e216
commit 9ca7007c79
13 changed files with 314 additions and 70 deletions
+12 -20
View File
@@ -1,29 +1,21 @@
from fastapi import FastAPI
from starlette.staticfiles import StaticFiles
from contextlib import asynccontextmanager
from backend.routers.npc_router import router as npc_router
from backend.routers.skill_router import router as skill_router
from backend.repository.db_init import Base, engine
from backend.routers.game_router import router as game_router
from backend.repository.db_init import Base, SessionLocal, engine
@asynccontextmanager
async def lifespan(app: FastAPI):
print("서버 시작")
# @asynccontextmanager
# async def lifespan(app: FastAPI):
# print("서버 시작")
#
# # Base 에 등록된 모든 모델에 테이블 자동 생성
# Base.metadata.create_all(bind=engine)
# print("[DB] 테이블 생성 완료 (또는 이미 존재)")
#
# yield
# print("서버 종료")
# Base 에 등록된 모든 모델에 테이블 자동 생성
Base.metadata.create_all(bind=engine)
print("[DB] 테이블 생성 완료 (또는 이미 존재)")
# app = FastAPI()
# app = FastAPI(title="상담 LLM", version="1.0", lifespan=lifespan)
app = FastAPI(title="AI npc", version="1.0", description="던전 입구를 지키는 문지기 npc",)
yield
print("서버 종료")
# static 폴더 지정
# app.mount("/static", StaticFiles(directory="backend/static"), name="static")
app = FastAPI(title="로그라이크 AI 백엔드", version="1.0", lifespan=lifespan)
# 라우터 등록
app.include_router(npc_router)
app.include_router(skill_router)
app.include_router(game_router)