From 242710f4d76c0d93f8839e78d38640905fb1c0cf Mon Sep 17 00:00:00 2001 From: waleed Date: Wed, 28 Jan 2026 11:51:51 -0800 Subject: [PATCH] add wand to generate diff --- .../components/version-description-modal.tsx | 50 ++- apps/sim/hooks/queries/deployments.ts | 141 +++++++++ apps/sim/lib/workflows/comparison/compare.ts | 288 ++++++++++++++++++ 3 files changed, 466 insertions(+), 13 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/general/components/version-description-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/general/components/version-description-modal.tsx index 33b95d5a7..6332971de 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/general/components/version-description-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/general/components/version-description-modal.tsx @@ -10,7 +10,10 @@ import { ModalHeader, Textarea, } from '@/components/emcn' -import { useUpdateDeploymentVersion } from '@/hooks/queries/deployments' +import { + useGenerateVersionDescription, + useUpdateDeploymentVersion, +} from '@/hooks/queries/deployments' interface VersionDescriptionModalProps { open: boolean @@ -29,14 +32,15 @@ export function VersionDescriptionModal({ versionName, currentDescription, }: VersionDescriptionModalProps) { - // Initialize state from props - component remounts via key prop when version changes const initialDescription = currentDescription || '' const [description, setDescription] = useState(initialDescription) const [showUnsavedChangesAlert, setShowUnsavedChangesAlert] = useState(false) const updateMutation = useUpdateDeploymentVersion() + const generateMutation = useGenerateVersionDescription() const hasChanges = description.trim() !== initialDescription.trim() + const isGenerating = generateMutation.isPending const handleCloseAttempt = useCallback(() => { if (hasChanges && !updateMutation.isPending) { @@ -52,6 +56,16 @@ export function VersionDescriptionModal({ onOpenChange(false) }, [initialDescription, onOpenChange]) + const handleGenerateDescription = useCallback(() => { + generateMutation.mutate({ + workflowId, + version, + onStreamChunk: (accumulated) => { + setDescription(accumulated) + }, + }) + }, [workflowId, version, generateMutation]) + const handleSave = useCallback(async () => { if (!workflowId) return @@ -76,26 +90,36 @@ export function VersionDescriptionModal({ Version Description - -

- {currentDescription ? 'Edit the' : 'Add a'} description for{' '} - {versionName} -

+ +
+

+ {currentDescription ? 'Edit the' : 'Add a'} description for{' '} + {versionName} +

+ +