summaryrefslogtreecommitdiff
path: root/frontend/src
diff options
context:
space:
mode:
authorblackhao <13851610112@163.com>2025-12-10 21:07:17 -0600
committerblackhao <13851610112@163.com>2025-12-10 21:07:17 -0600
commit478100200dff8400a6e47502fa4a6db035fd6532 (patch)
treea9936debc43dc52323ed3f2c7dccca09959d2a81 /frontend/src
parent9646da833bc3d94564c10649b62a378d0190471e (diff)
fix: use relative API paths for production deployment
Diffstat (limited to 'frontend/src')
-rw-r--r--frontend/src/components/LeftSidebar.tsx4
-rw-r--r--frontend/src/components/Sidebar.tsx10
-rw-r--r--frontend/src/pages/AuthPage.tsx2
-rw-r--r--frontend/src/store/authStore.ts2
-rw-r--r--frontend/src/store/flowStore.ts2
5 files changed, 10 insertions, 10 deletions
diff --git a/frontend/src/components/LeftSidebar.tsx b/frontend/src/components/LeftSidebar.tsx
index 1df63fe..1a111bf 100644
--- a/frontend/src/components/LeftSidebar.tsx
+++ b/frontend/src/components/LeftSidebar.tsx
@@ -191,7 +191,7 @@ const LeftSidebar: React.FC<LeftSidebarProps> = ({ isOpen, onToggle }) => {
const handleDownload = async (item: FSItem) => {
if (item.type !== 'file') return;
- const url = `${import.meta.env.VITE_BACKEND_URL || 'http://localhost:8000'}/api/projects/download?user=test&path=${encodeURIComponent(item.path)}`;
+ const url = `${import.meta.env.VITE_BACKEND_URL || ''}/api/projects/download?user=test&path=${encodeURIComponent(item.path)}`;
const a = document.createElement('a');
a.href = url;
a.download = item.name;
@@ -276,7 +276,7 @@ const LeftSidebar: React.FC<LeftSidebarProps> = ({ isOpen, onToggle }) => {
};
const handleDownloadFile = (file: FileMeta) => {
- const url = `${import.meta.env.VITE_BACKEND_URL || 'http://localhost:8000'}/api/files/download?user=test&file_id=${encodeURIComponent(file.id)}`;
+ const url = `${import.meta.env.VITE_BACKEND_URL || ''}/api/files/download?user=test&file_id=${encodeURIComponent(file.id)}`;
const a = document.createElement('a');
a.href = url;
a.download = file.name;
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx
index 17050aa..61a5f02 100644
--- a/frontend/src/components/Sidebar.tsx
+++ b/frontend/src/components/Sidebar.tsx
@@ -295,7 +295,7 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
: '';
try {
- const response = await fetch('http://localhost:8000/api/run_node_stream', {
+ const response = await fetch('/api/run_node_stream', {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getAuthHeader() },
body: JSON.stringify({
@@ -386,7 +386,7 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
setShowSummaryModal(false);
try {
- const res = await fetch('http://localhost:8000/api/summarize', {
+ const res = await fetch('/api/summarize', {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getAuthHeader() },
body: JSON.stringify({
@@ -412,7 +412,7 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
// Auto-generate title using gpt-5-nano
const generateTitle = async (nodeId: string, userPrompt: string, response: string) => {
try {
- const res = await fetch('http://localhost:8000/api/generate_title', {
+ const res = await fetch('/api/generate_title', {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getAuthHeader() },
body: JSON.stringify({ user_prompt: userPrompt, response })
@@ -489,7 +489,7 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
const messages = computeMergedMessages(selectedNode.id, orderedSelectedIds, 'trace_order');
const content = messages.map(m => `${m.role}: ${m.content}`).join('\n\n');
- const res = await fetch('http://localhost:8000/api/summarize', {
+ const res = await fetch('/api/summarize', {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getAuthHeader() },
body: JSON.stringify({
@@ -1003,7 +1003,7 @@ const Sidebar: React.FC<SidebarProps> = ({ isOpen, onToggle, onInteract }) => {
const scopes = [`${projectPath}/quick_chat_temp`];
// Call LLM API with current messages as context
- const response = await fetch('http://localhost:8000/api/run_node_stream', {
+ const response = await fetch('/api/run_node_stream', {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...getAuthHeader() },
body: JSON.stringify({
diff --git a/frontend/src/pages/AuthPage.tsx b/frontend/src/pages/AuthPage.tsx
index d213190..c80ff9d 100644
--- a/frontend/src/pages/AuthPage.tsx
+++ b/frontend/src/pages/AuthPage.tsx
@@ -2,7 +2,7 @@ import React, { useState, useCallback } from 'react';
import { useAuthStore } from '../store/authStore';
import { Loader2, User, Mail, Lock, AlertCircle, CheckCircle, XCircle } from 'lucide-react';
-const API_BASE = 'http://localhost:8000';
+const API_BASE = '';
interface AuthPageProps {
onSuccess?: () => void;
diff --git a/frontend/src/store/authStore.ts b/frontend/src/store/authStore.ts
index 652256c..47faed5 100644
--- a/frontend/src/store/authStore.ts
+++ b/frontend/src/store/authStore.ts
@@ -1,7 +1,7 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
-const API_BASE = 'http://localhost:8000';
+const API_BASE = '';
interface UserInfo {
id: number;
diff --git a/frontend/src/store/flowStore.ts b/frontend/src/store/flowStore.ts
index de23c95..3492ffe 100644
--- a/frontend/src/store/flowStore.ts
+++ b/frontend/src/store/flowStore.ts
@@ -252,7 +252,7 @@ const getStableColor = (str: string) => {
import { useAuthStore } from './authStore';
-const API_BASE = import.meta.env.VITE_BACKEND_URL || 'http://localhost:8000';
+const API_BASE = import.meta.env.VITE_BACKEND_URL || '';
const DEFAULT_USER = 'test'; // Fallback for unauthenticated requests
// Get current username directly from authStore