5 Commits

Author SHA1 Message Date
v-zhangjc9
602a337923 fix(chat): 修复上传文件选择错误 2025-05-30 17:35:59 +08:00
v-zhangjc9
fe9e185a9a feat(web): 增加根据环境切换debug状态 2025-05-30 17:35:39 +08:00
v-zhangjc9
3901a47da0 feat(web): 增加知识库选择 2025-05-30 17:35:24 +08:00
v-zhangjc9
dc5998cf72 feat(web): 增加命中测试按钮 2025-05-30 17:35:15 +08:00
v-zhangjc9
993940e810 feat(web): 升级前端依赖 2025-05-30 17:34:41 +08:00
7 changed files with 730 additions and 640 deletions

View File

@@ -1,6 +1,6 @@
import {cd, path} from 'zx'
import {trim} from "licia";
import {run_deploy, run_package, run_upload} from '../../bin/library.js'
import {run_deploy, run_package, run_upload_normal} from '../../bin/library.js'
// 切换目录
cd(trim(path.dirname(import.meta.dirname)))
@@ -8,7 +8,7 @@ cd(trim(path.dirname(import.meta.dirname)))
try {
await run_deploy('service-ai-core')
await run_package('service-ai-chat')
await run_upload('service-ai-chat')
await run_upload_normal('service-ai-chat')
} catch (e) {
console.error(e)
}

View File

@@ -11,29 +11,29 @@
"dependencies": {
"@ant-design/icons": "^6.0.0",
"@ant-design/pro-components": "^2.8.7",
"@ant-design/x": "^1.2.0",
"@ant-design/x": "^1.4.0",
"@echofly/fetch-event-source": "^3.0.2",
"@fortawesome/fontawesome-free": "^6.7.2",
"@tinyflow-ai/react": "^0.1.6",
"@tinyflow-ai/react": "^0.1.10",
"amis": "^6.12.0",
"antd": "^5.25.0",
"antd": "^5.25.3",
"axios": "^1.9.0",
"licia": "^1.48.0",
"markdown-it": "^14.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^7.5.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router": "^7.6.1",
"styled-components": "^6.1.18"
},
"devDependencies": {
"@types/markdown-it": "^14.1.2",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react-swc": "^3.9.0",
"globals": "^16.0.0",
"sass": "^1.87.0",
"@types/react": "^18.3.23",
"@types/react-dom": "^18.3.7",
"@vitejs/plugin-react-swc": "^3.10.0",
"globals": "^16.2.0",
"sass": "^1.89.0",
"typescript": "~5.8.3",
"typescript-eslint": "^8.30.1",
"typescript-eslint": "^8.33.0",
"vite": "^6.3.5"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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('</think>')
if (split.length > 1) {
content = `${split[0]}</think>${md.render(split[1])}`
}
return (
<Typography>
<div dangerouslySetInnerHTML={{__html: content}}/>
<div dangerouslySetInnerHTML={{__html: md.render(content)}}/>
</Typography>
)
},
@@ -164,6 +161,28 @@ function Conversation() {
disabled={messages.length > 0}
/>
<Divider type="vertical"/>
<Popover
title="选择知识库"
trigger="hover"
content={<Radio.Group
style={{
display: 'flex',
flexDirection: 'column',
gap: 10,
}}
options={[
{value: 1, label: '测试'},
{value: 2, label: 'Hudi'},
{value: 3, label: 'Apache Hudi'},
]}
/>}
>
<Button
icon={<FileOutlined/>}
type="text"
size="small"
/>
</Popover>
<Tooltip title="清空对话">
<Button
icon={<ClearOutlined/>}
@@ -172,6 +191,7 @@ function Conversation() {
onClick={() => setMessages([])}
/>
</Tooltip>
<Divider type="vertical"/>
</Flex>
<Flex align="center">
{agent.isRequesting() ? (

View File

@@ -62,6 +62,42 @@ const DataDetail: React.FC = () => {
},
},
},
{
type: 'action',
icon: 'fa fa-magnifying-glass',
label: '',
tooltip: '命中测试',
tooltipPlacement: 'top',
actionType: 'dialog',
dialog: {
title: '命中测试',
size: 'lg',
actions: [],
body: [
{
type: 'input-text',
addOn: {
type: 'action',
label: '检索',
icon: 'fa fa-magnifying-glass',
},
},
{
name: '182e8657-5352-42ad-9ab4-8252d33eef91',
type: 'crud',
source: '${search_items}',
...crudCommonOptions(),
canAccessSuperData: false,
columns: [
{
name: 'text',
label: '内容',
},
],
},
],
},
},
],
columns: [
{

View File

@@ -5,8 +5,10 @@ import 'amis/lib/helper.css'
import 'amis/sdk/iconfont.css'
import '@fortawesome/fontawesome-free/css/all.min.css'
import axios from 'axios'
import {isEqual} from 'licia'
export const commonInfo = {
debug: isEqual(import.meta.env.MODE, 'development'),
baseUrl: 'http://132.126.207.130:35690/hudi_services/service_web',
baseAiChatUrl: 'http://132.126.207.130:35690/hudi_services/ai_chat',
baseAiKnowledgeUrl: 'http://132.126.207.130:35690/hudi_services/ai_knowledge',
@@ -79,7 +81,7 @@ export const amisRender = (schema: Schema, data: Record<any, any> = {}) => {
theme: theme,
},
{
enableAMISDebug: true,
enableAMISDebug: commonInfo.debug,
fetcher: async (api: any) => {
let {url, method, data, responseType, config, headers} = api
config = config || {}

View File

@@ -1,5 +1,5 @@
import react from '@vitejs/plugin-react-swc'
import {defineConfig, UserConfig} from 'vite'
import {defineConfig, type UserConfig} from 'vite'
// https://vite.dev/config/
export default defineConfig(({mode}) => {