diff --git a/README.md b/README.md index 8dbf868..402c515 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ npm run build 2、本地执行(上传 dist 到服务器): ```bash -rsync -avz --delete dist/ root@156.230.62.22:/var/www/aura-web/ +rsync -avz --delete dist/ root@125.94.46.105:/var/www/aura-web/ ``` ## Docker diff --git a/src/api/auth.ts b/src/api/auth.ts index 6306ba6..1345712 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -1,5 +1,5 @@ import axios from 'axios'; -import { api } from './http'; +import { api, API_BASE_URL } from './http'; export interface AuthUser { id: string; @@ -12,7 +12,7 @@ export const AuthAPI = { me: () => api.get('/auth/me').then((r) => r.data), verify: async (email: string, password: string) => { try { - const res = await axios.post('https://api.hoyidata.com/aura/v1/urser', { email, password }, { timeout: 3000 }); + const res = await axios.post(`${API_BASE_URL}/urser`, { email, password }, { timeout: 3000 }); return res.data; } catch (e) { console.warn('Backend /urser not available, fallback to mock true', e); diff --git a/src/api/http.ts b/src/api/http.ts index 464e9a3..cde3297 100644 --- a/src/api/http.ts +++ b/src/api/http.ts @@ -1,6 +1,6 @@ import axios from 'axios'; -export const API_BASE_URL = 'https://api.hoyidata.com/aura/v1'; +export const API_BASE_URL = 'https://tianchaoai.cc/aura/v1'; const APP_BASE = (import.meta.env.BASE_URL || '/').replace(/\/$/, ''); export const withAppBase = (path: string) => `${APP_BASE}${path.startsWith('/') ? path : `/${path}`}`; export const withApiBase = (path: string) => `${API_BASE_URL}${path.startsWith('/') ? path : `/${path}`}`; diff --git a/src/api/streamChat.ts b/src/api/streamChat.ts index dd23d4f..18936ce 100644 --- a/src/api/streamChat.ts +++ b/src/api/streamChat.ts @@ -1,4 +1,5 @@ import type { ChatMessage } from './chat'; +import { API_BASE_URL } from './http'; export interface StreamEvents { onMeta?: (data: any) => void; @@ -30,7 +31,7 @@ export async function streamChat( modelId?: string, imageUrls?: string[] ) { - const resp = await fetch(`https://api.hoyidata.com/aura/v1/rooms/${roomId}/messages/stream`, { + const resp = await fetch(`${API_BASE_URL}/rooms/${roomId}/messages/stream`, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'text/event-stream' }, body: JSON.stringify({ @@ -54,7 +55,7 @@ export async function regenerateMessage( overrides?: ModelOverrides, attachmentsText?: string ) { - const resp = await fetch(`https://api.hoyidata.com/aura/v1/chat/${agentId}/messages/${messageId}/regenerate`, { + const resp = await fetch(`${API_BASE_URL}/chat/${agentId}/messages/${messageId}/regenerate`, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'text/event-stream' }, body: JSON.stringify({ overrides, attachmentsText }), diff --git a/vite.config.ts b/vite.config.ts index 9a2263e..e64c490 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,15 +1,15 @@ -import { defineConfig, loadEnv } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import react from '@vitejs/plugin-react'; // 默认走 Go 后端 :4001;要回退 Node 后端就 set VITE_API_TARGET=http://localhost:4000 -export default defineConfig(({ command, mode }) => { - const env = loadEnv(mode, process.cwd(), ''); - const target = env.VITE_API_TARGET || 'https://api.hoyidata.com'; - - return { - // 本地开发走根路径,生产构建部署到 /aura 子路径 - base: command === 'serve' ? '/' : '/aura/', - plugins: [react()], +export default defineConfig(({ command, mode }) => { + const env = loadEnv(mode, process.cwd(), ''); + const target = env.VITE_API_TARGET || 'https://tianchaoai.cc'; + + return { + // 本地开发走根路径,生产构建部署到 /aura 子路径 + base: command === 'serve' ? '/' : '/aura/', + plugins: [react()], server: { port: 3001, proxy: {