From 3d1057fd0492b5d9e46cb610dccf9ceae3135e9d Mon Sep 17 00:00:00 2001 From: zzlgreat Date: Tue, 16 Dec 2025 08:25:19 +0800 Subject: [PATCH] update watchlist --- src/views/AgentChat/hooks/useAgentChat.ts | 3 ++- src/views/AgentChat/hooks/useAgentSessions.ts | 5 +++-- src/views/AgentChat/hooks/useInvestmentMeeting.ts | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/views/AgentChat/hooks/useAgentChat.ts b/src/views/AgentChat/hooks/useAgentChat.ts index c1564532..0e9c76ee 100644 --- a/src/views/AgentChat/hooks/useAgentChat.ts +++ b/src/views/AgentChat/hooks/useAgentChat.ts @@ -5,6 +5,7 @@ import { useState, useCallback } from 'react'; import type { Dispatch, SetStateAction, KeyboardEvent } from 'react'; import axios from 'axios'; import { MessageTypes, type Message } from '../constants/messageTypes'; +import { getApiBase } from '@utils/apiConfig'; import type { UploadedFile } from './useFileUpload'; import type { User } from './useAgentSessions'; @@ -161,7 +162,7 @@ export const useAgentChat = ({ }); // 调用后端 API - const response = await axios.post('/mcp/agent/chat', { + const response = await axios.post(`${getApiBase()}/mcp/agent/chat`, { message: userInput, conversation_history: messages .filter((m) => m.type === MessageTypes.USER || m.type === MessageTypes.AGENT_RESPONSE) diff --git a/src/views/AgentChat/hooks/useAgentSessions.ts b/src/views/AgentChat/hooks/useAgentSessions.ts index a611db7e..3b3553f6 100644 --- a/src/views/AgentChat/hooks/useAgentSessions.ts +++ b/src/views/AgentChat/hooks/useAgentSessions.ts @@ -5,6 +5,7 @@ import { useState, useEffect, useCallback } from 'react'; import type { Dispatch, SetStateAction } from 'react'; import axios from 'axios'; import { MessageTypes, type Message } from '../constants/messageTypes'; +import { getApiBase } from '@utils/apiConfig'; /** * 会话数据结构 @@ -94,7 +95,7 @@ export const useAgentSessions = ({ setIsLoadingSessions(true); try { - const response = await axios.get('/mcp/agent/sessions', { + const response = await axios.get(`${getApiBase()}/mcp/agent/sessions`, { params: { user_id: String(user.id), limit: 50 }, }); @@ -133,7 +134,7 @@ export const useAgentSessions = ({ if (!sessionId) return; try { - const response = await axios.get(`/mcp/agent/history/${sessionId}`, { + const response = await axios.get(`${getApiBase()}/mcp/agent/history/${sessionId}`, { params: { limit: 100 }, }); diff --git a/src/views/AgentChat/hooks/useInvestmentMeeting.ts b/src/views/AgentChat/hooks/useInvestmentMeeting.ts index 3862d17f..d779a68a 100644 --- a/src/views/AgentChat/hooks/useInvestmentMeeting.ts +++ b/src/views/AgentChat/hooks/useInvestmentMeeting.ts @@ -4,6 +4,7 @@ import { useState, useCallback, useRef } from 'react'; import axios from 'axios'; +import { getApiBase } from '@utils/apiConfig'; import { MeetingMessage, MeetingStatus, @@ -265,7 +266,7 @@ export const useInvestmentMeeting = ({ try { // 使用 fetch 进行 POST 请求的 SSE - const response = await fetch('/mcp/agent/meeting/stream', { + const response = await fetch(`${getApiBase()}/mcp/agent/meeting/stream`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -483,7 +484,7 @@ export const useInvestmentMeeting = ({ })); // 使用 fetch 进行 POST 请求的 SSE - const response = await fetch('/mcp/agent/meeting/stream', { + const response = await fetch(`${getApiBase()}/mcp/agent/meeting/stream`, { method: 'POST', headers: { 'Content-Type': 'application/json',