import React from 'react' import { GalleryHorizontal } from 'lucide-react' import { cn } from '@/utils/cn' interface SlideFile { id: string title?: string summary?: string path?: string filename?: string } interface SlideOutlineOutput { slide_files?: SlideFile[] project_path?: string } export interface SlideOutlineActionProps { /** action 名称(如"正在初始化PPT大纲") */ name?: string /** 参数(如主标题) */ arguments?: string[] /** tool_output,包含 slide_files */ toolOutput?: unknown /** 点击整体卡片的回调(对应 BlockAction 的 onClick) */ onClick?: () => void className?: string } /** * slide_init 专属渲染组件 * 对应 Remix: BlockAction + SlideOutline (compact) */ function InnerSlideOutlineAction({ name, arguments: args, toolOutput, onClick, className, }: SlideOutlineActionProps) { const output = toolOutput as SlideOutlineOutput | undefined const slideFiles = output?.slide_files || [] return (
{ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onClick() } } : undefined} > {/* 标题栏 */}
{name || '初始化幻灯片'} {args && args.length > 0 && ( {args.join(' ')} )}
{/* 幻灯片大纲列表 */}
{slideFiles.length === 0 ? (
{[1, 2, 3].map(i => (
))}
) : (
{slideFiles.map((slide, index) => (
P{index + 1}
{slide.title ? (

{slide.title}

) : (
)} {slide.summary ? (

{slide.summary}

) : (
)}
))}
)}
{/* 底部渐变遮罩(对应 Remix BlockAction 的渐变效果) */} {slideFiles.length > 3 && (
)}
) } export const SlideOutlineAction = React.memo(InnerSlideOutlineAction) export default SlideOutlineAction