Files
ComfyUI/custom_nodes/ComfyUI-Crystools/web/debugger.ts
jaidaken f09734b0ee
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Add custom nodes, Civitai loras (LFS), and vast.ai setup script
Includes 30 custom nodes committed directly, 7 Civitai-exclusive
loras stored via Git LFS, and a setup script that installs all
dependencies and downloads HuggingFace-hosted models on vast.ai.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:56:42 +00:00

87 lines
3.0 KiB
TypeScript

import type { ComfyNode } from './comfy/index.js';
import { app, api, ComfyWidgets, LiteGraph, TLGraphNode, ComfyApp } from './comfy/index.js';
import { commonPrefix, displayContext } from './common.js';
// "Show any" Node
app.registerExtension({
name: 'Crystools.Debugger.ConsoleAny',
beforeRegisterNodeDef(nodeType: ComfyNode, nodeData: TLGraphNode, appFromArg: ComfyApp) {
if (nodeData.name === 'Show any [Crystools]') {
// 3 is the index of the text field in the node
displayContext(nodeType, appFromArg, 3);
}
},
});
app.registerExtension({
name: 'Crystools.Debugger.Metadata',
registerCustomNodes() {
class MetadataNode extends TLGraphNode {
constructor() {
super(`${commonPrefix} Show Metadata `);
this.serialize_widgets = false;
this.isVirtualNode = true;
const widget = ComfyWidgets.STRING(this, '', [
'', {default: '', multiline: true},
], app).widget;
widget.inputEl.readOnly = true;
ComfyWidgets.BOOLEAN(this, 'Active', [
'', {default: true},
]);
ComfyWidgets.BOOLEAN(this, 'Parsed', [
'', {default: true},
]);
ComfyWidgets.COMBO(this, 'What', [
['Prompt', 'Workflow'], {default: 'Prompt'},
]);
// It runs at finish on each prompt queue
api.addEventListener('executed', this.fillMetadataWidget, false);
}
fillMetadataWidget = (): Promise<string> => {
return app.graphToPrompt()
.then((workflow: any): string => {
let result = 'inactive';
if (this.widgets?.length !== 4) {
console.error('Something is wrong with the widgets, should be 4!');
return 'error';
}
const output = this.widgets[0];
const active = this.widgets[1]?.value;
const parsed = this.widgets[2]?.value;
let what = this.widgets[3]?.value.toLowerCase();
if (active) {
what = what === 'prompt' ? 'output' : what; // little fix for better understanding
// @ts-ignore
result = workflow[what];
if (parsed) {
result = JSON.stringify(result, null, 2);
} else {
result = JSON.stringify(result);
}
}
if (output) {
output.value = result;
} else {
console.error('Something is wrong with the widgets, output is undefined!');
return 'error';
}
return result;
});
};
}
// I'm not sure for what they're using prototype and lots of black magic, don't change the order!
LiteGraph.registerNodeType('Show Metadata [Crystools]', MetadataNode);
MetadataNode.category = `crystools ${commonPrefix}/Debugger`;
MetadataNode.shape = LiteGraph.BOX_SHAPE;
MetadataNode.title = `${commonPrefix} Show Metadata`;
// MetadataNode.collapsable = false;
// MetadataNode.color = '#FF2222';
// MetadataNode.bgcolor = '#000000';
},
});