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} /> + } + > +