bizydraft 0.1.11__py3-none-any.whl → 0.1.13__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/hookLoadImage.js +49 -18
- bizydraft/static/js/postEvent.js +23 -4
- {bizydraft-0.1.11.dist-info → bizydraft-0.1.13.dist-info}/METADATA +1 -1
- {bizydraft-0.1.11.dist-info → bizydraft-0.1.13.dist-info}/RECORD +6 -6
- {bizydraft-0.1.11.dist-info → bizydraft-0.1.13.dist-info}/WHEEL +0 -0
- {bizydraft-0.1.11.dist-info → bizydraft-0.1.13.dist-info}/top_level.txt +0 -0
|
@@ -6,9 +6,17 @@ app.registerExtension({
|
|
|
6
6
|
name: "bizyair.image.to.oss",
|
|
7
7
|
async beforeRegisterNodeDef(nodeType, nodeData) {
|
|
8
8
|
if (nodeData.name === 'LoadImage') {
|
|
9
|
+
let workflowParams = null
|
|
10
|
+
document.addEventListener('workflowLoaded', (event) => {
|
|
11
|
+
workflowParams = event.detail;
|
|
12
|
+
});
|
|
9
13
|
nodeType.prototype.onNodeCreated = async function() {
|
|
14
|
+
const image_widget = this.widgets.find(w => w.name === 'image');
|
|
15
|
+
console.log(image_widget)
|
|
10
16
|
// const apiHost = 'http://localhost:3000/api'
|
|
11
17
|
const apiHost = 'https://uat87.bizyair.cn/api'
|
|
18
|
+
const node = this;
|
|
19
|
+
let image_list = []
|
|
12
20
|
const getData = async () => {
|
|
13
21
|
const res = await fetch(`${apiHost}/special/community/commit_input_resource?${
|
|
14
22
|
new URLSearchParams({
|
|
@@ -27,7 +35,7 @@ app.registerExtension({
|
|
|
27
35
|
})
|
|
28
36
|
const {data} = await res.json()
|
|
29
37
|
const list = data.data.data.list || []
|
|
30
|
-
|
|
38
|
+
image_list = list.filter(item => item.name).map(item => {
|
|
31
39
|
return {
|
|
32
40
|
url: item.url,
|
|
33
41
|
name: item.name
|
|
@@ -36,22 +44,54 @@ app.registerExtension({
|
|
|
36
44
|
})
|
|
37
45
|
const image_widget = this.widgets.find(w => w.name === 'image');
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
|
|
48
|
+
let image_path_widget = this.widgets.find(w => w.name === 'image_path');
|
|
49
|
+
if (!image_path_widget) {
|
|
50
|
+
image_path_widget = this.addWidget("text", "image_path", "", function(){}, {
|
|
51
|
+
serialize: true
|
|
52
|
+
});
|
|
53
|
+
image_path_widget.type = "hidden";
|
|
54
|
+
image_path_widget.computeSize = () => [0, 0]; // 隐藏显示
|
|
55
|
+
}
|
|
40
56
|
|
|
41
57
|
image_widget.options.values = image_list.map(item => item.name);
|
|
42
|
-
|
|
58
|
+
console.log(image_widget.value)
|
|
43
59
|
// image_widget.value = image_list[0].url;
|
|
44
60
|
// image_widget.value = image_list[0];
|
|
45
61
|
if (image_list[0] && image_list[0].url) {
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
const defaultImageUrl = decodeURIComponent(image_list[0].url);
|
|
63
|
+
image_path_widget.value = defaultImageUrl;
|
|
64
|
+
|
|
65
|
+
previewImage(node, defaultImageUrl)
|
|
48
66
|
}
|
|
49
67
|
image_widget.callback = function(e) {
|
|
50
68
|
const image_url = decodeURIComponent(image_list.find(item => item.name === e).url);
|
|
69
|
+
image_path_widget.value = image_url;
|
|
51
70
|
previewImage(node, image_url)
|
|
52
71
|
}
|
|
72
|
+
return true
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await getData()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
const imageNode = workflowParams.json.nodes.find(item => item.type === 'LoadImage')
|
|
81
|
+
if (imageNode && imageNode.widgets_values && imageNode.widgets_values[2]) {
|
|
82
|
+
const temp = {
|
|
83
|
+
name: imageNode.widgets_values[0],
|
|
84
|
+
url: imageNode.widgets_values[2]
|
|
85
|
+
}
|
|
86
|
+
image_list.push(temp)
|
|
87
|
+
image_widget.value = temp.name
|
|
88
|
+
image_widget.options.values = image_list.map(item => item.name)
|
|
89
|
+
previewImage(node, temp.url)
|
|
90
|
+
|
|
91
|
+
requestAnimationFrame(() => {
|
|
92
|
+
previewImage(node, temp.url)
|
|
93
|
+
})
|
|
53
94
|
}
|
|
54
|
-
getData()
|
|
55
95
|
|
|
56
96
|
|
|
57
97
|
const upload_widget = this.widgets.find(w => w.name === 'upload');
|
|
@@ -76,22 +116,13 @@ function previewImage(node, image_url) {
|
|
|
76
116
|
const img = new Image();
|
|
77
117
|
img.onload = function() {
|
|
78
118
|
node.imgs = [img];
|
|
79
|
-
if (node.graph) {
|
|
119
|
+
if (node.graph && node.graph.setDirtyCanvas) {
|
|
80
120
|
node.graph.setDirtyCanvas(true);
|
|
81
121
|
} else {
|
|
82
122
|
console.warn('[BizyAir] 无法访问graph对象进行重绘');
|
|
83
123
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
window.app?.nodeOutputStore ||
|
|
87
|
-
app?.nodeOutputStore;
|
|
88
|
-
|
|
89
|
-
if (imageOutputStore) {
|
|
90
|
-
console.log('[BizyAir] 设置节点输出数据');
|
|
91
|
-
imageOutputStore.setNodeOutputs(node, image_url, { isAnimated: false });
|
|
92
|
-
} else {
|
|
93
|
-
console.warn('[BizyAir] 未找到nodeOutputStore');
|
|
94
|
-
}
|
|
124
|
+
|
|
125
|
+
console.log('[BizyAir] 图片预览加载成功');
|
|
95
126
|
};
|
|
96
127
|
img.onerror = function(err) {
|
|
97
128
|
console.error('[BizyAir] 图片加载失败:', image_url, err);
|
bizydraft/static/js/postEvent.js
CHANGED
|
@@ -502,6 +502,9 @@ app.registerExtension({
|
|
|
502
502
|
|
|
503
503
|
loadWorkflow: function (params) {
|
|
504
504
|
app.graph.clear();
|
|
505
|
+
document.dispatchEvent(new CustomEvent('workflowLoaded', {
|
|
506
|
+
detail: params
|
|
507
|
+
}));
|
|
505
508
|
if (params.json.version) {
|
|
506
509
|
app.loadGraphData(params.json);
|
|
507
510
|
} else {
|
|
@@ -555,19 +558,35 @@ app.registerExtension({
|
|
|
555
558
|
runWorkflow: async function () {
|
|
556
559
|
try {
|
|
557
560
|
// 确保有连接
|
|
558
|
-
await getSocketAsync();
|
|
561
|
+
// await getSocketAsync();
|
|
559
562
|
|
|
560
563
|
const graph = await app.graphToPrompt();
|
|
561
|
-
const res = await app.queuePrompt(graph.output);
|
|
562
|
-
console.log("-----------queuePrompt-----------", res)
|
|
563
564
|
const clientId = sessionStorage.getItem("clientId");
|
|
565
|
+
const resPrompt = await fetch("api/prompt", {
|
|
566
|
+
method: "POST",
|
|
567
|
+
body: JSON.stringify({
|
|
568
|
+
prompt: graph.output,
|
|
569
|
+
clientId,
|
|
570
|
+
number: graph.output,
|
|
571
|
+
extra_data: {
|
|
572
|
+
extra_pnginfo: {
|
|
573
|
+
workflow: graph.workflow
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
})
|
|
577
|
+
});
|
|
578
|
+
const resPromptJson = await resPrompt.json();
|
|
579
|
+
if (resPromptJson.error) {
|
|
580
|
+
await app.queuePrompt(graph.output);
|
|
581
|
+
}
|
|
564
582
|
window.parent.postMessage({
|
|
565
583
|
type: 'functionResult',
|
|
566
584
|
method: 'runWorkflow',
|
|
567
585
|
result: {
|
|
568
586
|
clientId: clientId,
|
|
569
587
|
jsonWorkflow: graph.output,
|
|
570
|
-
workflow: graph.workflow
|
|
588
|
+
workflow: graph.workflow,
|
|
589
|
+
prompt: resPromptJson
|
|
571
590
|
}
|
|
572
591
|
}, '*');
|
|
573
592
|
return true;
|
|
@@ -4,13 +4,13 @@ bizydraft/hijack_routes.py,sha256=tzSIY-3wLiwoHALf7MswjAF5FqDSmXynGjpfTgRdkxE,61
|
|
|
4
4
|
bizydraft/resp.py,sha256=8INvKOe5Dgai3peKfqKjrhUoYeuXWXn358w30-_cY-A,369
|
|
5
5
|
bizydraft/server.py,sha256=ES1fBYr_Ufv_YWsynLck1ln9bXTGjK3KXas1CK9WBqM,1358
|
|
6
6
|
bizydraft/static/js/handleStyle.js,sha256=vIR_W3GLKn-saIPhKfLeuJ7QbeNI4PhjAkjGjJpxVcA,1461
|
|
7
|
-
bizydraft/static/js/hookLoadImage.js,sha256=
|
|
7
|
+
bizydraft/static/js/hookLoadImage.js,sha256=9ksy4ecRKT2OY90_klXAt2qipk121ZUmBwo5pB0NZeE,5413
|
|
8
8
|
bizydraft/static/js/main.js,sha256=cZ-7wR9T8aNLzIrTjc-g9xVZf7z6TXWl1zhP_wXSSVo,150
|
|
9
|
-
bizydraft/static/js/postEvent.js,sha256=
|
|
9
|
+
bizydraft/static/js/postEvent.js,sha256=12O0PR8LLYuTI5lPW4EPsxf9mslIyOi-EfDFGE4_r5A,26852
|
|
10
10
|
bizydraft/static/js/socket.js,sha256=q_SWsySJdVV7ZTH-3Pdr09pkWGQj08C9xVAQES7eJaU,2440
|
|
11
11
|
bizydraft/static/js/tool.js,sha256=IlDVjddodT9DtfdIGiIzSIKdxbUMztDLQ4jI0uFJCwk,206
|
|
12
12
|
bizydraft/static/js/uploadFile.js,sha256=Ae0VdYRE3c1bx1GBQGUpJ-NOXXB984u3T_grhLXOvgQ,4973
|
|
13
|
-
bizydraft-0.1.
|
|
14
|
-
bizydraft-0.1.
|
|
15
|
-
bizydraft-0.1.
|
|
16
|
-
bizydraft-0.1.
|
|
13
|
+
bizydraft-0.1.13.dist-info/METADATA,sha256=VeErj2DVGnthcb2WurwdGm9K3A-fXmru6O6F8US7dgo,73
|
|
14
|
+
bizydraft-0.1.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
bizydraft-0.1.13.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
|
|
16
|
+
bizydraft-0.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|