From 3901a47da067af5a2ebee72953c857c220b9507e Mon Sep 17 00:00:00 2001 From: v-zhangjc9 Date: Fri, 30 May 2025 17:35:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E5=A2=9E=E5=8A=A0=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E5=BA=93=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/src/pages/ai/Conversation.tsx | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/service-web/client/src/pages/ai/Conversation.tsx b/service-web/client/src/pages/ai/Conversation.tsx index a728538..ff1d186 100644 --- a/service-web/client/src/pages/ai/Conversation.tsx +++ b/service-web/client/src/pages/ai/Conversation.tsx @@ -1,10 +1,11 @@ -import {ClearOutlined, UserOutlined} from '@ant-design/icons' +import {ClearOutlined, FileOutlined, UserOutlined} from '@ant-design/icons' import {Bubble, Sender, useXAgent, useXChat, Welcome} from '@ant-design/x' import {fetchEventSource} from '@echofly/fetch-event-source' -import {Button, Divider, Flex, Switch, Tooltip, Typography} from 'antd' +import {Button, Divider, Flex, Popover, Radio, Switch, Tooltip, Typography} from 'antd' import markdownIt from 'markdown-it' import {useRef, useState} from 'react' import styled from 'styled-components' +import {commonInfo} from '../../util/amis.tsx' const md = markdownIt({html: true, breaks: true}) const ConversationDiv = styled.div` @@ -49,7 +50,7 @@ function Conversation() { const [agent] = useXAgent<{ role: string, content: string }>({ request: async (info, callbacks) => { - await fetchEventSource('http://127.0.0.1:8080/chat/async', { + await fetchEventSource(`${commonInfo.baseAiChatUrl}/chat/async`, { method: 'POST', headers: { 'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==', @@ -105,13 +106,9 @@ function Conversation() { }, }, messageRender: content => { - let split = content.split('') - if (split.length > 1) { - content = `${split[0]}${md.render(split[1])}` - } return ( -
+
) }, @@ -164,6 +161,28 @@ function Conversation() { disabled={messages.length > 0} /> + } + > +