fix: 🐛 debug issues
also properly print to console now...
This commit is contained in:
+5
-2
@@ -47,6 +47,8 @@ def process_list(anything):
|
||||
text.append(
|
||||
f"List of Tensors: {first_element.shape} (x{len(anything)})"
|
||||
)
|
||||
else:
|
||||
text.append(f"Array: {anything}")
|
||||
|
||||
return {"text": text}
|
||||
|
||||
@@ -90,7 +92,7 @@ class MTB_Debug:
|
||||
CATEGORY = "mtb/debug"
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def do_debug(self, output_to_console, **kwargs):
|
||||
def do_debug(self, output_to_console: bool, **kwargs):
|
||||
output = {
|
||||
"ui": {"b64_images": [], "text": []},
|
||||
# "result": ("A"),
|
||||
@@ -103,7 +105,8 @@ class MTB_Debug:
|
||||
bool: process_bool,
|
||||
}
|
||||
if output_to_console:
|
||||
print("bouh!")
|
||||
for k, v in kwargs.items():
|
||||
print(f"{k}: {v}")
|
||||
|
||||
for anything in kwargs.values():
|
||||
processor = processors.get(type(anything), process_text)
|
||||
|
||||
+7
-5
@@ -45,16 +45,18 @@ export class LocalStorageManager {
|
||||
}
|
||||
|
||||
clear() {
|
||||
Object.keys(localStorage)
|
||||
.filter((k) => k.startsWith(this.namespace + ':'))
|
||||
.forEach((k) => localStorage.removeItem(k))
|
||||
for (const key of Object.keys(localStorage).filter((k) =>
|
||||
k.startsWith(`${this.namespace}:`),
|
||||
)) {
|
||||
localStorage.removeItem(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - log utilities
|
||||
|
||||
function createLogger(emoji, color, consoleMethod = 'log') {
|
||||
return function (message, ...args) {
|
||||
return (message, ...args) => {
|
||||
if (window.MTB?.DEBUG) {
|
||||
console[consoleMethod](
|
||||
`%c${emoji} ${message}`,
|
||||
@@ -147,7 +149,7 @@ export function getWidgetType(config) {
|
||||
// Special handling for COMBO so we restrict links based on the entries
|
||||
let type = config?.[0]
|
||||
let linkType = type
|
||||
if (type instanceof Array) {
|
||||
if (Array.isArray(type)) {
|
||||
type = 'COMBO'
|
||||
linkType = linkType.join(',')
|
||||
}
|
||||
|
||||
+1
-2
@@ -52,7 +52,7 @@ app.registerExtension({
|
||||
//- infer type
|
||||
if (link_info) {
|
||||
const fromNode = this.graph._nodes.find(
|
||||
(otherNode) => otherNode.id == link_info.origin_id,
|
||||
(otherNode) => otherNode.id === link_info.origin_id,
|
||||
)
|
||||
const type = fromNode.outputs[link_info.origin_slot].type
|
||||
this.inputs[index].type = type
|
||||
@@ -83,7 +83,6 @@ app.registerExtension({
|
||||
this.widgets.length = 1
|
||||
}
|
||||
let widgetI = 1
|
||||
|
||||
if (message.text) {
|
||||
for (const txt of message.text) {
|
||||
const w = this.addCustomWidget(
|
||||
|
||||
Reference in New Issue
Block a user