import type { CustomWorldSuggestedAction } from '../../../packages/shared/src/contracts/customWorldAgent'; type CustomWorldAgentQuickActionsProps = { suggestedActions: CustomWorldSuggestedAction[]; disabled: boolean; canDraftFoundation: boolean; showEntityActions?: boolean; showSummaryAction?: boolean; onRequestSummary: () => void; onDraftFoundation: () => void; onGenerateCharacter?: () => void; onGenerateLandmark?: () => void; onGenerateRoleAssets?: () => void; showRoleAssetAction?: boolean; onFocusSuggestedAction: (action?: CustomWorldSuggestedAction) => void; }; function QuickActionButton(props: { label: string; onClick: () => void; disabled: boolean; tone?: 'default' | 'sky' | 'amber'; }) { const { label, onClick, disabled, tone = 'default' } = props; return ( ); } export function CustomWorldAgentQuickActions({ suggestedActions, disabled, canDraftFoundation, showEntityActions = false, showSummaryAction = true, onRequestSummary, onDraftFoundation, onGenerateCharacter, onGenerateLandmark, onGenerateRoleAssets, showRoleAssetAction = false, onFocusSuggestedAction, }: CustomWorldAgentQuickActionsProps) { const summaryAction = suggestedActions.find( (action) => action.type === 'request_summary', ); const draftAction = suggestedActions.find( (action) => action.type === 'draft_foundation', ); const refinementActions = suggestedActions.filter( (action) => action.type !== 'request_summary' && action.type !== 'draft_foundation', ); return (
快捷动作
{showSummaryAction ? ( ) : null} {draftAction && canDraftFoundation ? ( ) : null} {showEntityActions && onGenerateCharacter ? ( ) : null} {showEntityActions && onGenerateLandmark ? ( ) : null} {showRoleAssetAction && onGenerateRoleAssets ? ( ) : null} {refinementActions.length > 0 ? ( refinementActions.slice(0, 2).map((action) => ( onFocusSuggestedAction(action)} disabled={disabled} /> )) ) : !draftAction || !canDraftFoundation ? ( onFocusSuggestedAction()} disabled={disabled} /> ) : null}
); }