내부 네트워크에서 api 접근 가능하도록 ip 수정

This commit is contained in:
김민구
2026-07-08 05:45:41 +09:00
parent 64f3408d4e
commit 6b9a072126
4 changed files with 15 additions and 4 deletions
+11
View File
@@ -15,7 +15,18 @@ async def lifespan(app: FastAPI):
yield
print("서버 종료")
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI(title="로그라이크 AI 백엔드", version="1.0", lifespan=lifespan)
# 같은 네트워크 상의 모든 외부 기기(PC, 폰 등) 브라우저 접속 허용
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# 라우터 등록
app.include_router(game_router)
+1 -1
View File
@@ -64,7 +64,7 @@ public class BattleManager : MonoBehaviour
Debug.Log($"[Battle] 스킬 프롬프트 전송 시도: \"{skillPrompt}\"");
// 1. FastAPI 서버의 generate-skill API 호출 (플레이어 레벨 파라미터에는 Generation 세대값 전달)
string url = "http://127.0.0.1:8000/api/game/generate-skill";
string url = "http://192.168.1.7:8000/api/game/generate-skill";
int playerLevel = (player != null) ? player.Generation : 1;
SkillCreateRequest requestData = new SkillCreateRequest
@@ -69,7 +69,7 @@ public class NPCDialogueManager : MonoBehaviour
}
// FastAPI의 NPC 대화 조회 엔드포인트 URL 구성
string url = $"http://127.0.0.1:8000/api/game/npc-dialogue?current_generation={currentGeneration}";
string url = $"http://192.168.1.7:8000/api/game/npc-dialogue?current_generation={currentGeneration}";
Debug.Log($"[Dialogue] NPC 대사 조회 요청 전송: {url}");
using (UnityWebRequest request = UnityWebRequest.Get(url))
+2 -2
View File
@@ -243,7 +243,7 @@ public class Player : MonoBehaviour
// 백엔드로부터 다음 세대 번호를 받아와 랜덤 이름과 매핑하는 코루틴
private System.Collections.IEnumerator GetNextGenerationFromServer()
{
string url = "http://127.0.0.1:8000/api/game/generation/next";
string url = "http://192.168.1.7:8000/api/game/generation/next";
using (UnityEngine.Networking.UnityWebRequest request = UnityEngine.Networking.UnityWebRequest.Get(url))
{
@@ -286,7 +286,7 @@ public class Player : MonoBehaviour
// 백엔드로 완성된 사망 기록을 전송하는 코루틴
private System.Collections.IEnumerator SendDeathReport(string cause)
{
string url = "http://127.0.0.1:8000/api/game/death";
string url = "http://192.168.1.7:8000/api/game/death";
AncestorDeathCreate requestData = new AncestorDeathCreate
{