feat(ai): 完善知识库接口
This commit is contained in:
144
service-web/client/src/pages/ai/knowledge/DataImport.tsx
Normal file
144
service-web/client/src/pages/ai/knowledge/DataImport.tsx
Normal 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
|
||||
Reference in New Issue
Block a user