bizydraft 0.2.50__py3-none-any.whl → 0.2.52__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/static/js/postEvent.js +158 -166
- {bizydraft-0.2.50.dist-info → bizydraft-0.2.52.dist-info}/METADATA +1 -1
- {bizydraft-0.2.50.dist-info → bizydraft-0.2.52.dist-info}/RECORD +5 -5
- {bizydraft-0.2.50.dist-info → bizydraft-0.2.52.dist-info}/WHEEL +0 -0
- {bizydraft-0.2.50.dist-info → bizydraft-0.2.52.dist-info}/top_level.txt +0 -0
bizydraft/static/js/postEvent.js
CHANGED
|
@@ -134,135 +134,149 @@ app.registerExtension({
|
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
if (event.data instanceof ArrayBuffer) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
137
|
+
const view = new DataView(event.data)
|
|
138
|
+
const eventType = view.getUint32(0)
|
|
139
|
+
|
|
140
|
+
let imageMime
|
|
141
|
+
switch (eventType) {
|
|
142
|
+
case 3:
|
|
143
|
+
const decoder = new TextDecoder()
|
|
144
|
+
const data = event.data.slice(4)
|
|
145
|
+
const nodeIdLength = view.getUint32(4)
|
|
146
|
+
dispatchCustomEvent('progress_text', {
|
|
147
|
+
nodeId: decoder.decode(data.slice(4, 4 + nodeIdLength)),
|
|
148
|
+
text: decoder.decode(data.slice(4 + nodeIdLength))
|
|
149
|
+
})
|
|
150
|
+
break
|
|
151
|
+
case 1:
|
|
152
|
+
const imageType = view.getUint32(4)
|
|
153
|
+
const imageData = event.data.slice(8)
|
|
154
|
+
switch (imageType) {
|
|
155
|
+
case 2:
|
|
156
|
+
imageMime = 'image/png'
|
|
157
|
+
break
|
|
151
158
|
case 1:
|
|
152
|
-
const imageType = view.getUint32(4);
|
|
153
|
-
const imageData = event.data.slice(8);
|
|
154
|
-
switch (imageType) {
|
|
155
|
-
case 2:
|
|
156
|
-
imageMime = 'image/png';
|
|
157
|
-
break;
|
|
158
|
-
case 1:
|
|
159
|
-
default:
|
|
160
|
-
imageMime = 'image/jpeg';
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
const imageBlob = new Blob([imageData], {
|
|
164
|
-
type: imageMime
|
|
165
|
-
});
|
|
166
|
-
dispatchCustomEvent('b_preview', imageBlob);
|
|
167
|
-
break;
|
|
168
159
|
default:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
160
|
+
imageMime = 'image/jpeg'
|
|
161
|
+
break
|
|
162
|
+
}
|
|
163
|
+
const imageBlob = new Blob([imageData], {
|
|
164
|
+
type: imageMime
|
|
165
|
+
})
|
|
166
|
+
dispatchCustomEvent('b_preview', imageBlob)
|
|
167
|
+
break
|
|
168
|
+
case 4:
|
|
169
|
+
// PREVIEW_IMAGE_WITH_METADATA
|
|
170
|
+
const decoder4 = new TextDecoder()
|
|
171
|
+
const metadataLength = view.getUint32(4)
|
|
172
|
+
const metadataBytes = event.data.slice(8, 8 + metadataLength)
|
|
173
|
+
const metadata = JSON.parse(decoder4.decode(metadataBytes))
|
|
174
|
+
const imageData4 = event.data.slice(8 + metadataLength)
|
|
175
|
+
|
|
176
|
+
let imageMime4 = metadata.image_type
|
|
177
|
+
|
|
178
|
+
const imageBlob4 = new Blob([imageData4], {
|
|
179
|
+
type: imageMime4
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
// Dispatch enhanced preview event with metadata
|
|
183
|
+
dispatchCustomEvent('b_preview_with_metadata', {
|
|
184
|
+
blob: imageBlob4,
|
|
185
|
+
nodeId: metadata.node_id,
|
|
186
|
+
displayNodeId: metadata.display_node_id,
|
|
187
|
+
parentNodeId: metadata.parent_node_id,
|
|
188
|
+
realNodeId: metadata.real_node_id,
|
|
189
|
+
promptId: metadata.prompt_id
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
// Also dispatch legacy b_preview for backward compatibility
|
|
193
|
+
dispatchCustomEvent('b_preview', imageBlob4)
|
|
194
|
+
break
|
|
195
|
+
default:
|
|
196
|
+
throw new Error(
|
|
197
|
+
`Unknown binary websocket message of type ${eventType}`
|
|
198
|
+
)
|
|
199
|
+
}
|
|
173
200
|
} else {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const msg = JSON.parse(event.data);
|
|
201
|
+
// 检测[DONE]消息
|
|
202
|
+
if (event.data === '[DONE]') {
|
|
203
|
+
console.log('收到[DONE]消息,任务已完成,停止心跳并关闭连接');
|
|
204
|
+
self.taskRunning = false;
|
|
205
|
+
self.stopPing();
|
|
206
|
+
self.closeSocket(1000);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const msg = JSON.parse(event.data)
|
|
184
210
|
window.parent.postMessage({
|
|
185
211
|
type: 'functionResult',
|
|
186
212
|
method: 'progress_info_change',
|
|
187
213
|
result: msg.progress_info
|
|
188
214
|
}, '*');
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
|
|
216
|
+
switch (msg.type) {
|
|
217
|
+
case 'load_start':
|
|
218
|
+
case 'load_end':
|
|
219
|
+
case 'prompt_id':
|
|
220
|
+
// 发送准备状态信息
|
|
221
|
+
window.parent.postMessage({
|
|
222
|
+
type: 'functionResult',
|
|
223
|
+
method: 'preparingStatus',
|
|
224
|
+
result: msg
|
|
225
|
+
}, '*')
|
|
226
|
+
break
|
|
227
|
+
case 'status':
|
|
228
|
+
if (msg.data.sid) {
|
|
229
|
+
const clientId = msg.data.sid
|
|
230
|
+
window.name = clientId // use window name so it isnt reused when duplicating tabs
|
|
231
|
+
sessionStorage.setItem('clientId', clientId) // store in session storage so duplicate tab can load correct workflow
|
|
232
|
+
}
|
|
233
|
+
dispatchCustomEvent('status', msg.data.status ?? null)
|
|
234
|
+
break
|
|
235
|
+
case 'executing':
|
|
236
|
+
dispatchCustomEvent(
|
|
237
|
+
'executing',
|
|
238
|
+
msg.data.display_node || msg.data.node
|
|
239
|
+
)
|
|
240
|
+
break
|
|
241
|
+
case 'execution_start':
|
|
242
|
+
case 'execution_error':
|
|
243
|
+
case 'execution_interrupted':
|
|
244
|
+
case 'execution_cached':
|
|
245
|
+
case 'execution_success':
|
|
246
|
+
case 'progress':
|
|
247
|
+
case 'progress_state':
|
|
248
|
+
case 'executed':
|
|
249
|
+
case 'graphChanged':
|
|
250
|
+
case 'promptQueued':
|
|
251
|
+
case 'logs':
|
|
252
|
+
case 'b_preview':
|
|
253
|
+
dispatchCustomEvent(msg.type, msg.data)
|
|
254
|
+
break
|
|
255
|
+
case 'feature_flags':
|
|
256
|
+
// Store server feature flags
|
|
257
|
+
this.serverFeatureFlags = msg.data
|
|
258
|
+
console.log(
|
|
259
|
+
'Server feature flags received:',
|
|
260
|
+
this.serverFeatureFlags
|
|
261
|
+
)
|
|
262
|
+
break
|
|
263
|
+
default:
|
|
264
|
+
const registeredTypes = socket.registeredTypes || new Set();
|
|
265
|
+
const reportedUnknownMessageTypes = socket.reportedUnknownMessageTypes || new Set();
|
|
266
|
+
|
|
267
|
+
if (registeredTypes.has(msg.type)) {
|
|
268
|
+
app.dispatchEvent(
|
|
269
|
+
new CustomEvent(msg.type, { detail: msg.data })
|
|
211
270
|
);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
self.taskRunning = false;
|
|
218
|
-
}
|
|
219
|
-
dispatchCustomEvent(msg.type, msg.data);
|
|
220
|
-
break;
|
|
221
|
-
case 'error':
|
|
222
|
-
self.taskRunning = false;
|
|
223
|
-
dispatchCustomEvent('execution_error', {
|
|
224
|
-
exception_message: msg.data.error_message || 'Unknown error',
|
|
225
|
-
traceback: ['Manual error triggered'],
|
|
226
|
-
executed: [],
|
|
227
|
-
prompt_id: 'manual',
|
|
228
|
-
node_id: '0',
|
|
229
|
-
node_type: 'RunError',
|
|
230
|
-
});
|
|
231
|
-
break;
|
|
232
|
-
case 'execution_error':
|
|
233
|
-
case 'execution_interrupted':
|
|
234
|
-
self.taskRunning = false;
|
|
235
|
-
dispatchCustomEvent(msg.type, msg.data);
|
|
236
|
-
break;
|
|
237
|
-
case 'execution_start':
|
|
238
|
-
self.taskRunning = true;
|
|
239
|
-
dispatchCustomEvent(msg.type, msg.data);
|
|
240
|
-
break;
|
|
241
|
-
case 'progress':
|
|
242
|
-
case 'executed':
|
|
243
|
-
case 'graphChanged':
|
|
244
|
-
case 'promptQueued':
|
|
245
|
-
case 'logs':
|
|
246
|
-
case 'b_preview':
|
|
247
|
-
dispatchCustomEvent(msg.type, msg.data);
|
|
248
|
-
break;
|
|
249
|
-
default:
|
|
250
|
-
const registeredTypes = socket.registeredTypes || new Set();
|
|
251
|
-
const reportedUnknownMessageTypes = socket.reportedUnknownMessageTypes || new Set();
|
|
252
|
-
|
|
253
|
-
if (registeredTypes.has(msg.type)) {
|
|
254
|
-
app.dispatchEvent(
|
|
255
|
-
new CustomEvent(msg.type, { detail: msg.data })
|
|
256
|
-
);
|
|
257
|
-
} else if (!reportedUnknownMessageTypes.has(msg.type)) {
|
|
258
|
-
reportedUnknownMessageTypes.add(msg.type);
|
|
259
|
-
console.warn(`Unknown message type ${msg.type}`);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
271
|
+
} else if (!reportedUnknownMessageTypes.has(msg.type)) {
|
|
272
|
+
reportedUnknownMessageTypes.add(msg.type);
|
|
273
|
+
console.warn(`Unknown message type ${msg.type}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
262
276
|
}
|
|
263
|
-
|
|
264
|
-
console.warn('Unhandled message:', event.data, error)
|
|
265
|
-
|
|
277
|
+
} catch (error) {
|
|
278
|
+
console.warn('Unhandled message:', event.data, error)
|
|
279
|
+
}
|
|
266
280
|
};
|
|
267
281
|
|
|
268
282
|
socket.onerror = function(error) {
|
|
@@ -505,41 +519,21 @@ app.registerExtension({
|
|
|
505
519
|
}, '*');
|
|
506
520
|
return graph.workflow;
|
|
507
521
|
},
|
|
508
|
-
getWorkflowNotSave: async function () {
|
|
509
|
-
const graph = await app.graphToPrompt();
|
|
510
|
-
// 规范化工作流,移除不影响逻辑的视觉字段,避免颜色等样式变化影响校验
|
|
511
|
-
const normalizeWorkflow = (workflow) => {
|
|
512
|
-
const json = JSON.stringify(workflow, (key, value) => {
|
|
513
|
-
if (key === 'color' || key === 'bgcolor' || key === 'extra') return undefined;
|
|
514
|
-
return value;
|
|
515
|
-
});
|
|
516
|
-
return JSON.parse(json);
|
|
517
|
-
};
|
|
518
|
-
const normalized = normalizeWorkflow(graph.workflow);
|
|
519
|
-
window.parent.postMessage({
|
|
520
|
-
type: 'functionResult',
|
|
521
|
-
method: 'getWorkflowNotSave',
|
|
522
|
-
result: normalized
|
|
523
|
-
}, '*');
|
|
524
|
-
return normalized;
|
|
525
|
-
},
|
|
526
522
|
// 新增:获取 workflow 和 output
|
|
527
523
|
getWorkflowWithOutput: async function () {
|
|
528
524
|
const graph = await app.graphToPrompt();
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
graph.output[key]._meta.id = Number(key);
|
|
542
|
-
}
|
|
525
|
+
graph.workflow.nodes.forEach(node => {
|
|
526
|
+
for (const key in graph.output) {
|
|
527
|
+
if (graph.output[key].class_type === node.type) {
|
|
528
|
+
if (!graph.output[key]._meta) {
|
|
529
|
+
graph.output[key]._meta = {};
|
|
530
|
+
}
|
|
531
|
+
graph.output[key]._meta.id = node.id;
|
|
532
|
+
graph.output[key]._meta.class_type = graph.output[key].class_type;
|
|
533
|
+
break; // 找到匹配的就跳出循环
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
});
|
|
543
537
|
window.parent.postMessage({
|
|
544
538
|
type: 'functionResult',
|
|
545
539
|
method: 'getWorkflowWithOutput',
|
|
@@ -572,6 +566,7 @@ app.registerExtension({
|
|
|
572
566
|
try {
|
|
573
567
|
// 确保有连接
|
|
574
568
|
// await getSocketAsync();
|
|
569
|
+
|
|
575
570
|
const graph = await app.graphToPrompt();
|
|
576
571
|
const clientId = sessionStorage.getItem("clientId");
|
|
577
572
|
await app.queuePrompt(graph.output);
|
|
@@ -618,21 +613,18 @@ app.registerExtension({
|
|
|
618
613
|
}
|
|
619
614
|
|
|
620
615
|
if (Object.keys(resPromptJson.node_errors).length) return
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
for (const key in graph.output) {
|
|
634
|
-
graph.output[key]._meta.id = Number(key);
|
|
635
|
-
}
|
|
616
|
+
graph.workflow.nodes.forEach(node => {
|
|
617
|
+
for (const key in graph.output) {
|
|
618
|
+
if (graph.output[key].class_type === node.type) {
|
|
619
|
+
if (!graph.output[key]._meta) {
|
|
620
|
+
graph.output[key]._meta = {};
|
|
621
|
+
}
|
|
622
|
+
graph.output[key]._meta.id = node.id;
|
|
623
|
+
graph.output[key]._meta.class_type = graph.output[key].class_type;
|
|
624
|
+
break; // 找到匹配的就跳出循环
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
});
|
|
636
628
|
|
|
637
629
|
for (let i in graph.output) {
|
|
638
630
|
if (graph.output[i].class_type == 'LoadImage') {
|
|
@@ -18,11 +18,11 @@ bizydraft/static/js/hookLoadModel.js,sha256=ovNvz4FRYNcOKJTueotugzIeGQDYAivYB5EQ
|
|
|
18
18
|
bizydraft/static/js/main.js,sha256=oEsVEUZSo8ipx93oqs2WFQSRgp46XQ_D-Xao-wen2S8,121
|
|
19
19
|
bizydraft/static/js/nodeFocusHandler.js,sha256=24xXbS4Q-GjJdRqf11i-1pBo8MkOJ24F7MHFV44EG6Q,4683
|
|
20
20
|
bizydraft/static/js/nodeParamsFilter.js,sha256=H7lBB0G8HNqoGhOCH1hNXqPU-rPlrFyTxg_f_JgLEMk,4168
|
|
21
|
-
bizydraft/static/js/postEvent.js,sha256=
|
|
21
|
+
bizydraft/static/js/postEvent.js,sha256=qx-p_MDNIzOPWD4sw35jIpabhmTYejy_VFScPaDekg4,39203
|
|
22
22
|
bizydraft/static/js/socket.js,sha256=VE3fTAgEfM0FZhL526Skt7OCRokOa3mzTCAjAomI_tE,2432
|
|
23
23
|
bizydraft/static/js/tool.js,sha256=VupamUuh7tYiDnBTrL5Z_yLmhJinskhzRXwE3zfsKZM,2901
|
|
24
24
|
bizydraft/static/js/uploadFile.js,sha256=WvglKzHMeOzDhOH3P-fLcPHxCLbKOJpo4DntoRxeJtI,4908
|
|
25
|
-
bizydraft-0.2.
|
|
26
|
-
bizydraft-0.2.
|
|
27
|
-
bizydraft-0.2.
|
|
28
|
-
bizydraft-0.2.
|
|
25
|
+
bizydraft-0.2.52.dist-info/METADATA,sha256=0ixvA3wpEIy5udo9xTrkEMCU5VaNn5-z202OFCLdtFA,162
|
|
26
|
+
bizydraft-0.2.52.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
27
|
+
bizydraft-0.2.52.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
|
|
28
|
+
bizydraft-0.2.52.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|