Skip to content

Commit 9d2fd20

Browse files
committed
ChatModule.tsx - VITE BASE URL exception added
1 parent 997803b commit 9d2fd20

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/ChatModule.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ interface ChatModuleProps {
3939

4040
/* ---- 환경변수: API End-Point -------------------------------------- */
4141
// 별도의 API URL이 주어지지 않을 경우 localhost의 8000번 포트를 호출합니다.
42-
const API_BASE =
43-
import.meta.env.VITE_API_BASE_URL ?? "http://localhost:8000";
42+
// const API_BASE =
43+
// import.meta.env.VITE_API_BASE_URL ?? "http://localhost:8000";
44+
const FALLBACK_API = `${window.location.protocol}//${window.location.hostname}:8000`;
45+
const API_BASE = (import.meta.env.VITE_API_BASE_URL || FALLBACK_API).replace(/\/+$/, '');
4446

4547
/* ---- 유틸: 백엔드 호출 ------------------------------------------- */
4648
type BackendResponse = { final_answer: string; cards: unknown[] };

0 commit comments

Comments
 (0)