-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Set up. * Add yaml. * App local directory. * v0.1.26 * Remove model config files. * Notify when first time setup is complete. * Format.
- Loading branch information
1 parent
88b68ad
commit 9461e51
Showing
14 changed files
with
431 additions
and
183 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"productName": "ComfyUI", | ||
"repository": "github:comfy-org/electron", | ||
"copyright": "Copyright © 2024 Comfy Org", | ||
"version": "0.1.25", | ||
"version": "0.1.26", | ||
"description": "The best modular GUI to run AI diffusion models.", | ||
"main": ".vite/build/main.js", | ||
"packageManager": "[email protected]", | ||
|
@@ -87,6 +87,7 @@ | |
"react-dom": "^18.3.1", | ||
"systeminformation": "^5.23.5", | ||
"tar": "^7.4.3", | ||
"update-electron-app": "^3.0.0" | ||
"update-electron-app": "^3.0.0", | ||
"yaml": "^2.6.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import * as fsPromises from 'node:fs/promises'; | ||
import path from 'path'; | ||
import log from 'electron-log/main'; | ||
import { stringify } from 'yaml'; | ||
|
||
interface ModelPaths { | ||
comfyui: { | ||
base_path: string; | ||
is_default: boolean; | ||
[key: string]: string | boolean; | ||
}; | ||
} | ||
|
||
const commonPaths = { | ||
is_default: true, | ||
checkpoints: 'models/checkpoints/', | ||
classifiers: 'models/classifiers/', | ||
clip: 'models/clip/', | ||
clip_vision: 'models/clip_vision/', | ||
configs: 'models/configs/', | ||
controlnet: 'models/controlnet/', | ||
diffusers: 'models/diffusers/', | ||
diffusion_models: 'models/diffusion_models/', | ||
embeddings: 'models/embeddings/', | ||
gligen: 'models/gligen/', | ||
hypernetworks: 'models/hypernetworks/', | ||
loras: 'models/loras/', | ||
photomaker: 'models/photomaker/', | ||
style_models: 'models/style_models/', | ||
unet: 'models/unet/', | ||
upscale_models: 'models/upscale_models/', | ||
vae: 'models/vae/', | ||
vae_approx: 'models/vae_approx/', | ||
custom_nodes: 'custom_nodes/', | ||
}; | ||
|
||
const configTemplates: Record<string, ModelPaths> = { | ||
win32: { | ||
comfyui: { | ||
base_path: '%USERPROFILE%/comfyui-electron', | ||
...commonPaths, | ||
}, | ||
}, | ||
darwin: { | ||
comfyui: { | ||
base_path: '~/Library/Application Support/ComfyUI', | ||
...commonPaths, | ||
}, | ||
}, | ||
linux: { | ||
comfyui: { | ||
base_path: '~/.config/ComfyUI', | ||
...commonPaths, | ||
}, | ||
}, | ||
}; | ||
|
||
export async function createModelConfigFiles(extraModelConfigPath: string, customBasePath?: string): Promise<boolean> { | ||
log.info(`Creating model config files in ${extraModelConfigPath} with base path ${customBasePath}`); | ||
try { | ||
for (const [platform, config] of Object.entries(configTemplates)) { | ||
if (platform !== process.platform) { | ||
continue; | ||
} | ||
|
||
log.info(`Creating model config files for ${platform}`); | ||
|
||
// If a custom base path is provided, use it | ||
if (customBasePath) { | ||
config.comfyui.base_path = customBasePath; | ||
} | ||
|
||
const yamlContent = stringify(config, { lineWidth: -1 }); | ||
|
||
// Add a comment at the top of the file | ||
const fileContent = `# ComfyUI extra_model_paths.yaml for ${platform}\n${yamlContent}`; | ||
await fsPromises.writeFile(extraModelConfigPath, fileContent, 'utf8'); | ||
log.info(`Created extra_model_paths.yaml at ${extraModelConfigPath}`); | ||
return true; | ||
} | ||
log.info(`No model config files created for platform ${process.platform}`); | ||
return false; | ||
} catch (error) { | ||
log.error('Error creating model config files:', error); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.