2026-03-26 06:55:12 +00:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import { Card, Tabs, Typography, Space, Button, Empty } from 'antd';
|
|
|
|
|
import {
|
|
|
|
|
FileTextOutlined,
|
|
|
|
|
PartitionOutlined,
|
|
|
|
|
CopyOutlined,
|
|
|
|
|
PictureOutlined,
|
|
|
|
|
BulbOutlined
|
|
|
|
|
} from '@ant-design/icons';
|
2026-01-19 11:03:08 +00:00
|
|
|
import MarkdownRenderer from './MarkdownRenderer';
|
2026-03-26 06:55:12 +00:00
|
|
|
import MindMap from './MindMap';
|
2026-01-19 11:03:08 +00:00
|
|
|
|
2026-03-26 06:55:12 +00:00
|
|
|
const { Title, Text } = Typography;
|
2026-01-19 11:03:08 +00:00
|
|
|
|
2026-03-26 06:55:12 +00:00
|
|
|
const ContentViewer = ({
|
|
|
|
|
content,
|
|
|
|
|
title,
|
|
|
|
|
emptyMessage = "暂无内容",
|
|
|
|
|
summaryActions = null,
|
|
|
|
|
mindmapActions = null
|
2026-01-19 11:03:08 +00:00
|
|
|
}) => {
|
2026-03-26 06:55:12 +00:00
|
|
|
const [activeTab, setActiveTab] = useState('summary');
|
|
|
|
|
|
|
|
|
|
if (!content) {
|
|
|
|
|
return (
|
|
|
|
|
<Card bordered={false} style={{ borderRadius: 12 }}>
|
|
|
|
|
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={emptyMessage} />
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const items = [
|
|
|
|
|
{
|
|
|
|
|
key: 'summary',
|
|
|
|
|
label: <Space><FileTextOutlined />智能摘要</Space>,
|
|
|
|
|
children: (
|
|
|
|
|
<div style={{ padding: '8px 0' }}>
|
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginBottom: 16 }}>
|
|
|
|
|
<Space>{summaryActions}</Space>
|
2026-01-19 11:03:08 +00:00
|
|
|
</div>
|
2026-03-26 06:55:12 +00:00
|
|
|
<MarkdownRenderer content={content} />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'mindmap',
|
|
|
|
|
label: <Space><PartitionOutlined />思维导图</Space>,
|
|
|
|
|
children: (
|
|
|
|
|
<div style={{ padding: '8px 0' }}>
|
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginBottom: 16 }}>
|
|
|
|
|
<Space>{mindmapActions}</Space>
|
2026-01-19 11:03:08 +00:00
|
|
|
</div>
|
2026-03-26 06:55:12 +00:00
|
|
|
<div style={{ minHeight: 500, background: '#f8fafc', borderRadius: 12 }}>
|
|
|
|
|
<MindMap content={content} title={title} />
|
2026-01-19 11:03:08 +00:00
|
|
|
</div>
|
2026-03-26 06:55:12 +00:00
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Card bordered={false} bodyStyle={{ padding: '12px 24px' }} style={{ borderRadius: 12 }}>
|
|
|
|
|
<Tabs
|
|
|
|
|
className="console-tabs"
|
|
|
|
|
activeKey={activeTab}
|
|
|
|
|
onChange={setActiveTab}
|
|
|
|
|
items={items}
|
|
|
|
|
size="large"
|
|
|
|
|
/>
|
|
|
|
|
</Card>
|
2026-01-19 11:03:08 +00:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default ContentViewer;
|