Skip to content

Commit

Permalink
Update PR content
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Jan 25, 2025
1 parent f580bc9 commit d3498bf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/constants/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ export const CORE_SETTINGS: SettingParams[] = [
id: 'Comfy.TutorialCompleted',
name: 'Tutorial completed',
type: 'hidden',
defaultValue: true,
versionAdded: '1.8.5'
defaultValue: false,
versionAdded: '1.8.7'
}
]
7 changes: 6 additions & 1 deletion src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,13 @@ export class ComfyApp {
// We failed to restore a workflow so load the default
if (!restored) {
const settingStore = useSettingStore()
if (settingStore.get('Comfy.TutorialCompleted') === false) {

// 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()
Expand Down
14 changes: 4 additions & 10 deletions src/services/workflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { LGraphCanvas } from '@comfyorg/litegraph'
import { toRaw } from 'vue'

import { t } from '@/i18n'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import { blankGraph, defaultGraph } from '@/scripts/defaultGraph'
import { downloadBlob } from '@/scripts/utils'
Expand Down Expand Up @@ -125,16 +126,9 @@ export const useWorkflowService = () => {
* Load the tutorial workflow
*/
const loadTutorialWorkflow = async () => {
const tutorialWorkflow = {
...defaultGraph,
models: [
{
name: 'v1-5-pruned-emaonly.safetensors',
url: 'https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly.safetensors?download=true',
directory: 'checkpoints'
}
]
}
const tutorialWorkflow = await fetch(
api.fileURL('/templates/default.json')
).then((r) => r.json())
await app.loadGraphData(tutorialWorkflow, false, false, 'tutorial', {
showMissingModelsDialog: true
})
Expand Down
3 changes: 0 additions & 3 deletions src/stores/modelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export const useModelStore = defineStore('models', () => {
const models = computed<ComfyModelDef[]>(() =>
modelFolders.value.flatMap((folder) => Object.values(folder.models))
)
const isLoaded = ref(false)

/**
* Loads the model folders from the server
Expand All @@ -204,13 +203,11 @@ export const useModelStore = defineStore('models', () => {
for (const folderName of modelFolderNames.value) {
modelFolderByName.value[folderName] = new ModelFolder(folderName)
}
isLoaded.value = true
}

async function getLoadedModelFolder(
folderName: string
): Promise<ModelFolder | null> {
if (!isLoaded.value) await loadModelFolders()
const folder = modelFolderByName.value[folderName]
return folder ? await folder.load() : null
}
Expand Down

0 comments on commit d3498bf

Please sign in to comment.