Tweak logging. Add new setting dialog.
This commit is contained in:
+9
-6
@@ -1,4 +1,13 @@
|
||||
import os
|
||||
import logging
|
||||
|
||||
# Uncomment the next line to enable debug logging
|
||||
# logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
# Set to 1 for v1 nodes, 3 for v3 nodes.
|
||||
# Right now, v3 nodes aren't ready for use.
|
||||
CURRENT_NODE_VERSION = '1'
|
||||
NODE_VERSION = os.environ.get('SAGEUTILS_NODE_VERSION', CURRENT_NODE_VERSION)
|
||||
|
||||
SAGEUTILS_PRINT_TIMING = False # Set to True to enable timing report
|
||||
# Print timing report if enabled via environment variable
|
||||
@@ -9,11 +18,6 @@ if os.environ.get('SAGEUTILS_PRINT_TIMING', '').lower() in ('1', 'true', 'yes'):
|
||||
from .utils.performance_timer import python_timer, log_init
|
||||
log_init("IMPORTS_START")
|
||||
|
||||
# Set to 1 for v1 nodes, 3 for v3 nodes.
|
||||
# Right now, v3 nodes aren't ready for use.
|
||||
CURRENT_NODE_VERSION = '1'
|
||||
NODE_VERSION = os.environ.get('SAGEUTILS_NODE_VERSION', CURRENT_NODE_VERSION)
|
||||
|
||||
# Import all node classes
|
||||
if NODE_VERSION == '1':
|
||||
from .nodes_v1 import *
|
||||
@@ -103,7 +107,6 @@ try:
|
||||
from .utils.performance_fix import populate_llm_cache_async
|
||||
populate_llm_cache_async()
|
||||
except Exception as e:
|
||||
import logging
|
||||
logging.warning(f"Warning: Failed to start background LLM cache population: {e}")
|
||||
|
||||
# Print timing report if enabled.
|
||||
|
||||
@@ -56,6 +56,7 @@ function createTabHeader() {
|
||||
background: #1a1a1a;
|
||||
overflow-x: auto;
|
||||
min-height: 50px;
|
||||
position: relative;
|
||||
`;
|
||||
|
||||
const modelsTab = createTabButton('Models', true);
|
||||
@@ -80,6 +81,53 @@ function createTabHeader() {
|
||||
tabHeader.appendChild(promptBuilderTab);
|
||||
tabHeader.appendChild(llmTab);
|
||||
|
||||
// Create settings gear button
|
||||
const settingsButton = document.createElement('button');
|
||||
settingsButton.innerHTML = '⚙️';
|
||||
settingsButton.title = 'Settings';
|
||||
settingsButton.className = 'sidebar-settings-button';
|
||||
settingsButton.style.cssText = `
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: #2a2a2a;
|
||||
border: 1px solid #444;
|
||||
border-radius: 4px;
|
||||
color: #ccc;
|
||||
padding: 6px 10px;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
transition: all 0.2s ease;
|
||||
z-index: 10;
|
||||
`;
|
||||
|
||||
// Hover effect
|
||||
settingsButton.addEventListener('mouseenter', () => {
|
||||
settingsButton.style.background = '#4CAF50';
|
||||
settingsButton.style.borderColor = '#4CAF50';
|
||||
settingsButton.style.transform = 'translateY(-50%) scale(1.1)';
|
||||
});
|
||||
|
||||
settingsButton.addEventListener('mouseleave', () => {
|
||||
settingsButton.style.background = '#2a2a2a';
|
||||
settingsButton.style.borderColor = '#444';
|
||||
settingsButton.style.transform = 'translateY(-50%) scale(1)';
|
||||
});
|
||||
|
||||
// Click handler - will be set up after import
|
||||
settingsButton.addEventListener('click', async () => {
|
||||
try {
|
||||
const { showSettingsDialog } = await import('../dialogs/settingsDialog.js');
|
||||
showSettingsDialog();
|
||||
} catch (error) {
|
||||
console.error('Failed to open settings dialog:', error);
|
||||
handleError(error, 'Settings Dialog Error');
|
||||
}
|
||||
});
|
||||
|
||||
tabHeader.appendChild(settingsButton);
|
||||
|
||||
return {
|
||||
tabHeader,
|
||||
modelsTab,
|
||||
@@ -87,7 +135,8 @@ function createTabHeader() {
|
||||
civitaiTab,
|
||||
galleryTab,
|
||||
promptBuilderTab,
|
||||
llmTab
|
||||
llmTab,
|
||||
settingsButton
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ class Sage_UNETLoaderFromInfo(ComfyNodeABC):
|
||||
|
||||
def load_unet(self, unet_info):
|
||||
"""Load UNET from model info."""
|
||||
logging.info("Loading UNET...")
|
||||
#logging.info("Loading UNET...")
|
||||
graph = GraphBuilder()
|
||||
unet_node = add_unet_node_from_info(graph, unet_info)
|
||||
if unet_node is None:
|
||||
@@ -87,7 +87,7 @@ class Sage_CLIPLoaderFromInfo(ComfyNodeABC):
|
||||
|
||||
def load_clip(self, clip_info):
|
||||
"""Load CLIP from model info."""
|
||||
logging.info("Loading CLIP...")
|
||||
#logging.info("Loading CLIP...")
|
||||
graph = GraphBuilder()
|
||||
clip_node = add_clip_node_from_info(graph, clip_info)
|
||||
if clip_node is None:
|
||||
@@ -127,7 +127,7 @@ class Sage_ChromaCLIPLoaderFromInfo(ComfyNodeABC):
|
||||
|
||||
def load_clip(self, clip_info):
|
||||
"""Load Chroma CLIP from model info."""
|
||||
logging.info("Loading CLIP...")
|
||||
#logging.info("Loading CLIP...")
|
||||
graph = GraphBuilder()
|
||||
clip_node = add_clip_node_from_info(graph, clip_info)
|
||||
if clip_node is None:
|
||||
@@ -166,7 +166,7 @@ class Sage_VAELoaderFromInfo(ComfyNodeABC):
|
||||
|
||||
def load_vae(self, vae_info):
|
||||
"""Load VAE from model info."""
|
||||
logging.info("Loading VAE...")
|
||||
#logging.info("Loading VAE...")
|
||||
graph = GraphBuilder()
|
||||
vae_node = add_vae_node_from_info(graph, vae_info)
|
||||
if vae_node is None:
|
||||
|
||||
+1
-2
@@ -62,8 +62,7 @@ def register_routes(routes_instance):
|
||||
if hasattr(route_module, 'register_routes'):
|
||||
group_count = route_module.register_routes(routes_instance)
|
||||
route_count += group_count
|
||||
logging.info(f"{group_name} routes registered successfully")
|
||||
logging.info(f"Registered {group_count} {group_name} routes")
|
||||
logging.debug(f"Registered {group_count} {group_name} routes successfully")
|
||||
_registered_routes.extend(route_module.get_route_list() if hasattr(route_module, 'get_route_list') else [])
|
||||
else:
|
||||
logging.warning(f"Route module {group_name} missing register_routes function")
|
||||
|
||||
@@ -126,7 +126,7 @@ class SageFileManager:
|
||||
data = self.load_json_file(path, f"{config_name} config")
|
||||
if data is not None:
|
||||
configs.append(data)
|
||||
print(f"Loading {config_name} from {path}")
|
||||
#print(f"Loading {config_name} from {path}")
|
||||
|
||||
if not configs:
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user