import React from 'react'
import {useParams} from 'react-router'
import {amisRender, commonInfo, crudCommonOptions} from '../../../util/amis.tsx'
const DataDetail: React.FC = () => {
const {knowledge_id, group_id} = useParams()
return (
{amisRender(
{
className: 'h-full',
type: 'page',
title: {
type: 'wrapper',
size: 'none',
body: [
'数据详情 (知识库:',
{
type: 'service',
className: 'inline',
api: `${commonInfo.baseAiUrl}/knowledge/name?id=${knowledge_id}`,
body: {
type: 'tpl',
tpl: '${name}',
},
},
')',
],
},
size: 'lg',
actions: [],
body: [
{
type: 'crud',
api: `${commonInfo.baseAiUrl}/knowledge/segment/list?knowledge_id=${knowledge_id}&group_id=${group_id}`,
...crudCommonOptions(),
headerToolbar: [
'reload',
],
columns: [
{
name: 'id',
hidden: true,
},
{
name: 'text',
label: '内容',
className: 'white-space-pre-line',
},
{
type: 'operation',
label: '操作',
width: 50,
buttons: [
/*{
type: 'action',
label: '编辑',
level: 'link',
size: 'lg',
actionType: 'dialog',
dialog: {
title: '编辑文段',
size: 'md',
body: {
type: 'form',
body: [
{
type: 'input-text',
name: 'id',
disabled: true,
label: '文段ID',
},
{
type: 'editor',
label: '内容',
name: 'text',
language: 'plaintext',
options: {
lineNumbers: 'off',
wordWrap: 'bounded',
},
},
],
},
},
},*/
{
type: 'action',
label: '删除',
className: 'text-danger btn-deleted',
level: 'link',
size: 'sm',
actionType: 'ajax',
confirmText: '删除后无法恢复,确认删除该记录?',
confirmTitle: '删除',
},
],
},
],
},
],
},
)}
)
}
export default DataDetail