bizydraft 0.2.49__py3-none-any.whl → 0.2.87__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bizydraft might be problematic. Click here for more details.
- bizydraft/env.py +3 -0
- bizydraft/hijack_nodes.py +60 -42
- bizydraft/hijack_routes.py +36 -3
- bizydraft/oss_utils.py +231 -2
- bizydraft/patch_handlers.py +197 -8
- bizydraft/static/js/aiAppHandler.js +460 -425
- bizydraft/static/js/clipspaceToOss.js +386 -0
- bizydraft/static/js/disableComfyWebSocket.js +64 -0
- bizydraft/static/js/freezeModeHandler.js +425 -404
- bizydraft/static/js/handleStyle.js +128 -36
- bizydraft/static/js/hookLoad/configLoader.js +74 -0
- bizydraft/static/js/hookLoad/media.js +684 -0
- bizydraft/static/js/hookLoad/model.js +322 -0
- bizydraft/static/js/hookLoadMedia.js +196 -0
- bizydraft/static/js/hookLoadModel.js +207 -256
- bizydraft/static/js/main.js +2 -0
- bizydraft/static/js/nodeFocusHandler.js +118 -106
- bizydraft/static/js/nodeParamsFilter.js +91 -89
- bizydraft/static/js/postEvent.js +1207 -967
- bizydraft/static/js/socket.js +55 -50
- bizydraft/static/js/tool.js +71 -63
- bizydraft/static/js/uploadFile.js +49 -41
- bizydraft/static/js/workflow_io.js +193 -0
- {bizydraft-0.2.49.dist-info → bizydraft-0.2.87.dist-info}/METADATA +1 -1
- bizydraft-0.2.87.dist-info/RECORD +34 -0
- bizydraft/static/js/hookLoadImage.js +0 -177
- bizydraft-0.2.49.dist-info/RECORD +0 -28
- {bizydraft-0.2.49.dist-info → bizydraft-0.2.87.dist-info}/WHEEL +0 -0
- {bizydraft-0.2.49.dist-info → bizydraft-0.2.87.dist-info}/top_level.txt +0 -0
|
@@ -7,147 +7,159 @@ let keyboardListener = null;
|
|
|
7
7
|
let contextMenuListener = null;
|
|
8
8
|
|
|
9
9
|
// 设置全局变量引用
|
|
10
|
-
export function setGlobalReferences(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export function setGlobalReferences(
|
|
11
|
+
overlay,
|
|
12
|
+
eventBlocked,
|
|
13
|
+
kListener,
|
|
14
|
+
cListener
|
|
15
|
+
) {
|
|
16
|
+
freezeOverlay = overlay;
|
|
17
|
+
globalEventBlocked = eventBlocked;
|
|
18
|
+
keyboardListener = kListener;
|
|
19
|
+
contextMenuListener = cListener;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
// 只聚焦节点,不高亮
|
|
18
23
|
export function focusNodeOnly(nodeId) {
|
|
19
|
-
|
|
24
|
+
console.log("[nodeFocusHandler] focusNodeOnly called with nodeId:", nodeId);
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
if (!app || !app.graph) {
|
|
27
|
+
console.error("[nodeFocusHandler] app or app.graph not available");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
const node = app.graph.getNodeById(parseInt(nodeId, 10));
|
|
32
|
+
if (!node) {
|
|
33
|
+
console.error("[nodeFocusHandler] 找不到节点:", nodeId);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
console.log("[nodeFocusHandler] 找到节点:", node);
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
// 临时禁用冻结模式
|
|
40
|
+
const wasFreezed = !!freezeOverlay;
|
|
41
|
+
let originalOverlayDisplay = null;
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// 临时解除事件阻止
|
|
43
|
-
if (globalEventBlocked) {
|
|
44
|
-
document.removeEventListener('keydown', keyboardListener, true);
|
|
45
|
-
document.removeEventListener('contextmenu', contextMenuListener, true);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
43
|
+
if (wasFreezed && freezeOverlay) {
|
|
44
|
+
originalOverlayDisplay = freezeOverlay.style.display;
|
|
45
|
+
freezeOverlay.style.display = "none";
|
|
48
46
|
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
// 临时解除事件阻止
|
|
48
|
+
if (globalEventBlocked) {
|
|
49
|
+
document.removeEventListener("keydown", keyboardListener, true);
|
|
50
|
+
document.removeEventListener("contextmenu", contextMenuListener, true);
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// 只设置节点的 selected 属性,不改变颜色
|
|
55
|
+
for (const n of app.graph._nodes) {
|
|
56
|
+
n.selected = n.id === node.id;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 设置 selected_nodes
|
|
60
|
+
if (app.canvas) {
|
|
61
|
+
app.canvas.selected_nodes = [node];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 聚焦到节点 - 使用与selectNodeAndFocus相同的方法
|
|
65
|
+
if (app.canvas && typeof app.canvas.centerOnNode === "function") {
|
|
66
|
+
console.log("[nodeFocusHandler] 使用 centerOnNode 方法聚焦节点");
|
|
67
|
+
app.canvas.centerOnNode(node);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 刷新画布
|
|
71
|
+
if (app.canvas) {
|
|
72
|
+
app.canvas.setDirty(true, true);
|
|
73
|
+
if (typeof app.canvas.draw === "function") {
|
|
74
|
+
app.canvas.draw(true, true);
|
|
57
75
|
}
|
|
76
|
+
}
|
|
58
77
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
// 恢复冻结模式
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
if (wasFreezed && freezeOverlay) {
|
|
81
|
+
freezeOverlay.style.display = originalOverlayDisplay;
|
|
82
|
+
|
|
83
|
+
// 恢复事件阻止
|
|
84
|
+
if (globalEventBlocked) {
|
|
85
|
+
document.addEventListener("keydown", keyboardListener, true);
|
|
86
|
+
document.addEventListener("contextmenu", contextMenuListener, true);
|
|
87
|
+
}
|
|
63
88
|
}
|
|
64
89
|
|
|
65
|
-
//
|
|
90
|
+
// 再次刷新画布
|
|
66
91
|
if (app.canvas) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
92
|
+
app.canvas.setDirty(true, true);
|
|
93
|
+
if (typeof app.canvas.draw === "function") {
|
|
94
|
+
app.canvas.draw(true, true);
|
|
95
|
+
}
|
|
71
96
|
}
|
|
97
|
+
}, 100);
|
|
72
98
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (wasFreezed && freezeOverlay) {
|
|
76
|
-
freezeOverlay.style.display = originalOverlayDisplay;
|
|
77
|
-
|
|
78
|
-
// 恢复事件阻止
|
|
79
|
-
if (globalEventBlocked) {
|
|
80
|
-
document.addEventListener('keydown', keyboardListener, true);
|
|
81
|
-
document.addEventListener('contextmenu', contextMenuListener, true);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// 再次刷新画布
|
|
86
|
-
if (app.canvas) {
|
|
87
|
-
app.canvas.setDirty(true, true);
|
|
88
|
-
if (typeof app.canvas.draw === 'function') {
|
|
89
|
-
app.canvas.draw(true, true);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, 100);
|
|
93
|
-
|
|
94
|
-
console.log('[nodeFocusHandler] focusNodeOnly 完成');
|
|
95
|
-
return true;
|
|
99
|
+
console.log("[nodeFocusHandler] focusNodeOnly 完成");
|
|
100
|
+
return true;
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
// 处理画布节点点击事件
|
|
99
104
|
export function handleCanvasNodeClick(e) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
if (!app || !app.graph) return;
|
|
106
|
+
|
|
107
|
+
// 获取点击的节点
|
|
108
|
+
const nodeUnderMouse = getNodeUnderMouse(e);
|
|
109
|
+
if (!nodeUnderMouse) return;
|
|
110
|
+
|
|
111
|
+
console.log(
|
|
112
|
+
"[nodeFocusHandler] 画布点击节点:",
|
|
113
|
+
nodeUnderMouse.id,
|
|
114
|
+
nodeUnderMouse.title
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
// 发送消息到前端,通知节点被点击
|
|
118
|
+
window.parent.postMessage(
|
|
119
|
+
{
|
|
120
|
+
type: "CANVAS_NODE_CLICKED",
|
|
121
|
+
nodeId: nodeUnderMouse.id,
|
|
122
|
+
nodeTitle: nodeUnderMouse.title,
|
|
123
|
+
nodeType: nodeUnderMouse.type,
|
|
124
|
+
},
|
|
125
|
+
"*"
|
|
126
|
+
);
|
|
115
127
|
}
|
|
116
128
|
|
|
117
129
|
// 获取鼠标下方的节点
|
|
118
130
|
function getNodeUnderMouse(e) {
|
|
119
|
-
|
|
131
|
+
if (!app || !app.graph) return null;
|
|
120
132
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
// 获取画布位置
|
|
134
|
+
const canvas = document.querySelector("canvas");
|
|
135
|
+
if (!canvas) return null;
|
|
124
136
|
|
|
125
|
-
|
|
126
|
-
|
|
137
|
+
// 转换为图形坐标
|
|
138
|
+
const pos = app.canvas.convertEventToCanvasOffset(e);
|
|
127
139
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
// 检查点击位置是否在某个节点上
|
|
141
|
+
const node = app.graph.getNodeOnPos(pos[0], pos[1]);
|
|
142
|
+
return node;
|
|
131
143
|
}
|
|
132
144
|
|
|
133
145
|
// 设置画布点击事件监听
|
|
134
146
|
export function setupCanvasClickHandler() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
// 移除现有的事件监听器
|
|
148
|
+
removeCanvasClickHandler();
|
|
149
|
+
|
|
150
|
+
// 添加画布点击事件监听
|
|
151
|
+
const canvas = document.querySelector("canvas");
|
|
152
|
+
if (canvas) {
|
|
153
|
+
canvas.addEventListener("click", handleCanvasNodeClick);
|
|
154
|
+
console.log("[nodeFocusHandler] 画布点击事件监听器已设置");
|
|
155
|
+
}
|
|
144
156
|
}
|
|
145
157
|
|
|
146
158
|
// 移除画布点击事件监听
|
|
147
159
|
export function removeCanvasClickHandler() {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
160
|
+
const canvas = document.querySelector("canvas");
|
|
161
|
+
if (canvas) {
|
|
162
|
+
canvas.removeEventListener("click", handleCanvasNodeClick);
|
|
163
|
+
console.log("[nodeFocusHandler] 画布点击事件监听器已移除");
|
|
164
|
+
}
|
|
153
165
|
}
|
|
@@ -11,29 +11,29 @@ let nodeParamsMap = new Map();
|
|
|
11
11
|
* @param {Array} inputsData - 服务端返回的inputs数组
|
|
12
12
|
*/
|
|
13
13
|
function setNodeParams(inputsData) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (!Array.isArray(inputsData)) {
|
|
15
|
+
console.error("Invalid inputs data format:", inputsData);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 清空现有映射
|
|
20
|
+
nodeParamsMap.clear();
|
|
21
|
+
|
|
22
|
+
// 构建新的映射
|
|
23
|
+
inputsData.forEach((nodeInfo) => {
|
|
24
|
+
if (nodeInfo && nodeInfo.nodeId && Array.isArray(nodeInfo.params)) {
|
|
25
|
+
// 以nodeId为键,存储参数信息
|
|
26
|
+
const paramNames = nodeInfo.params.map((param) => param.name);
|
|
27
|
+
nodeParamsMap.set(nodeInfo.nodeId, {
|
|
28
|
+
name: nodeInfo.name,
|
|
29
|
+
displayName: nodeInfo.displayName,
|
|
30
|
+
paramNames: paramNames,
|
|
31
|
+
params: nodeInfo.params,
|
|
32
|
+
});
|
|
17
33
|
}
|
|
34
|
+
});
|
|
18
35
|
|
|
19
|
-
|
|
20
|
-
nodeParamsMap.clear();
|
|
21
|
-
|
|
22
|
-
// 构建新的映射
|
|
23
|
-
inputsData.forEach(nodeInfo => {
|
|
24
|
-
if (nodeInfo && nodeInfo.nodeId && Array.isArray(nodeInfo.params)) {
|
|
25
|
-
// 以nodeId为键,存储参数信息
|
|
26
|
-
const paramNames = nodeInfo.params.map(param => param.name);
|
|
27
|
-
nodeParamsMap.set(nodeInfo.nodeId, {
|
|
28
|
-
name: nodeInfo.name,
|
|
29
|
-
displayName: nodeInfo.displayName,
|
|
30
|
-
paramNames: paramNames,
|
|
31
|
-
params: nodeInfo.params
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
console.log('节点参数映射已更新:', nodeParamsMap);
|
|
36
|
+
console.log("节点参数映射已更新:", nodeParamsMap);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -42,71 +42,73 @@ function setNodeParams(inputsData) {
|
|
|
42
42
|
* @returns {Object|null} - 过滤后的节点信息,如果节点不符合条件则返回null
|
|
43
43
|
*/
|
|
44
44
|
function filterNodeWidgets(node) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
if (!node || !node.id) return null;
|
|
46
|
+
|
|
47
|
+
// 如果节点ID不在参数映射中,则不是可配置节点
|
|
48
|
+
if (!nodeParamsMap.has(String(node.id))) {
|
|
49
|
+
console.log(`节点 ${node.id} 不在可配置列表中`);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 获取节点的允许参数列表
|
|
54
|
+
const nodeParamsInfo = nodeParamsMap.get(String(node.id));
|
|
55
|
+
const allowedParamNames = nodeParamsInfo.paramNames;
|
|
56
|
+
|
|
57
|
+
// 提取节点信息
|
|
58
|
+
const nodeInfo = {
|
|
59
|
+
id: node.id,
|
|
60
|
+
type: node.type,
|
|
61
|
+
comfyClass: node.comfyClass,
|
|
62
|
+
title: node.title || nodeParamsInfo.displayName,
|
|
63
|
+
widgets: [],
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// 过滤widgets,只保留在allowedParamNames中的widget
|
|
67
|
+
if (node.widgets && node.widgets.length > 0) {
|
|
68
|
+
nodeInfo.widgets = node.widgets
|
|
69
|
+
.filter((widget) => {
|
|
70
|
+
return (
|
|
71
|
+
widget.type !== "hidden" &&
|
|
72
|
+
!widget.disabled &&
|
|
73
|
+
allowedParamNames.includes(String(widget.name))
|
|
74
|
+
);
|
|
75
|
+
})
|
|
76
|
+
.map((widget) => {
|
|
77
|
+
const widgetInfo = {
|
|
78
|
+
name: String(widget.name || ""),
|
|
79
|
+
value: widget.value != null ? widget.value : "",
|
|
80
|
+
type: String(widget.type || ""),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// 处理options属性
|
|
84
|
+
if (widget.options && widget.options.values) {
|
|
85
|
+
widgetInfo.options = { values: [] };
|
|
86
|
+
|
|
87
|
+
if (Array.isArray(widget.options.values)) {
|
|
88
|
+
widgetInfo.options.values = [...widget.options.values];
|
|
89
|
+
} else if (typeof widget.options.values === "function") {
|
|
90
|
+
try {
|
|
91
|
+
const values = widget.options.values();
|
|
92
|
+
if (Array.isArray(values)) {
|
|
93
|
+
widgetInfo.options.values = [...values];
|
|
94
|
+
}
|
|
95
|
+
} catch (e) {
|
|
96
|
+
// 忽略错误
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
52
100
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// 提取节点信息
|
|
58
|
-
const nodeInfo = {
|
|
59
|
-
id: node.id,
|
|
60
|
-
type: node.type,
|
|
61
|
-
comfyClass: node.comfyClass,
|
|
62
|
-
title: node.title || nodeParamsInfo.displayName,
|
|
63
|
-
widgets: []
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// 过滤widgets,只保留在allowedParamNames中的widget
|
|
67
|
-
if (node.widgets && node.widgets.length > 0) {
|
|
68
|
-
nodeInfo.widgets = node.widgets
|
|
69
|
-
.filter(widget => {
|
|
70
|
-
return widget.type !== "hidden" &&
|
|
71
|
-
!widget.disabled &&
|
|
72
|
-
allowedParamNames.includes(String(widget.name));
|
|
73
|
-
})
|
|
74
|
-
.map(widget => {
|
|
75
|
-
const widgetInfo = {
|
|
76
|
-
name: String(widget.name || ""),
|
|
77
|
-
value: widget.value != null ? widget.value : "",
|
|
78
|
-
type: String(widget.type || "")
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
// 处理options属性
|
|
82
|
-
if (widget.options && widget.options.values) {
|
|
83
|
-
widgetInfo.options = { values: [] };
|
|
84
|
-
|
|
85
|
-
if (Array.isArray(widget.options.values)) {
|
|
86
|
-
widgetInfo.options.values = [...widget.options.values];
|
|
87
|
-
} else if (typeof widget.options.values === 'function') {
|
|
88
|
-
try {
|
|
89
|
-
const values = widget.options.values();
|
|
90
|
-
if (Array.isArray(values)) {
|
|
91
|
-
widgetInfo.options.values = [...values];
|
|
92
|
-
}
|
|
93
|
-
} catch (e) {
|
|
94
|
-
// 忽略错误
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return widgetInfo;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
101
|
+
return widgetInfo;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
// 如果过滤后没有可配置的参数,则不符合条件
|
|
106
|
+
if (nodeInfo.widgets.length === 0) {
|
|
107
|
+
console.log(`节点 ${node.id} 没有可配置的参数`);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
return nodeInfo;
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
/**
|
|
@@ -115,7 +117,7 @@ function filterNodeWidgets(node) {
|
|
|
115
117
|
* @returns {boolean} - 节点是否可配置
|
|
116
118
|
*/
|
|
117
119
|
function isConfigurableNode(nodeId) {
|
|
118
|
-
|
|
120
|
+
return nodeParamsMap.has(String(nodeId));
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
/**
|
|
@@ -124,13 +126,13 @@ function isConfigurableNode(nodeId) {
|
|
|
124
126
|
* @returns {Object|null} - 节点参数信息
|
|
125
127
|
*/
|
|
126
128
|
function getNodeParamsInfo(nodeId) {
|
|
127
|
-
|
|
129
|
+
return nodeParamsMap.get(String(nodeId)) || null;
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
// 导出模块
|
|
131
133
|
export {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
setNodeParams,
|
|
135
|
+
filterNodeWidgets,
|
|
136
|
+
isConfigurableNode,
|
|
137
|
+
getNodeParamsInfo,
|
|
136
138
|
};
|