내부 네트워크에서 api 접근 가능하도록 ip 수정
This commit is contained in:
@@ -15,7 +15,18 @@ async def lifespan(app: FastAPI):
|
|||||||
yield
|
yield
|
||||||
print("서버 종료")
|
print("서버 종료")
|
||||||
|
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
app = FastAPI(title="로그라이크 AI 백엔드", version="1.0", lifespan=lifespan)
|
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)
|
app.include_router(game_router)
|
||||||
@@ -64,7 +64,7 @@ public class BattleManager : MonoBehaviour
|
|||||||
Debug.Log($"[Battle] 스킬 프롬프트 전송 시도: \"{skillPrompt}\"");
|
Debug.Log($"[Battle] 스킬 프롬프트 전송 시도: \"{skillPrompt}\"");
|
||||||
|
|
||||||
// 1. FastAPI 서버의 generate-skill API 호출 (플레이어 레벨 파라미터에는 Generation 세대값 전달)
|
// 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;
|
int playerLevel = (player != null) ? player.Generation : 1;
|
||||||
|
|
||||||
SkillCreateRequest requestData = new SkillCreateRequest
|
SkillCreateRequest requestData = new SkillCreateRequest
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class NPCDialogueManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FastAPI의 NPC 대화 조회 엔드포인트 URL 구성
|
// 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}");
|
Debug.Log($"[Dialogue] NPC 대사 조회 요청 전송: {url}");
|
||||||
|
|
||||||
using (UnityWebRequest request = UnityWebRequest.Get(url))
|
using (UnityWebRequest request = UnityWebRequest.Get(url))
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ public class Player : MonoBehaviour
|
|||||||
// 백엔드로부터 다음 세대 번호를 받아와 랜덤 이름과 매핑하는 코루틴
|
// 백엔드로부터 다음 세대 번호를 받아와 랜덤 이름과 매핑하는 코루틴
|
||||||
private System.Collections.IEnumerator GetNextGenerationFromServer()
|
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))
|
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)
|
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
|
AncestorDeathCreate requestData = new AncestorDeathCreate
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user