Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:AUTOMATIC1111 Stable diffusion webui Config States

From Leeroopedia
Revision as of 14:02, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/AUTOMATIC1111_Stable_diffusion_webui_Config_States.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Configuration, Version_Control
Last Updated 2025-05-15 00:00 GMT

Overview

Supports saving and restoring the WebUI and its extensions to a known working set of git commits, enabling reproducible environment snapshots.

Description

The Config States module provides a mechanism to snapshot the current state of the WebUI repository and all installed extensions, storing the git commit hashes, branch names, remote URLs, and commit dates into JSON configuration files. These snapshots can later be listed and used to restore the entire environment to a previous known-good state. The list_config_states function scans the config states directory for saved snapshots and returns them sorted by creation time. get_config captures the current state by reading git information from both the main WebUI repository and each extension. The restoration functions (restore_webui_config and restore_extension_config) perform git fetch --all and git reset --hard to roll back to the saved commits, and update the extension enabled/disabled status accordingly.

Usage

Use this module when you need to create a reproducible snapshot of the entire WebUI environment before making changes, or when you need to restore a previously saved configuration after an update breaks functionality.

Code Reference

Source Location

Signature

def list_config_states() -> dict
def get_webui_config() -> dict
def get_extension_config() -> dict
def get_config() -> dict
def restore_webui_config(config: dict) -> None
def restore_extension_config(config: dict) -> None

Import

from modules import config_states

I/O Contract

Inputs

Name Type Required Description
config dict Yes A previously saved configuration state dictionary containing "webui" and "extensions" keys (used by restore functions)

Outputs

Name Type Description
config_states dict A dictionary mapping display names (e.g., "Config: 2024-01-15 12:00:00") to their full state dictionaries
config dict A dictionary containing "created_at", "webui", and "extensions" snapshot data

Usage Examples

from modules import config_states

# Save the current state
current_config = config_states.get_config()

# List all saved configuration states
all_states = config_states.list_config_states()
for name, state in all_states.items():
    print(f"Snapshot: {name}")

# Restore a previously saved state
config_states.restore_webui_config(current_config)
config_states.restore_extension_config(current_config)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment