Files
hudi-service/service-web/client/src/pages/ai/knowledge/DataSegment.tsx
2025-06-19 11:31:07 +08:00

108 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 (
<div className="import-detail h-full">
{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: '删除',
},
],
},
],
},
],
},
)}
</div>
)
}
export default DataDetail