Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5058,27 +5058,16 @@
}
},
"nudge": {
"title": "Your first output. Here's what's next.",
"body": "Each one starts from the image you just made.",
"animate": {
"title": "Animate it",
"detail": "Image to video · 5s"
"ran": {
"title": "That was one of hundreds",
"body": "You just made your first. Explore what else you can build."
},
"upscale": {
"title": "Upscale it",
"detail": "Same image, more detail",
"badge": "4x"
},
"restyle": {
"title": "Restyle with Nano Banana",
"detail": "Partner model · Any paid plan"
},
"fallback": {
"noTour": {
"title": "Hundreds more where that came from",
"body": "Browse the templates and pick something to build."
},
"loadFailed": "That template couldn't be loaded. Please try again.",
"explore": "Browse all templates"
"dismiss": "Not now",
"explore": "Explore templates"
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/platform/telemetry/TelemetryRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import type {
OnboardingTourStage,
OnboardingTourStepMetadata,
OnboardingTourStepStage,
OnboardingTourSuggestionMetadata,
OnboardingTourSuggestionStage,
SearchQueryMetadata,
PageViewMetadata,
PageVisibilityMetadata,
Expand Down Expand Up @@ -205,10 +203,6 @@ export class TelemetryRegistry implements TelemetryDispatcher {
stage: OnboardingTourNudgeStage,
metadata: OnboardingTourNudgeMetadata
): void
trackOnboardingTour(
stage: OnboardingTourSuggestionStage,
metadata: OnboardingTourSuggestionMetadata
): void
trackOnboardingTour(
stage: OnboardingTourStage,
metadata: OnboardingTourMetadata
Expand Down
35 changes: 6 additions & 29 deletions src/platform/telemetry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,9 @@ export type OnboardingTourNudgeStage =
| 'nudge_shown'
| 'explore_templates_clicked'

/** A continuation action on the nudge, which reports its own outcome. */
export type OnboardingTourSuggestionStage = 'nudge_suggestion_clicked'

export type OnboardingTourStage =
| OnboardingTourStepStage
| OnboardingTourNudgeStage
| OnboardingTourSuggestionStage

export type OnboardingTourSkipReason =
| 'user'
Expand Down Expand Up @@ -157,32 +153,21 @@ export interface OnboardingTourStepMetadata {
not_started_reason?: OnboardingTourNotStartedReason
}

/** The nudge is post-tour, so it reports no step and no step count. */
/** The nudge is post-tour, so it reports no step and no count. */
export interface OnboardingTourNudgeMetadata {
tour: string
/**
* How many continuations the card could offer. Zero is the card falling back
* to the template browser — either the run produced no image, or the
* install's pinned template package serves none of them. Without it that
* case is indistinguishable from a nudge that never appeared.
* Whether the tour was walked to the end. Without it `nudge_shown` and
* `explore_templates_clicked` cannot be split by how the tour ended, so a
* conversion from a completed tour and one from a tour that never started
* land in the same bucket.
*/
suggestion_count: number
}

/**
* Which continuation the card converted on. `loaded` separates a chosen action
* from one that reached a template the install could not open, which otherwise
* reads as a successful conversion.
*/
export interface OnboardingTourSuggestionMetadata extends OnboardingTourNudgeMetadata {
suggestion: string
loaded: boolean
tour_completed?: boolean
}

export type OnboardingTourMetadata =
| OnboardingTourStepMetadata
| OnboardingTourNudgeMetadata
| OnboardingTourSuggestionMetadata

export interface SurveyResponsesNormalized extends SurveyResponses {
industry_normalized?: string
Expand Down Expand Up @@ -964,10 +949,6 @@ export interface TelemetryProvider {
stage: OnboardingTourNudgeStage,
metadata: OnboardingTourNudgeMetadata
): void
trackOnboardingTour?(
stage: OnboardingTourSuggestionStage,
metadata: OnboardingTourSuggestionMetadata
): void

// Email verification events
trackEmailVerification?(stage: 'opened' | 'requested' | 'completed'): void
Expand Down Expand Up @@ -1119,8 +1100,6 @@ export const TelemetryEvents = {
ONBOARDING_TOUR_COMPLETED: 'app:onboarding_tour_completed',
ONBOARDING_TOUR_SKIPPED: 'app:onboarding_tour_skipped',
ONBOARDING_TOUR_NUDGE_SHOWN: 'app:onboarding_tour_nudge_shown',
ONBOARDING_TOUR_NUDGE_SUGGESTION_CLICKED:
'app:onboarding_tour_nudge_suggestion_clicked',
ONBOARDING_TOUR_EXPLORE_TEMPLATES_CLICKED:
'app:onboarding_tour_explore_templates_clicked',

Expand Down Expand Up @@ -1204,8 +1183,6 @@ export const OnboardingTourEvents: Record<
completed: TelemetryEvents.ONBOARDING_TOUR_COMPLETED,
skipped: TelemetryEvents.ONBOARDING_TOUR_SKIPPED,
nudge_shown: TelemetryEvents.ONBOARDING_TOUR_NUDGE_SHOWN,
nudge_suggestion_clicked:
TelemetryEvents.ONBOARDING_TOUR_NUDGE_SUGGESTION_CLICKED,
explore_templates_clicked:
TelemetryEvents.ONBOARDING_TOUR_EXPLORE_TEMPLATES_CLICKED
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'

import { useTemplateWorkflows } from '@/platform/workflow/templates/composables/useTemplateWorkflows'
import { useWorkflowTemplatesStore } from '@/platform/workflow/templates/repositories/workflowTemplatesStore'
import { app } from '@/scripts/app'

async function flushPromises() {
await new Promise((r) => setTimeout(r, 0))
Expand Down Expand Up @@ -75,27 +74,6 @@ describe('useTemplateWorkflows', () => {
mockWorkflowTemplatesStore = {
isLoaded: false,
loadWorkflowTemplates: vi.fn().mockResolvedValue(true),
getTemplateByName: vi.fn((name: string) =>
name === 'template1'
? {
name,
mediaType: 'image',
mediaSubtype: 'jpg',
sourceModule: 'default',
description: 'Template 1 description',
io: {
inputs: [
{
nodeId: 2,
nodeType: 'LoadImage',
file: 'starter.png',
mediaType: 'image'
}
]
}
}
: undefined
),
groupedTemplates: [
{
label: 'ComfyUI Examples',
Expand Down Expand Up @@ -148,7 +126,6 @@ describe('useTemplateWorkflows', () => {

// Mock fetch response
vi.mocked(fetch).mockResolvedValue({
ok: true,
json: vi.fn().mockResolvedValue({ workflow: 'data' })
} as Partial<Response> as Response)
})
Expand Down Expand Up @@ -321,48 +298,6 @@ describe('useTemplateWorkflows', () => {
expect(fetch).toHaveBeenCalledWith('mock-file-url/templates/template1.json')
})

it('seeds a result into the template before loading the workflow', async () => {
const { loadWorkflowTemplate } = useTemplateWorkflows()
mockWorkflowTemplatesStore.isLoaded = true
vi.mocked(fetch).mockResolvedValueOnce({
ok: true,
json: vi.fn().mockResolvedValue({
nodes: [
{
id: 2,
type: 'LoadImage',
widgets_values: ['starter.png', 'image']
}
]
})
} as Partial<Response> as Response)

const result = await loadWorkflowTemplate('template1', 'default', {
input: {
filename: 'first-output.png',
subfolder: 'tour',
type: 'output'
}
})

expect(result).toBe(true)
expect(app.loadGraphData).toHaveBeenCalledWith(
{
nodes: [
{
id: 2,
type: 'LoadImage',
widgets_values: ['tour/first-output.png [output]', 'image']
}
]
},
true,
true,
'template1',
{ openSource: 'template' }
)
})

it('tracks template telemetry on load in cloud builds', async () => {
const { loadWorkflowTemplate } = useTemplateWorkflows()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@ import type {
TemplateInfo,
WorkflowTemplates
} from '@/platform/workflow/templates/types/template'
import { replaceTemplateImageInput } from '@/platform/workflow/templates/utils/templateWorkflowTransforms'
import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/workflowSchema'
import type { ResultItem } from '@/schemas/apiSchema'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import { useDialogStore } from '@/stores/dialogStore'

interface LoadWorkflowTemplateOptions {
input?: ResultItem
}

export function useTemplateWorkflows() {
const { t } = useI18n()
const workflowTemplatesStore = useWorkflowTemplatesStore()
Expand Down Expand Up @@ -104,15 +97,11 @@ export function useTemplateWorkflows() {
/**
* Loads a workflow template
*/
const loadWorkflowTemplate = async (
id: string,
sourceModule: string,
options: LoadWorkflowTemplateOptions = {}
) => {
const loadWorkflowTemplate = async (id: string, sourceModule: string) => {
if (!isTemplatesLoaded.value) return false

loadingTemplateId.value = id
let json: ComfyWorkflowJSON
let json

try {
// Handle "All" category as a special case
Expand All @@ -137,12 +126,6 @@ export function useTemplateWorkflows() {
// Regular case for normal categories
json = await fetchTemplateJson(id, sourceModule)

if (options.input) {
const template = workflowTemplatesStore.getTemplateByName(id)
if (!template || template.sourceModule !== sourceModule) return false
json = replaceTemplateImageInput(json, template, options.input)
}

const workflowName =
sourceModule === 'default'
? t(`templateWorkflows.template.${id}`, id)
Expand Down Expand Up @@ -170,26 +153,15 @@ export function useTemplateWorkflows() {
/**
* Fetches template JSON from the appropriate endpoint
*/
const fetchTemplateJson = async (
id: string,
sourceModule: string
): Promise<ComfyWorkflowJSON> => {
// Default templates provided by frontend are served on this separate endpoint
const url =
sourceModule === 'default'
? api.fileURL(`/templates/${id}.json`)
: api.apiURL(`/workflow_templates/${sourceModule}/${id}.json`)

const response = await fetch(url)
// An install pinning an older template package serves an error page here,
// which parses as neither JSON nor a workflow. Separating that from a
// template whose metadata drifted is the difference between a bad pin and
// a bad template.
if (!response.ok)
throw new Error(
`Template ${id} is not served by this install (${response.status})`
)
return response.json()
const fetchTemplateJson = async (id: string, sourceModule: string) => {
if (sourceModule === 'default') {
// Default templates provided by frontend are served on this separate endpoint
return fetch(api.fileURL(`/templates/${id}.json`)).then((r) => r.json())
} else {
return fetch(
api.apiURL(`/workflow_templates/${sourceModule}/${id}.json`)
).then((r) => r.json())
}
}

return {
Expand Down
15 changes: 0 additions & 15 deletions src/platform/workflow/templates/types/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@ export interface LogoInfo {
position?: string
}

/** Served by an external `index.json`, so every field may be absent or stale. */
export interface TemplateMediaInfo {
nodeId?: string | number
nodeType?: string
file?: string
mediaType?: string
}

interface TemplateIoInfo {
inputs?: TemplateMediaInfo[]
outputs?: TemplateMediaInfo[]
}

export interface TemplateInfo {
name: string
/**
Expand Down Expand Up @@ -80,8 +67,6 @@ export interface TemplateInfo {
* Logo overlays to display on the template thumbnail.
*/
logos?: LogoInfo[]
/** Declared media entry and exit points for continuing from another result. */
io?: TemplateIoInfo
}

export enum TemplateIncludeOnDistributionEnum {
Expand Down
Loading
Loading