feat(web): 增加预览
This commit is contained in:
@@ -27,7 +27,6 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
type: 'form',
|
type: 'form',
|
||||||
wrapWithPanel: false,
|
wrapWithPanel: false,
|
||||||
mode: 'horizontal',
|
|
||||||
actions: [],
|
actions: [],
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
@@ -43,10 +42,12 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
value: 'llm',
|
value: 'llm',
|
||||||
label: '智能模式',
|
label: '智能模式',
|
||||||
|
disabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'qa',
|
value: 'qa',
|
||||||
label: 'Q/A模式',
|
label: 'Q/A模式',
|
||||||
|
disabled: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -63,6 +64,7 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
value: 'file',
|
value: 'file',
|
||||||
label: '文件',
|
label: '文件',
|
||||||
|
disabled: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -94,6 +96,29 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '预览',
|
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',
|
type: 'submit',
|
||||||
@@ -109,24 +134,34 @@ const DataImport: React.FC = () => {
|
|||||||
{
|
{
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'card',
|
|
||||||
className: 'h-full',
|
className: 'h-full',
|
||||||
header: {
|
name: 'preview_list',
|
||||||
title: '解析预览',
|
type: 'service',
|
||||||
subTitle: '截取部份文本进行解析预览',
|
|
||||||
},
|
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'list',
|
type: 'tpl',
|
||||||
|
tpl: '文本分段预览',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'crud',
|
||||||
|
mode: 'list',
|
||||||
source: '${rows}',
|
source: '${rows}',
|
||||||
listItem: [
|
loadDataOnce: true,
|
||||||
|
syncLocation: false,
|
||||||
|
perPage: 20,
|
||||||
|
footerToolbar: [
|
||||||
{
|
{
|
||||||
body: {
|
type: 'pagination',
|
||||||
type: 'tpl',
|
mode: 'normal',
|
||||||
tpl: '${content}',
|
layout: 'total,perPage,pager',
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
listItem: {
|
||||||
|
body: {
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: '${text}',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user