({
node,
level,
isSelected,
isExpanded,
hasChildren,
onSelect,
onToggleExpansion,
onDelete,
onGenerateChildren
})
| 18 | } |
| 19 | |
| 20 | const ObjectNode: React.FC<ObjectNodeProps> = ({ |
| 21 | node, |
| 22 | level, |
| 23 | isSelected, |
| 24 | isExpanded, |
| 25 | hasChildren, |
| 26 | onSelect, |
| 27 | onToggleExpansion, |
| 28 | onDelete, |
| 29 | onGenerateChildren |
| 30 | }) => { |
| 31 | const { modal, message } = App.useApp() |
| 32 | |
| 33 | // 处理AI生成 |
| 34 | const handleAIGenerate = () => { |
| 35 | let aiPrompt = '' |
| 36 | |
| 37 | modal.confirm({ |
| 38 | title: `为 "${node.name}" 生成子对象`, |
| 39 | content: ( |
| 40 | <div> |
| 41 | <div style={{ marginBottom: 16 }}> |
| 42 | <Typography.Text type="secondary">请描述您希望生成什么类型的子对象:</Typography.Text> |
| 43 | </div> |
| 44 | <Input.TextArea |
| 45 | placeholder="例如:生成3个员工节点,包含姓名、部门、职位信息" |
| 46 | rows={4} |
| 47 | maxLength={200} |
| 48 | showCount |
| 49 | onChange={(e) => { |
| 50 | aiPrompt = e.target.value |
| 51 | }} |
| 52 | /> |
| 53 | </div> |
| 54 | ), |
| 55 | okText: '生成', |
| 56 | cancelText: '取消', |
| 57 | width: 500, |
| 58 | onOk: () => { |
| 59 | if (aiPrompt.trim()) { |
| 60 | onGenerateChildren(aiPrompt.trim()) |
| 61 | message.success('AI生成请求已提交') |
| 62 | } else { |
| 63 | message.warning('请输入生成提示') |
| 64 | return Promise.reject() |
| 65 | } |
| 66 | } |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | const isGenerating = node.metadata?.source === 'ai' && !hasChildren |
| 71 | |
| 72 | return ( |
| 73 | <div |
| 74 | style={{ |
| 75 | paddingLeft: `${level * 16 + 12}px`, |
| 76 | paddingRight: '12px', |
| 77 | paddingTop: '4px', |
nothing calls this directly
no test coverage detected