Skip to content

Refactor ModelTryContentButton to use useMultiStepNotification #6237

@yomybaby

Description

@yomybaby

Replace the manual notification orchestration in ModelTryContentButton with the useMultiStepNotification hook (FR-2392).

Current Flow (to be replaced)

  1. User clicks 'Run this model' → modal.confirm() clone dialog
  2. Clone mutation fires → upsertNotification with SSE taskId for clone progress
  3. useEffect watches notifications array for clone completion → triggers service creation
  4. Service creation → separate upsertNotification with polling Promise

New Flow (multi-step notification)

  1. User clicks 'Run this model' → modal.confirm() clone dialog (same)
  2. Call start() from useMultiStepNotification with 3 steps:
    • Step 1 (SSE): 'Cloning model folder...' — clone vfolder, returns { taskId }
    • Step 2 (Promise): 'Creating service...' — POST /services with cloned folder ID
    • Step 3 (Promise): 'Waiting for service to be ready...' — poll until active routes
  3. On completion: show 'Play your model now!' link to /chat?endpointId=...
  4. On failure: show retry button + 'Go to service detail page' link

When already-cloned folder exists

  • Steps reduce to Step 2 + Step 3 only (skip clone)

Key Changes

  • Remove pendingCloneRef and the useEffect that watches notifications
  • Remove createServiceNotificationMsg function
  • Add i18n keys: modelService.CloningModelFolder, modelService.CreatingService, modelService.WaitingForServiceReady

Acceptance Criteria

  • Unified notification with step progress (clone → create → ready)
  • Cancel button works at any step
  • Retry works from failed step
  • 'Play your model now!' link on completion
  • Same behavior for already-cloned folder path (skip clone step)

Dependencies

  • FR-2404 (extract shared utilities)
  • FR-2392 (useMultiStepNotification — already merged)

Changed Files

  • react/src/components/ModelTryContentButton.tsx
  • resources/i18n/en.json

JIRA Issue: FR-2405

Metadata

Metadata

Assignees

No one assigned

    Labels

    claude-batchIssues created by Claude batch workflowstatus:reviewUnder review

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions