22
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* AI 어시스턴트 전용 API 클라이언트
|
||||
* - VEXPLOR와 같은 서비스/같은 포트: /api/ai/v1 로 호출 (Next → backend-node → AI 서비스 프록시)
|
||||
* - 인증 토큰은 sessionStorage 'ai-assistant-auth' 사용 (VEXPLOR 인증과 분리)
|
||||
* - INVION와 같은 서비스/같은 포트: /api/ai/v1 로 호출 (Next → backend-node → AI 서비스 프록시)
|
||||
* - 인증 토큰은 sessionStorage 'ai-assistant-auth' 사용 (INVION 인증과 분리)
|
||||
*/
|
||||
import axios, { AxiosError } from "axios";
|
||||
import type { AiAssistantAuthState } from "./types";
|
||||
|
||||
@@ -20,8 +20,8 @@ const getApiBaseUrl = (): string => {
|
||||
const currentHost = window.location.hostname;
|
||||
const currentPort = window.location.port;
|
||||
|
||||
if (currentHost === "v1.vexplor.com") {
|
||||
return "https://api.vexplor.com/api";
|
||||
if (currentHost === "v1.invion.com") {
|
||||
return "https://api.invion.com/api";
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -49,8 +49,8 @@ export const getFullImageUrl = (imagePath: string): string => {
|
||||
if (typeof window !== "undefined") {
|
||||
const currentHost = window.location.hostname;
|
||||
|
||||
if (currentHost === "v1.vexplor.com") {
|
||||
return `https://api.vexplor.com${imagePath}`;
|
||||
if (currentHost === "v1.invion.com") {
|
||||
return `https://api.invion.com${imagePath}`;
|
||||
}
|
||||
|
||||
if (currentHost === "localhost" || currentHost === "127.0.0.1") {
|
||||
|
||||
@@ -10,9 +10,9 @@ function getApiBaseUrl(): string {
|
||||
if (typeof window !== "undefined") {
|
||||
const hostname = window.location.hostname;
|
||||
|
||||
// 프로덕션: v1.vexplor.com → https://api.vexplor.com/api
|
||||
if (hostname === "v1.vexplor.com") {
|
||||
return "https://api.vexplor.com/api";
|
||||
// 프로덕션: v1.invion.com → https://api.invion.com/api
|
||||
if (hostname === "v1.invion.com") {
|
||||
return "https://api.invion.com/api";
|
||||
}
|
||||
|
||||
// 로컬 개발: localhost → http://localhost:8081/api
|
||||
|
||||
@@ -262,9 +262,9 @@ export const getDirectFileUrl = (filePath: string): string => {
|
||||
if (typeof window !== "undefined") {
|
||||
const currentHost = window.location.hostname;
|
||||
|
||||
// 프로덕션 환경: v1.vexplor.com → api.vexplor.com
|
||||
if (currentHost === "v1.vexplor.com") {
|
||||
return `https://api.vexplor.com${filePath}`;
|
||||
// 프로덕션 환경: v1.invion.com → api.invion.com
|
||||
if (currentHost === "v1.invion.com") {
|
||||
return `https://api.invion.com${filePath}`;
|
||||
}
|
||||
|
||||
// 로컬 개발환경
|
||||
@@ -274,7 +274,7 @@ export const getDirectFileUrl = (filePath: string): string => {
|
||||
}
|
||||
|
||||
// SSR 또는 알 수 없는 환경에서는 환경변수 사용 (fallback)
|
||||
// 주의: 프로덕션 URL이 https://api.vexplor.com/api 이므로
|
||||
// 주의: 프로덕션 URL이 https://api.invion.com/api 이므로
|
||||
// 단순 .replace("/api", "")는 호스트명의 /api까지 제거하는 버그 발생
|
||||
const baseUrl = process.env.NEXT_PUBLIC_API_URL?.replace(/\/api$/, "") || "";
|
||||
if (baseUrl.startsWith("http://") || baseUrl.startsWith("https://")) {
|
||||
|
||||
@@ -30,9 +30,9 @@ const getApiBaseUrl = (): string => {
|
||||
if (typeof window !== "undefined") {
|
||||
const currentHost = window.location.hostname;
|
||||
|
||||
// 프로덕션 환경: v1.vexplor.com → api.vexplor.com
|
||||
if (currentHost === "v1.vexplor.com") {
|
||||
return "https://api.vexplor.com/api";
|
||||
// 프로덕션 환경: v1.invion.com → api.invion.com
|
||||
if (currentHost === "v1.invion.com") {
|
||||
return "https://api.invion.com/api";
|
||||
}
|
||||
|
||||
// 로컬 개발환경
|
||||
|
||||
Reference in New Issue
Block a user