feat(web): 增加预览
This commit is contained in:
@@ -27,7 +27,6 @@ const DataImport: React.FC = () => {
|
||||
{
|
||||
type: 'form',
|
||||
wrapWithPanel: false,
|
||||
mode: 'horizontal',
|
||||
actions: [],
|
||||
body: [
|
||||
{
|
||||
@@ -43,10 +42,12 @@ const DataImport: React.FC = () => {
|
||||
{
|
||||
value: 'llm',
|
||||
label: '智能模式',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: 'qa',
|
||||
label: 'Q/A模式',
|
||||
disabled: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -63,6 +64,7 @@ const DataImport: React.FC = () => {
|
||||
{
|
||||
value: 'file',
|
||||
label: '文件',
|
||||
disabled: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -94,6 +96,29 @@ const DataImport: React.FC = () => {
|
||||
{
|
||||
type: 'action',
|
||||
label: '预览',
|
||||
actionType: 'ajax',
|
||||
api: {
|
||||
method: 'post',
|
||||
url: 'http://127.0.0.1:8080/knowledge/preview_text',
|
||||
headers: {
|
||||
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
|
||||
},
|
||||
dataType: 'form',
|
||||
data: {
|
||||
name: name,
|
||||
mode: '${mode}',
|
||||
type: '${type}',
|
||||
content: '${content}',
|
||||
},
|
||||
// @ts-ignore
|
||||
adaptor: (payload, response, api, context) => {
|
||||
console.log(payload)
|
||||
return {
|
||||
items: payload,
|
||||
}
|
||||
},
|
||||
},
|
||||
reload: 'preview_list?rows=${items}',
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
@@ -109,24 +134,34 @@ const DataImport: React.FC = () => {
|
||||
{
|
||||
body: [
|
||||
{
|
||||
type: 'card',
|
||||
className: 'h-full',
|
||||
header: {
|
||||
title: '解析预览',
|
||||
subTitle: '截取部份文本进行解析预览',
|
||||
},
|
||||
name: 'preview_list',
|
||||
type: 'service',
|
||||
body: [
|
||||
{
|
||||
type: 'list',
|
||||
type: 'tpl',
|
||||
tpl: '文本分段预览',
|
||||
},
|
||||
{
|
||||
type: 'crud',
|
||||
mode: 'list',
|
||||
source: '${rows}',
|
||||
listItem: [
|
||||
loadDataOnce: true,
|
||||
syncLocation: false,
|
||||
perPage: 20,
|
||||
footerToolbar: [
|
||||
{
|
||||
body: {
|
||||
type: 'tpl',
|
||||
tpl: '${content}',
|
||||
},
|
||||
type: 'pagination',
|
||||
mode: 'normal',
|
||||
layout: 'total,perPage,pager',
|
||||
},
|
||||
],
|
||||
listItem: {
|
||||
body: {
|
||||
type: 'tpl',
|
||||
tpl: '${text}',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user