feat(ai): 完善知识库接口

This commit is contained in:
v-zhangjc9
2025-05-16 19:00:55 +08:00
parent be976290b6
commit 5d49c82190
22 changed files with 800 additions and 128 deletions

View File

@@ -0,0 +1,144 @@
import React from 'react'
import {useParams} from 'react-router'
import styled from 'styled-components'
import {amisRender} from '../../../util/amis.tsx'
const ImportDataDiv = styled.div`
.antd-EditorControl {
min-height: 500px !important;
}
`
const DataImport: React.FC = () => {
const {name} = useParams()
return (
<ImportDataDiv className="import-data h-full">
{amisRender({
type: 'page',
title: `数据导入 (知识库:${name}`,
body: [
[
{
className: 'h-full',
type: 'grid',
columns: [
{
body: [
{
type: 'form',
wrapWithPanel: false,
mode: 'horizontal',
actions: [],
body: [
{
name: 'mode',
type: 'radios',
label: '解析模式',
value: 'normal',
options: [
{
value: 'normal',
label: '常规模式',
},
{
value: 'llm',
label: '智能模式',
},
{
value: 'qa',
label: 'Q/A模式',
},
],
},
{
name: 'type',
type: 'radios',
label: '数据形式',
value: 'text',
options: [
{
value: 'text',
label: '文本',
},
{
value: 'file',
label: '文件',
},
],
},
{
visibleOn: 'type === \'text\'',
type: 'editor',
label: '数据内容',
name: 'content',
language: 'plaintext',
options: {
lineNumbers: 'off',
wordWrap: 'bounded',
},
},
{
visibleOn: 'type === \'file\'',
type: 'input-file',
name: 'files',
label: '数据文件',
accept: '.txt,.csv',
autoUpload: false,
drag: true,
multiple: true,
},
{
className: 'text-right',
type: 'button-toolbar',
buttons: [
{
type: 'action',
label: '预览',
},
{
type: 'submit',
label: '提交',
level: 'primary',
},
],
},
],
},
],
},
{
body: [
{
type: 'card',
className: 'h-full',
header: {
title: '解析预览',
subTitle: '截取部份文本进行解析预览',
},
body: [
{
type: 'list',
source: '${rows}',
listItem: [
{
body: {
type: 'tpl',
tpl: '${content}',
},
},
],
},
],
},
],
},
],
},
],
],
})}
</ImportDataDiv>
)
}
export default DataImport