New settings API (#1292)

* Add settings API

* Add playwright test

* Update README
This commit is contained in:
Chenlei Hu
2024-10-24 16:26:01 +02:00
committed by GitHub
parent 3553c8e0d4
commit 957a767ed0
9 changed files with 109 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import { ComfyApp } from '../scripts/app'
import type { ComfyNodeDef } from '@/types/apiTypes'
import type { Keybinding } from '@/types/keyBindingTypes'
import type { ComfyCommand } from '@/stores/commandStore'
import { SettingParams } from './settingTypes'
export type Widgets = Record<
string,
@@ -43,6 +44,10 @@ export interface ComfyExtension {
* Menu commands to add to the menu bar
*/
menuCommands?: MenuCommandGroup[]
/**
* Settings to add to the settings menu
*/
settings?: SettingParams[]
/**
* Allows any initialisation, e.g. loading resources. Called after the canvas is created but before nodes are added
* @param app The ComfyUI app instance

View File

@@ -37,9 +37,12 @@ export interface ExtensionManager {
unregisterSidebarTab(id: string): void
getSidebarTabs(): SidebarTabExtension[]
// Toast
toast: ToastManager
command: CommandManager
setting: {
get: (id: string) => any
set: (id: string, value: any) => void
}
}
export interface CommandManager {