fix: resolve conversation API issues

1. Fixed double data unwrapping in AgentChatPage
2. Fixed API URL in sendMessageStream (use relative path /api/v1)

Verified working: AI can now respond to messages
This commit is contained in:
AI Clinical Dev Team
2025-10-10 21:52:10 +08:00
parent 6e8b43f6df
commit fdebb44859
2 changed files with 4 additions and 3 deletions

View File

@@ -91,7 +91,8 @@ export const sendMessageStream = async (
onError: (error: Error) => void
) => {
try {
const response = await fetch(`${import.meta.env.VITE_API_BASE_URL}/conversations/message/stream`, {
// 使用相对路径通过Vite代理转发到后端
const response = await fetch('/api/v1/conversations/message/stream', {
method: 'POST',
headers: {
'Content-Type': 'application/json',

View File

@@ -71,8 +71,8 @@ const AgentChatPage = () => {
title: `${agent.name}的对话`,
})
if (response.data.success && response.data.data) {
setConversation(response.data.data)
if (response.success && response.data) {
setConversation(response.data)
setMessages([])
}
} catch (err) {