mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
Add tutorial workflow function for new desktop users (#2315)
Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
@@ -120,6 +120,14 @@ test.describe('Missing models warning', () => {
|
|||||||
await expect(missingModelsWarning).not.toBeVisible()
|
await expect(missingModelsWarning).not.toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('should show on tutorial workflow', async ({ comfyPage }) => {
|
||||||
|
await comfyPage.setSetting('Comfy.TutorialCompleted', false)
|
||||||
|
await comfyPage.setup({ clearStorage: true })
|
||||||
|
const missingModelsWarning = comfyPage.page.locator('.comfy-missing-models')
|
||||||
|
await expect(missingModelsWarning).toBeVisible()
|
||||||
|
expect(await comfyPage.getSetting('Comfy.TutorialCompleted')).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
// Flaky test after parallelization
|
// Flaky test after parallelization
|
||||||
// https://github.com/Comfy-Org/ComfyUI_frontend/pull/1400
|
// https://github.com/Comfy-Org/ComfyUI_frontend/pull/1400
|
||||||
test.skip('Should download missing model when clicking download button', async ({
|
test.skip('Should download missing model when clicking download button', async ({
|
||||||
|
|||||||
@@ -904,7 +904,9 @@ export const comfyPageFixture = base.extend<{ comfyPage: ComfyPage }>({
|
|||||||
'Comfy.NodeBadge.NodeSourceBadgeMode': NodeBadgeMode.None,
|
'Comfy.NodeBadge.NodeSourceBadgeMode': NodeBadgeMode.None,
|
||||||
// Disable tooltips by default to avoid flakiness.
|
// Disable tooltips by default to avoid flakiness.
|
||||||
'Comfy.EnableTooltips': false,
|
'Comfy.EnableTooltips': false,
|
||||||
'Comfy.userId': userId
|
'Comfy.userId': userId,
|
||||||
|
// Set tutorial completed to true to avoid loading the tutorial workflow.
|
||||||
|
'Comfy.TutorialCompleted': true
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
|||||||
@@ -708,5 +708,12 @@ export const CORE_SETTINGS: SettingParams[] = [
|
|||||||
defaultValue: 'after',
|
defaultValue: 'after',
|
||||||
options: ['before', 'after'],
|
options: ['before', 'after'],
|
||||||
versionModified: '1.6.10'
|
versionModified: '1.6.10'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'Comfy.TutorialCompleted',
|
||||||
|
name: 'Tutorial completed',
|
||||||
|
type: 'hidden',
|
||||||
|
defaultValue: false,
|
||||||
|
versionAdded: '1.8.7'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1061,7 +1061,18 @@ export class ComfyApp {
|
|||||||
|
|
||||||
// We failed to restore a workflow so load the default
|
// We failed to restore a workflow so load the default
|
||||||
if (!restored) {
|
if (!restored) {
|
||||||
await this.loadGraphData()
|
const settingStore = useSettingStore()
|
||||||
|
|
||||||
|
// If tutorial is not completed, load the tutorial workflow
|
||||||
|
if (!settingStore.get('Comfy.TutorialCompleted')) {
|
||||||
|
await settingStore.set('Comfy.TutorialCompleted', true)
|
||||||
|
// Load model folders to ensure the missing models' corresponding folders
|
||||||
|
// can be correctly identified.
|
||||||
|
await useModelStore().loadModelFolders()
|
||||||
|
await useWorkflowService().loadTutorialWorkflow()
|
||||||
|
} else {
|
||||||
|
await this.loadGraphData()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#addDrawNodeHandler()
|
this.#addDrawNodeHandler()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { LGraphCanvas } from '@comfyorg/litegraph'
|
|||||||
import { toRaw } from 'vue'
|
import { toRaw } from 'vue'
|
||||||
|
|
||||||
import { t } from '@/i18n'
|
import { t } from '@/i18n'
|
||||||
|
import { api } from '@/scripts/api'
|
||||||
import { app } from '@/scripts/app'
|
import { app } from '@/scripts/app'
|
||||||
import { blankGraph, defaultGraph } from '@/scripts/defaultGraph'
|
import { blankGraph, defaultGraph } from '@/scripts/defaultGraph'
|
||||||
import { downloadBlob } from '@/scripts/utils'
|
import { downloadBlob } from '@/scripts/utils'
|
||||||
@@ -121,6 +122,18 @@ export const useWorkflowService = () => {
|
|||||||
await app.loadGraphData(defaultGraph)
|
await app.loadGraphData(defaultGraph)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the tutorial workflow
|
||||||
|
*/
|
||||||
|
const loadTutorialWorkflow = async () => {
|
||||||
|
const tutorialWorkflow = await fetch(
|
||||||
|
api.fileURL('/templates/default.json')
|
||||||
|
).then((r) => r.json())
|
||||||
|
await app.loadGraphData(tutorialWorkflow, false, false, 'tutorial', {
|
||||||
|
showMissingModelsDialog: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a blank workflow
|
* Load a blank workflow
|
||||||
*/
|
*/
|
||||||
@@ -366,6 +379,7 @@ export const useWorkflowService = () => {
|
|||||||
saveWorkflow,
|
saveWorkflow,
|
||||||
loadDefaultWorkflow,
|
loadDefaultWorkflow,
|
||||||
loadBlankWorkflow,
|
loadBlankWorkflow,
|
||||||
|
loadTutorialWorkflow,
|
||||||
reloadCurrentWorkflow,
|
reloadCurrentWorkflow,
|
||||||
openWorkflow,
|
openWorkflow,
|
||||||
closeWorkflow,
|
closeWorkflow,
|
||||||
|
|||||||
Reference in New Issue
Block a user