feat: migrate server to 105 and change api base url
parent
b013fff224
commit
6e555cac4e
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<AuthUser>('/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);
|
||||
|
|
|
|||
|
|
@ -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}`}`;
|
||||
|
|
|
|||
|
|
@ -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 }),
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue