986
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
* Validates: Requirements 12.1-12.6
|
* Validates: Requirements 12.1-12.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import api from './api';
|
import api, { API_BASE_URL } from './api';
|
||||||
import type {
|
import type {
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
AIChatResponse,
|
AIChatResponse,
|
||||||
@@ -108,7 +108,7 @@ export async function streamChatMessage(
|
|||||||
const token = localStorage.getItem('token'); // Assuming auth token is stored here
|
const token = localStorage.getItem('token'); // Assuming auth token is stored here
|
||||||
|
|
||||||
// Use fetch directly for streaming support
|
// Use fetch directly for streaming support
|
||||||
const response = await fetch(`${import.meta.env.VITE_API_BASE_URL}/ai/chat/stream`, {
|
const response = await fetch(`${API_BASE_URL}/ai/chat/stream`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
// 优先使用环境变量配置
|
// 优先使用环境变量配置
|
||||||
// 开发环境 (.env.development): http://localhost:2612/api/v1
|
// 开发环境 (.env.development): http://localhost:2612/api/v1
|
||||||
// 生产环境 (.env.production): /api/v1
|
// 生产环境 (.env.production): /api/v1
|
||||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ||
|
// 生产环境 (.env.production): /api/v1
|
||||||
|
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ||
|
||||||
((window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1')
|
((window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1')
|
||||||
? 'http://localhost:2612/api/v1'
|
? 'http://localhost:2612/api/v1'
|
||||||
: '/api/v1');
|
: '/api/v1');
|
||||||
|
|||||||
Reference in New Issue
Block a user