remove debug logging, rename trigger types
This commit is contained in:
+7
-16
@@ -10,7 +10,7 @@ from aiohttp import web
|
||||
|
||||
@dataclass
|
||||
class TriggerCondition:
|
||||
type: str # "node_selected", "node_attribute", "workflow_name"
|
||||
type: str # "node_selected", "node_selected_attribute", "node_in_workflow", "node_in_workflow_attribute", "workflow_name"
|
||||
node_types: Optional[List[str]] = None
|
||||
node_type: Optional[str] = None
|
||||
attribute_name: Optional[str] = None
|
||||
@@ -50,11 +50,6 @@ class AutoNotesManager:
|
||||
self.notes_file = os.path.join(self.data_dir, "notes.json")
|
||||
self.folders_file = os.path.join(self.data_dir, "folders.json")
|
||||
|
||||
# Debug output
|
||||
print(f"AutoNotes: Initializing for user '{user}'")
|
||||
print(f"AutoNotes: user_dir = {self.user_dir}")
|
||||
print(f"AutoNotes: data_dir = {self.data_dir}")
|
||||
|
||||
# Ensure data directory exists
|
||||
os.makedirs(self.data_dir, exist_ok=True)
|
||||
|
||||
@@ -79,7 +74,7 @@ class AutoNotesManager:
|
||||
notes[note.uuid] = note
|
||||
return notes
|
||||
except Exception as e:
|
||||
print(f"Error loading notes: {e}")
|
||||
print(f"AutoNotes: Error loading notes: {e}")
|
||||
return {}
|
||||
|
||||
def _load_folders(self) -> Dict[str, Folder]:
|
||||
@@ -93,7 +88,7 @@ class AutoNotesManager:
|
||||
folders[folder.uuid] = folder
|
||||
return folders
|
||||
except Exception as e:
|
||||
print(f"Error loading folders: {e}")
|
||||
print(f"AutoNotes: Error loading folders: {e}")
|
||||
return {}
|
||||
|
||||
def _save_notes(self):
|
||||
@@ -108,7 +103,7 @@ class AutoNotesManager:
|
||||
with open(self.notes_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, indent=2, ensure_ascii=False)
|
||||
except Exception as e:
|
||||
print(f"Error saving notes: {e}")
|
||||
print(f"AutoNotes: Error saving notes: {e}")
|
||||
|
||||
def _save_folders(self):
|
||||
try:
|
||||
@@ -116,7 +111,7 @@ class AutoNotesManager:
|
||||
with open(self.folders_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, indent=2, ensure_ascii=False)
|
||||
except Exception as e:
|
||||
print(f"Error saving folders: {e}")
|
||||
print(f"AutoNotes: Error saving folders: {e}")
|
||||
|
||||
def create_note(self, name: str, folder_uuid: Optional[str] = None) -> str:
|
||||
note_uuid = str(uuid.uuid4())
|
||||
@@ -196,7 +191,7 @@ class AutoNotesManager:
|
||||
condition.node_types is not None and
|
||||
selected_node_type in condition.node_types)
|
||||
|
||||
elif condition.type == "node_attribute":
|
||||
elif condition.type == "node_selected_attribute":
|
||||
if (selected_node_type == condition.node_type and
|
||||
selected_node_attributes is not None and
|
||||
condition.attribute_name in selected_node_attributes and
|
||||
@@ -210,7 +205,7 @@ class AutoNotesManager:
|
||||
# Check if any of the specified node types exist in the workflow
|
||||
return any(node_type in workflow_nodes for node_type in condition.node_types)
|
||||
|
||||
elif condition.type == "attribute_in_workflow":
|
||||
elif condition.type == "node_in_workflow_attribute":
|
||||
if (workflow_nodes is not None and
|
||||
condition.node_type is not None and
|
||||
condition.attribute_name is not None):
|
||||
@@ -241,13 +236,9 @@ def get_user_from_request(request) -> str:
|
||||
user = "default"
|
||||
if "comfy-user" in request.headers:
|
||||
user = request.headers["comfy-user"]
|
||||
print(f"AutoNotes: Found comfy-user header: '{user}'")
|
||||
else:
|
||||
print(f"AutoNotes: No comfy-user header found, using default: '{user}'")
|
||||
|
||||
# If user is empty or None, use "default"
|
||||
if not user:
|
||||
print(f"AutoNotes: User was empty, forcing to 'default'")
|
||||
user = "default"
|
||||
|
||||
return user
|
||||
|
||||
+14
-14
@@ -1495,9 +1495,9 @@ class AutoNotesManager {
|
||||
`;
|
||||
triggerTypeSelect.innerHTML = `
|
||||
<option value="node_selected">Node Selected - Shows when this node type is selected</option>
|
||||
<option value="node_attribute">Node Attribute - Shows when this node has specific attribute value</option>
|
||||
<option value="node_in_workflow">Node in Workflow - Shows when this node exists in workflow</option>
|
||||
<option value="attribute_in_workflow">Attribute in Workflow - Shows when this node has an attribute in workflow</option>
|
||||
<option value="node_selected_attribute">Node Selected + Attribute Value - Shows when this node has specific attribute value</option>
|
||||
<option value="node_in_workflow">Node In Workflow - Shows when this node exists in workflow</option>
|
||||
<option value="node_in_workflow_attribute">Node In Workflow + Attribute Value - Shows when this node has an attribute in workflow</option>
|
||||
`;
|
||||
|
||||
// Dynamic fields container
|
||||
@@ -1533,7 +1533,7 @@ class AutoNotesManager {
|
||||
info.textContent = `This note will appear when "${this.nodeTypes[this.selectedNodeType]?.display_name || this.selectedNodeType}" is selected.`;
|
||||
dynamicFieldsContainer.appendChild(info);
|
||||
|
||||
} else if (triggerCondition.type === 'node_attribute') {
|
||||
} else if (triggerCondition.type === 'node_selected_attribute') {
|
||||
// Attribute selector
|
||||
const attrLabel = document.createElement('label');
|
||||
attrLabel.textContent = 'Attribute:';
|
||||
@@ -1631,7 +1631,7 @@ class AutoNotesManager {
|
||||
info.textContent = `This note will appear when "${this.nodeTypes[this.selectedNodeType]?.display_name || this.selectedNodeType}" exists anywhere in the workflow.`;
|
||||
dynamicFieldsContainer.appendChild(info);
|
||||
|
||||
} else if (triggerCondition.type === 'attribute_in_workflow') {
|
||||
} else if (triggerCondition.type === 'node_in_workflow_attribute') {
|
||||
// Attribute selector
|
||||
const attrLabel = document.createElement('label');
|
||||
attrLabel.textContent = 'Attribute:';
|
||||
@@ -1844,7 +1844,7 @@ class AutoNotesManager {
|
||||
}
|
||||
|
||||
// Validate trigger condition
|
||||
if (triggerCondition.type === 'node_attribute' || triggerCondition.type === 'attribute_in_workflow') {
|
||||
if (triggerCondition.type === 'node_selected_attribute' || triggerCondition.type === 'node_in_workflow_attribute') {
|
||||
if (!triggerCondition.attribute_name) {
|
||||
alert('Please select an attribute');
|
||||
return;
|
||||
@@ -2801,9 +2801,9 @@ class AutoNotesManager {
|
||||
titleSpan.style.flex = '1';
|
||||
const getConditionTitle = () => {
|
||||
if (condition.type === 'node_selected') return 'Node Selected';
|
||||
if (condition.type === 'node_attribute') return 'Node Attribute';
|
||||
if (condition.type === 'node_in_workflow') return 'Node in Workflow';
|
||||
if (condition.type === 'attribute_in_workflow') return 'Attribute in Workflow';
|
||||
if (condition.type === 'node_selected_attribute') return 'Node Selected + Attribute Value';
|
||||
if (condition.type === 'node_in_workflow') return 'Node In Workflow';
|
||||
if (condition.type === 'node_in_workflow_attribute') return 'Node In Workflow + Attribute Value';
|
||||
if (condition.type === 'workflow_name') return 'Workflow Name';
|
||||
return 'Trigger Condition';
|
||||
};
|
||||
@@ -2841,9 +2841,9 @@ class AutoNotesManager {
|
||||
`;
|
||||
typeSelect.innerHTML = `
|
||||
<option value="node_selected">Node Selected</option>
|
||||
<option value="node_attribute">Node Attribute</option>
|
||||
<option value="node_in_workflow">Node in Workflow</option>
|
||||
<option value="attribute_in_workflow">Attribute in Workflow</option>
|
||||
<option value="node_selected_attribute">Node Selected + Attribute Value</option>
|
||||
<option value="node_in_workflow">Node In Workflow</option>
|
||||
<option value="node_in_workflow_attribute">Node In Workflow + Attribute Value</option>
|
||||
<option value="workflow_name">Workflow Name</option>
|
||||
`;
|
||||
typeSelect.value = condition.type;
|
||||
@@ -2879,11 +2879,11 @@ class AutoNotesManager {
|
||||
|
||||
if (condition.type === 'node_selected') {
|
||||
this.createNodeSelectedFields(fieldsContainer, condition);
|
||||
} else if (condition.type === 'node_attribute') {
|
||||
} else if (condition.type === 'node_selected_attribute') {
|
||||
this.createNodeAttributeFields(fieldsContainer, condition);
|
||||
} else if (condition.type === 'node_in_workflow') {
|
||||
this.createNodeInWorkflowFields(fieldsContainer, condition);
|
||||
} else if (condition.type === 'attribute_in_workflow') {
|
||||
} else if (condition.type === 'node_in_workflow_attribute') {
|
||||
this.createAttributeInWorkflowFields(fieldsContainer, condition);
|
||||
} else if (condition.type === 'workflow_name') {
|
||||
this.createWorkflowNameFields(fieldsContainer, condition);
|
||||
|
||||
Reference in New Issue
Block a user