import { SetStateAction } from 'react'; import { UIBlock } from './block'; import { FileIcon, LoaderIcon, MessageIcon, PencilEditIcon } from './icons'; const getActionText = (type: 'create' | 'update' | 'request-suggestions') => { switch (type) { case 'create': return 'Creating'; case 'update': return 'Updating'; case 'request-suggestions': return 'Adding suggestions'; default: return null; } }; interface DocumentToolResultProps { type: 'create' | 'update' | 'request-suggestions'; result: any; block: UIBlock; setBlock: (value: SetStateAction) => void; } export function DocumentToolResult({ type, result, block, setBlock, }: DocumentToolResultProps) { return (
{ const rect = event.currentTarget.getBoundingClientRect(); const boundingBox = { top: rect.top, left: rect.left, width: rect.width, height: rect.height, }; setBlock({ documentId: result.id, content: '', title: result.title, isVisible: true, status: 'idle', boundingBox, }); }} >
{type === 'create' ? ( ) : type === 'update' ? ( ) : type === 'request-suggestions' ? ( ) : null}
{getActionText(type)} {result.title}
); } interface DocumentToolCallProps { type: 'create' | 'update' | 'request-suggestions'; args: any; } export function DocumentToolCall({ type, args }: DocumentToolCallProps) { return (
{type === 'create' ? ( ) : type === 'update' ? ( ) : type === 'request-suggestions' ? ( ) : null}
{getActionText(type)} {args.title}
{}
); }