bizydraft 0.1.8__py3-none-any.whl → 0.1.10__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.

@@ -31,6 +31,12 @@ const styleMenus = `
31
31
  #comfyui-body-bottom{
32
32
  display: none;
33
33
  }
34
+ .p-button.p-component.p-button-icon-only.p-button-text.model-library-tab-button.side-bar-button.p-button-secondary{
35
+ display: none;
36
+ }
37
+ .p-button.p-component.p-button-icon-only.p-button-text.workflows-tab-button.side-bar-button.p-button-secondary{
38
+ display: none;
39
+ }
34
40
  `
35
41
  app.registerExtension({
36
42
  name: "comfy.BizyAir.Style",
@@ -10,7 +10,7 @@ app.registerExtension({
10
10
  // const apiHost = 'http://localhost:3000/api'
11
11
  const apiHost = 'https://uat87.bizyair.cn/api'
12
12
  const getData = async () => {
13
- const res = await fetch(`${apiHost}/community/commit_input_resource?${
13
+ const res = await fetch(`${apiHost}/special/community/commit_input_resource?${
14
14
  new URLSearchParams({
15
15
  url: '',
16
16
  ext: '',
@@ -43,6 +43,7 @@ app.registerExtension({
43
43
  // image_widget.value = image_list[0].url;
44
44
  // image_widget.value = image_list[0];
45
45
  if (image_list[0] && image_list[0].url) {
46
+ image_widget.value = image_list[0].name;
46
47
  previewImage(node, decodeURIComponent(image_list[0].url))
47
48
  }
48
49
  image_widget.callback = function(e) {
@@ -7,192 +7,410 @@ app.registerExtension({
7
7
  app.api.dispatchCustomEvent(type, detail);
8
8
  },
9
9
 
10
- customSocket(callback, customUrl) {
11
- const url = customUrl || app.api.socket.url;
12
- const socket = new WebSocket(url);
13
- const dispatchCustomEvent = this.dispatchCustomEvent;
14
-
15
- socket.onmessage = function (event) {
16
- try {
17
- if (event.data instanceof ArrayBuffer) {
18
- const view = new DataView(event.data);
19
- const eventType = view.getUint32(0);
20
-
21
- let imageMime;
22
- switch (eventType) {
23
- case 3:
24
- const decoder = new TextDecoder();
25
- const data = event.data.slice(4);
26
- const nodeIdLength = view.getUint32(4);
27
- dispatchCustomEvent('progress_text', {
28
- nodeId: decoder.decode(data.slice(4, 4 + nodeIdLength)),
29
- text: decoder.decode(data.slice(4 + nodeIdLength))
30
- });
31
- break;
32
- case 1:
33
- const imageType = view.getUint32(4);
34
- const imageData = event.data.slice(8);
35
- switch (imageType) {
36
- case 2:
37
- imageMime = 'image/png';
38
- break;
39
- case 1:
40
- default:
41
- imageMime = 'image/jpeg';
42
- break;
43
- }
44
- const imageBlob = new Blob([imageData], {
45
- type: imageMime
46
- });
47
- dispatchCustomEvent('b_preview', imageBlob);
48
- break;
49
- default:
50
- throw new Error(
51
- `Unknown binary websocket message of type ${eventType}`
52
- );
10
+ socket: null,
11
+ isConnecting: false,
12
+ taskRunning: false,
13
+
14
+ // 心跳检测
15
+ pingInterval: 5000, // 5秒发送一次心跳
16
+ pingTimer: null,
17
+ pingTimeout: 3000,
18
+ pongReceived: false,
19
+ pingTimeoutTimer: null, // ping超时计时器
20
+
21
+ /**
22
+ * 开始心跳检测
23
+ */
24
+ startPing() {
25
+ this.stopPing();
26
+
27
+ if (!this.socket || this.socket.readyState !== WebSocket.OPEN) {
28
+ return;
29
+ }
30
+
31
+ this.pingTimer = setInterval(() => {
32
+ if (this.socket && this.socket.readyState === WebSocket.OPEN) {
33
+ this.pongReceived = false;
34
+ this.socket.send('ping');
35
+
36
+ // 设置ping超时检测
37
+ this.pingTimeoutTimer = setTimeout(() => {
38
+ // 如果没有收到pong响应
39
+ if (!this.pongReceived) {
40
+ console.log('心跳检测超时,重新连接WebSocket');
41
+ this.stopPing();
42
+ this.reconnect();
53
43
  }
54
- } else {
55
- const msg = JSON.parse(event.data);
56
- window.parent.postMessage({
57
- type: 'functionResult',
58
- method: 'progress_info_change',
59
- result: msg.progress_info
60
- }, '*');
61
- switch (msg.type) {
62
- case 'status':
63
- if (msg.data.sid) {
64
- const clientId = msg.data.sid;
65
- window.name = clientId;
66
- sessionStorage.setItem('clientId', clientId);
67
- socket.clientId = clientId;
68
- }
69
- dispatchCustomEvent('status', msg.data.status ?? null);
70
- break;
71
- case 'executing':
72
-
73
- dispatchCustomEvent(
74
- 'executing',
75
- msg.data.display_node || msg.data.node
76
- );
77
- break;
78
- case 'execution_start':
79
- case 'execution_error':
80
- case 'execution_interrupted':
81
- case 'execution_cached':
82
- case 'execution_success':
83
- case 'progress':
84
- case 'executed':
85
- case 'graphChanged':
86
- case 'promptQueued':
87
- case 'logs':
88
- case 'b_preview':
89
- dispatchCustomEvent(msg.type, msg.data);
90
- break;
91
- default:
92
- const registeredTypes = socket.registeredTypes || new Set();
93
- const reportedUnknownMessageTypes = socket.reportedUnknownMessageTypes || new Set();
94
-
95
- if (registeredTypes.has(msg.type)) {
96
- app.dispatchEvent(
97
- new CustomEvent(msg.type, { detail: msg.data })
44
+ }, this.pingTimeout);
45
+ } else {
46
+ this.stopPing();
47
+ }
48
+ }, this.pingInterval);
49
+ },
50
+
51
+ /**
52
+ * 停止心跳检测
53
+ */
54
+ stopPing() {
55
+ if (this.pingTimer) {
56
+ clearInterval(this.pingTimer);
57
+ this.pingTimer = null;
58
+ }
59
+
60
+ if (this.pingTimeoutTimer) {
61
+ clearTimeout(this.pingTimeoutTimer);
62
+ this.pingTimeoutTimer = null;
63
+ }
64
+ },
65
+
66
+ /**
67
+ * 重新连接
68
+ */
69
+ reconnect() {
70
+ if (this.isConnecting) {
71
+ return;
72
+ }
73
+ const url = this.socket ? this.socket.url : app.api.socket.url;
74
+ this.closeSocket();
75
+ this.createSocket(url);
76
+ },
77
+
78
+ /**
79
+ * 创建新的WebSocket连接
80
+ */
81
+ createSocket(customUrl) {
82
+ // 如果正在连接中,避免重复创建
83
+ if (this.isConnecting) {
84
+ console.log('WebSocket连接已在创建中,避免重复创建');
85
+ return null;
86
+ }
87
+
88
+ // 标记为连接中
89
+ this.isConnecting = true;
90
+
91
+ // 先关闭现有连接
92
+ this.closeSocket();
93
+
94
+ const url = customUrl || app.api.socket.url;
95
+ console.log('创建WebSocket连接:', url);
96
+
97
+ try {
98
+ const socket = new WebSocket(url);
99
+ const dispatchCustomEvent = this.dispatchCustomEvent;
100
+ const self = this;
101
+
102
+ socket.onopen = function() {
103
+ console.log('WebSocket连接已打开');
104
+ // 清除连接中标志
105
+ self.isConnecting = false;
106
+ // 存储为单例
107
+ self.socket = socket;
108
+ // 替换app.api.socket
109
+ app.api.socket = socket;
110
+ // 开始心跳检测
111
+ self.startPing();
112
+ };
113
+
114
+ socket.onmessage = function (event) {
115
+ try {
116
+ // 处理心跳响应
117
+ if (event.data === 'pong') {
118
+ // 标记收到pong响应
119
+ self.pongReceived = true;
120
+ return;
121
+ }
122
+ if (event.data instanceof ArrayBuffer) {
123
+ const view = new DataView(event.data);
124
+ const eventType = view.getUint32(0);
125
+
126
+ let imageMime;
127
+ switch (eventType) {
128
+ case 3:
129
+ const decoder = new TextDecoder();
130
+ const data = event.data.slice(4);
131
+ const nodeIdLength = view.getUint32(4);
132
+ dispatchCustomEvent('progress_text', {
133
+ nodeId: decoder.decode(data.slice(4, 4 + nodeIdLength)),
134
+ text: decoder.decode(data.slice(4 + nodeIdLength))
135
+ });
136
+ break;
137
+ case 1:
138
+ const imageType = view.getUint32(4);
139
+ const imageData = event.data.slice(8);
140
+ switch (imageType) {
141
+ case 2:
142
+ imageMime = 'image/png';
143
+ break;
144
+ case 1:
145
+ default:
146
+ imageMime = 'image/jpeg';
147
+ break;
148
+ }
149
+ const imageBlob = new Blob([imageData], {
150
+ type: imageMime
151
+ });
152
+ dispatchCustomEvent('b_preview', imageBlob);
153
+ break;
154
+ default:
155
+ throw new Error(
156
+ `Unknown binary websocket message of type ${eventType}`
157
+ );
158
+ }
159
+ } else {
160
+ // 检测[DONE]消息
161
+ if (event.data === '[DONE]') {
162
+ console.log('收到[DONE]消息,任务已完成,停止心跳并关闭连接');
163
+ self.taskRunning = false;
164
+ self.stopPing();
165
+ self.closeSocket();
166
+ return;
167
+ }
168
+
169
+ const msg = JSON.parse(event.data);
170
+ window.parent.postMessage({
171
+ type: 'functionResult',
172
+ method: 'progress_info_change',
173
+ result: msg.progress_info
174
+ }, '*');
175
+
176
+ switch (msg.type) {
177
+ case 'status':
178
+ if (msg.data.sid) {
179
+ const clientId = msg.data.sid;
180
+ window.name = clientId;
181
+ sessionStorage.setItem('clientId', clientId);
182
+ socket.clientId = clientId;
183
+ }
184
+ dispatchCustomEvent('status', msg.data.status ?? null);
185
+ break;
186
+ case 'executing':
187
+ dispatchCustomEvent(
188
+ 'executing',
189
+ msg.data.display_node || msg.data.node
98
190
  );
99
- } else if (!reportedUnknownMessageTypes.has(msg.type)) {
100
- reportedUnknownMessageTypes.add(msg.type);
101
- console.warn(`Unknown message type ${msg.type}`);
102
- }
191
+ break;
192
+ case 'execution_success':
193
+ case 'execution_cached':
194
+ // 检查任务是否完成
195
+ if (msg.data.completed) {
196
+ self.taskRunning = false;
197
+ }
198
+ dispatchCustomEvent(msg.type, msg.data);
199
+ break;
200
+ case 'execution_error':
201
+ case 'execution_interrupted':
202
+ self.taskRunning = false;
203
+ dispatchCustomEvent(msg.type, msg.data);
204
+ break;
205
+ case 'execution_start':
206
+ self.taskRunning = true;
207
+ dispatchCustomEvent(msg.type, msg.data);
208
+ break;
209
+ case 'progress':
210
+ case 'executed':
211
+ case 'graphChanged':
212
+ case 'promptQueued':
213
+ case 'logs':
214
+ case 'b_preview':
215
+ dispatchCustomEvent(msg.type, msg.data);
216
+ break;
217
+ default:
218
+ const registeredTypes = socket.registeredTypes || new Set();
219
+ const reportedUnknownMessageTypes = socket.reportedUnknownMessageTypes || new Set();
220
+
221
+ if (registeredTypes.has(msg.type)) {
222
+ app.dispatchEvent(
223
+ new CustomEvent(msg.type, { detail: msg.data })
224
+ );
225
+ } else if (!reportedUnknownMessageTypes.has(msg.type)) {
226
+ reportedUnknownMessageTypes.add(msg.type);
227
+ console.warn(`Unknown message type ${msg.type}`);
228
+ }
229
+ }
103
230
  }
231
+ } catch (error) {
232
+ console.warn('Unhandled message:', event.data, error);
104
233
  }
105
- } catch (error) {
106
- console.warn('Unhandled message:', event.data, error);
107
- }
108
- };
109
-
110
- socket.registeredTypes = new Set();
111
- socket.reportedUnknownMessageTypes = new Set();
112
-
113
- // 替换app.api.socket
114
- app.api.socket = socket;
115
-
116
- if (typeof callback === 'function') {
117
- callback(socket);
234
+ };
235
+
236
+ socket.onerror = function(error) {
237
+ console.log('WebSocket 错误:', error);
238
+ // 清除连接中标志
239
+ self.isConnecting = false;
240
+ // 停止心跳
241
+ self.stopPing();
242
+ };
243
+
244
+ socket.onclose = function(event) {
245
+ console.log('WebSocket 连接已关闭, 状态码:', event.code, event.reason);
246
+ // 清除连接中标志
247
+ self.isConnecting = false;
248
+ // 清理单例引用
249
+ if (self.socket === socket) {
250
+ self.socket = null;
251
+ }
252
+ // 停止心跳
253
+ self.stopPing();
254
+ };
255
+
256
+ socket.registeredTypes = new Set();
257
+ socket.reportedUnknownMessageTypes = new Set();
258
+
259
+ // 返回创建的socket,但不要立即使用,等待onopen
260
+ return socket;
261
+ } catch (error) {
262
+ console.error('创建WebSocket连接失败:', error);
263
+ this.isConnecting = false;
264
+ return null;
118
265
  }
119
-
120
- return socket;
121
266
  },
122
267
 
123
- startSocket(callback) {
124
- if (app.api.socket.readyState === WebSocket.CLOSED || app.api.socket.readyState === WebSocket.CLOSING) {
125
- return this.customSocket(callback);
268
+ /**
269
+ * 获取可用的socket连接,如果不存在则创建
270
+ * 返回Promise以确保连接已就绪
271
+ */
272
+ async getSocketAsync(customUrl) {
273
+ return new Promise((resolve, reject) => {
274
+ // 如果已有可用连接,直接返回
275
+ if (this.socket && this.socket.readyState === WebSocket.OPEN) {
276
+ resolve(this.socket);
277
+ return;
278
+ }
279
+
280
+ // 如果连接正在创建中,等待一段时间后检查
281
+ if (this.isConnecting) {
282
+ console.log('WebSocket连接创建中,等待...');
283
+ const checkInterval = setInterval(() => {
284
+ if (this.socket && this.socket.readyState === WebSocket.OPEN) {
285
+ clearInterval(checkInterval);
286
+ resolve(this.socket);
287
+ } else if (!this.isConnecting) {
288
+ clearInterval(checkInterval);
289
+ reject(new Error('WebSocket连接创建失败'));
290
+ }
291
+ }, 100); // 每100ms检查一次
292
+ return;
293
+ }
294
+
295
+ // 创建新连接
296
+ const socket = this.createSocket(customUrl);
297
+ if (!socket) {
298
+ reject(new Error('创建WebSocket连接失败'));
299
+ return;
300
+ }
301
+
302
+ // 监听连接打开事件
303
+ socket.addEventListener('open', () => {
304
+ resolve(socket);
305
+ });
306
+
307
+ // 监听错误事件
308
+ socket.addEventListener('error', (error) => {
309
+ reject(error);
310
+ });
311
+ });
312
+ },
313
+
314
+ /**
315
+ * 获取可用的socket连接,如果不存在则创建
316
+ * 同步版本,可能返回尚未就绪的连接
317
+ */
318
+ getSocket(customUrl) {
319
+ // 如果已有可用连接,直接返回
320
+ if (this.socket && this.socket.readyState === WebSocket.OPEN) {
321
+ return this.socket;
126
322
  }
127
- return app.api.socket;
323
+
324
+ // 创建新连接
325
+ return this.createSocket(customUrl);
128
326
  },
129
327
 
328
+ /**
329
+ * 关闭socket连接
330
+ */
130
331
  closeSocket() {
131
- if (app.api.socket && (app.api.socket.readyState === WebSocket.OPEN || app.api.socket.readyState === WebSocket.CONNECTING)) {
132
- app.api.socket.close();
133
- return true;
332
+ // 先停止心跳
333
+ this.stopPing();
334
+
335
+ if (this.socket) {
336
+ if (this.socket.readyState === WebSocket.OPEN || this.socket.readyState === WebSocket.CONNECTING) {
337
+ console.log('关闭WebSocket连接');
338
+ this.socket.close();
339
+ }
340
+ this.socket = null;
134
341
  }
135
- return false;
342
+
343
+ // 重置任务状态
344
+ this.taskRunning = false;
345
+
346
+ return true;
136
347
  },
137
348
 
138
- changeSocketUrl(newUrl, callback) {
139
- this.closeSocket();
349
+ /**
350
+ * 更改socket URL并创建新连接
351
+ */
352
+ changeSocketUrl(newUrl) {
140
353
  const clientId = sessionStorage.getItem("clientId");
141
- const socket = new WebSocket(newUrl + "?clientId=" + clientId + "&a=1");
142
- const send = app.api.socket.send;
143
- const onopen = app.api.socket.onopen;
144
- const onmessage = app.api.socket.onmessage;
145
- const onerror = app.api.socket.onerror;
146
- const onclose = app.api.socket.onclose;
147
-
148
- app.api.socket = socket;
149
- app.api.socket.send = send;
150
- app.api.socket.onopen = onopen;
151
- app.api.socket.onmessage = onmessage;
152
- app.api.socket.onerror = onerror;
153
- app.api.socket.onclose = onclose;
354
+ const fullUrl = newUrl + "?clientId=" + clientId + "&a=1";
355
+
356
+ return this.createSocket(fullUrl);
357
+ },
154
358
 
155
- if (typeof callback === 'function') {
156
- callback(socket);
359
+ /**
360
+ * 发送socket消息
361
+ * 确保连接已就绪
362
+ */
363
+ async sendSocketMessage(message) {
364
+ try {
365
+ const socket = await this.getSocketAsync();
366
+ if (socket && socket.readyState === WebSocket.OPEN) {
367
+ socket.send(typeof message === 'string' ? message : JSON.stringify(message));
368
+ return true;
369
+ }
370
+ return false;
371
+ } catch (error) {
372
+ console.error('发送消息失败:', error);
373
+ return false;
157
374
  }
158
-
159
- return socket;
160
375
  },
161
376
 
162
- sendSocketMessage(message) {
163
- if (app.api.socket && app.api.socket.readyState === WebSocket.OPEN) {
164
- app.api.socket.send(typeof message === 'string' ? message : JSON.stringify(message));
377
+ /**
378
+ * 发送任务提示
379
+ */
380
+ async sendPrompt(prompt) {
381
+ try {
382
+ // 确保有连接
383
+ await this.getSocketAsync();
384
+ // 发送提示
385
+ app.queuePrompt(prompt);
165
386
  return true;
387
+ } catch (error) {
388
+ console.error('发送任务提示失败:', error);
389
+ return false;
166
390
  }
167
- return false;
168
- },
169
-
170
- sendPrompt(prompt) {
171
- app.queuePrompt(prompt);
172
391
  },
392
+
173
393
  getCookie(name) {
174
394
  const value = `; ${document.cookie}`;
175
395
  const parts = value.split(`; ${name}=`);
176
396
  if (parts.length === 2) return parts.pop().split(';').shift();
177
397
  },
178
398
 
179
-
180
399
  async setup() {
181
-
182
-
183
- const customSocket = this.customSocket.bind(this);
184
- const startSocket = this.startSocket.bind(this);
400
+ const createSocket = this.createSocket.bind(this);
401
+ const getSocket = this.getSocket.bind(this);
402
+ const getSocketAsync = this.getSocketAsync.bind(this);
185
403
  const closeSocket = this.closeSocket.bind(this);
186
404
  const changeSocketUrl = this.changeSocketUrl.bind(this);
187
405
  const sendSocketMessage = this.sendSocketMessage.bind(this);
406
+ const sendPrompt = this.sendPrompt.bind(this);
407
+ const startPing = this.startPing.bind(this);
408
+ const stopPing = this.stopPing.bind(this);
188
409
 
189
- // 设置节点事件
190
- // setupNodeEvents();
191
-
410
+ // 方法映射
192
411
  const methods = {
193
- customSocket: function (params) {
194
- const callback = params.callback ? new Function('socket', params.callback) : null;
195
- const socket = customSocket(callback, params.url);
412
+ customSocket: async function (params) {
413
+ const socket = createSocket(params.url);
196
414
  window.parent.postMessage({
197
415
  type: 'functionResult',
198
416
  method: 'customSocket',
@@ -201,15 +419,24 @@ app.registerExtension({
201
419
  return socket;
202
420
  },
203
421
 
204
- startSocket: function (params) {
205
- const callback = params.callback ? new Function('socket', params.callback) : null;
206
- const socket = startSocket(callback);
207
- window.parent.postMessage({
208
- type: 'functionResult',
209
- method: 'startSocket',
210
- result: 'Socket连接已启动'
211
- }, '*');
212
- return socket;
422
+ startSocket: async function (params) {
423
+ try {
424
+ const socket = await getSocketAsync(params.url);
425
+ window.parent.postMessage({
426
+ type: 'functionResult',
427
+ method: 'startSocket',
428
+ result: 'Socket连接已启动'
429
+ }, '*');
430
+ return socket;
431
+ } catch (error) {
432
+ window.parent.postMessage({
433
+ type: 'functionResult',
434
+ method: 'startSocket',
435
+ result: 'Socket连接失败: ' + error.message,
436
+ error: true
437
+ }, '*');
438
+ return null;
439
+ }
213
440
  },
214
441
 
215
442
  closeSocket: function () {
@@ -227,8 +454,7 @@ app.registerExtension({
227
454
  console.error('缺少url参数');
228
455
  return false;
229
456
  }
230
- const callback = params.callback ? new Function('socket', params.callback) : null;
231
- const socket = changeSocketUrl(params.url, callback);
457
+ const socket = changeSocketUrl(params.url);
232
458
  window.parent.postMessage({
233
459
  type: 'functionResult',
234
460
  method: 'changeSocketUrl',
@@ -237,12 +463,12 @@ app.registerExtension({
237
463
  return socket;
238
464
  },
239
465
 
240
- sendSocketMessage: function (params) {
466
+ sendSocketMessage: async function (params) {
241
467
  if (!params.message) {
242
468
  console.error('缺少message参数');
243
469
  return false;
244
470
  }
245
- const result = sendSocketMessage(params.message);
471
+ const result = await sendSocketMessage(params.message);
246
472
  window.parent.postMessage({
247
473
  type: 'functionResult',
248
474
  method: 'sendSocketMessage',
@@ -314,20 +540,34 @@ app.registerExtension({
314
540
  return clientId;
315
541
  },
316
542
  runWorkflow: async function () {
317
- const graph = await app.graphToPrompt();
318
- const res = await app.queuePrompt(graph.output);
319
- console.log("-----------queuePrompt-----------", res)
320
- const clientId = sessionStorage.getItem("clientId");
321
- window.parent.postMessage({
322
- type: 'functionResult',
323
- method: 'runWorkflow',
324
- result: {
325
- clientId: clientId,
326
- jsonWorkflow: graph.output,
327
- workflow: graph.workflow
328
- }
329
- }, '*');
330
- return true;
543
+ try {
544
+ // 确保有连接
545
+ await getSocketAsync();
546
+
547
+ const graph = await app.graphToPrompt();
548
+ const res = await app.queuePrompt(graph.output);
549
+ console.log("-----------queuePrompt-----------", res)
550
+ const clientId = sessionStorage.getItem("clientId");
551
+ window.parent.postMessage({
552
+ type: 'functionResult',
553
+ method: 'runWorkflow',
554
+ result: {
555
+ clientId: clientId,
556
+ jsonWorkflow: graph.output,
557
+ workflow: graph.workflow
558
+ }
559
+ }, '*');
560
+ return true;
561
+ } catch (error) {
562
+ console.error('运行工作流失败:', error);
563
+ window.parent.postMessage({
564
+ type: 'functionResult',
565
+ method: 'runWorkflow',
566
+ error: '运行工作流失败: ' + error.message,
567
+ success: false
568
+ }, '*');
569
+ return false;
570
+ }
331
571
  },
332
572
  setCookie: function (params) {
333
573
  const setCookie = (name, value, days) => {
@@ -342,12 +582,11 @@ app.registerExtension({
342
582
  console.log("-----------setCookie-----------", params)
343
583
  setCookie(params.name, params.value, params.days);
344
584
 
585
+
345
586
  return true;
346
587
  },
347
588
  fitView: function () {
348
-
349
589
  app.canvas.fitViewToSelectionAnimated()
350
-
351
590
  window.parent.postMessage({
352
591
  type: 'functionResult',
353
592
  method: 'fitView',
@@ -403,7 +642,8 @@ app.registerExtension({
403
642
  }, '*');
404
643
  return graph.workflow;
405
644
 
406
- }
645
+ },
646
+
407
647
  };
408
648
 
409
649
  window.addEventListener('message', function (event) {
@@ -412,6 +652,7 @@ app.registerExtension({
412
652
  const params = event.data.params || {};
413
653
 
414
654
 
655
+
415
656
  if (methods[methodName]) {
416
657
  methods[methodName](params);
417
658
  } else {
@@ -422,6 +663,12 @@ app.registerExtension({
422
663
  error: `方法 ${methodName} 不存在`,
423
664
  success: false
424
665
  }, '*');
666
+ window.parent.postMessage({
667
+ type: 'functionResult',
668
+ method: methodName,
669
+ error: `方法 ${methodName} 不存在`,
670
+ success: false
671
+ }, '*');
425
672
  }
426
673
  }
427
674
  });
@@ -12,7 +12,7 @@ export async function fileToOss(file) {
12
12
  }
13
13
 
14
14
  // 获取上传凭证
15
- const uploadToken = await fetch(`${apiHost}/community/upload_token?file_name=${encodeURIComponent(file.name)}&file_type=inputs`, {
15
+ const uploadToken = await fetch(`${apiHost}/special/community/upload_token?file_name=${encodeURIComponent(file.name)}&file_type=inputs`, {
16
16
  method: 'GET',
17
17
  headers: {
18
18
  'Content-Type': 'application/json',
@@ -103,7 +103,7 @@ export async function fileToOss(file) {
103
103
  const fileUrl = `${host}/${ossConfig.objectKey}`;
104
104
 
105
105
  // 提交资源
106
- await fetch(`${apiHost}/community/commit_input_resource`, {
106
+ await fetch(`${apiHost}/special/community/commit_input_resource`, {
107
107
  method: 'POST',
108
108
  headers: {
109
109
  'Content-Type': 'application/json',
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bizydraft
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: bizydraft
@@ -0,0 +1,16 @@
1
+ bizydraft/__init__.py,sha256=OM-sKCQrPh25nHVJIX-DgF1raMYyoWLSuyduIAHt0Gs,78
2
+ bizydraft/hijack_nodes.py,sha256=xPVLBBnRiJaI8ZbR80O8W4C9SlNAp7MxP7dKj_pRlYs,869
3
+ bizydraft/hijack_routes.py,sha256=tzSIY-3wLiwoHALf7MswjAF5FqDSmXynGjpfTgRdkxE,6138
4
+ bizydraft/resp.py,sha256=8INvKOe5Dgai3peKfqKjrhUoYeuXWXn358w30-_cY-A,369
5
+ bizydraft/server.py,sha256=ES1fBYr_Ufv_YWsynLck1ln9bXTGjK3KXas1CK9WBqM,1358
6
+ bizydraft/static/js/handleStyle.js,sha256=vIR_W3GLKn-saIPhKfLeuJ7QbeNI4PhjAkjGjJpxVcA,1461
7
+ bizydraft/static/js/hookLoadImage.js,sha256=rcXKi9y88n0gfad6XERr5UcP8c0zOUdaVyk3lbhiQSY,3951
8
+ bizydraft/static/js/main.js,sha256=cZ-7wR9T8aNLzIrTjc-g9xVZf7z6TXWl1zhP_wXSSVo,150
9
+ bizydraft/static/js/postEvent.js,sha256=rWRM0uE26PDxinT1IL8I22mDCg9zE84vbZdI689DJyY,25605
10
+ bizydraft/static/js/socket.js,sha256=q_SWsySJdVV7ZTH-3Pdr09pkWGQj08C9xVAQES7eJaU,2440
11
+ bizydraft/static/js/tool.js,sha256=IlDVjddodT9DtfdIGiIzSIKdxbUMztDLQ4jI0uFJCwk,206
12
+ bizydraft/static/js/uploadFile.js,sha256=Ae0VdYRE3c1bx1GBQGUpJ-NOXXB984u3T_grhLXOvgQ,4973
13
+ bizydraft-0.1.10.dist-info/METADATA,sha256=nu5LH4qFAmxswzm10nkXzP1pePRmGlhkStq92ipPZxw,73
14
+ bizydraft-0.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ bizydraft-0.1.10.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
16
+ bizydraft-0.1.10.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- bizydraft/__init__.py,sha256=OM-sKCQrPh25nHVJIX-DgF1raMYyoWLSuyduIAHt0Gs,78
2
- bizydraft/hijack_nodes.py,sha256=xPVLBBnRiJaI8ZbR80O8W4C9SlNAp7MxP7dKj_pRlYs,869
3
- bizydraft/hijack_routes.py,sha256=tzSIY-3wLiwoHALf7MswjAF5FqDSmXynGjpfTgRdkxE,6138
4
- bizydraft/resp.py,sha256=8INvKOe5Dgai3peKfqKjrhUoYeuXWXn358w30-_cY-A,369
5
- bizydraft/server.py,sha256=ES1fBYr_Ufv_YWsynLck1ln9bXTGjK3KXas1CK9WBqM,1358
6
- bizydraft/static/js/handleStyle.js,sha256=WDaMQSaZrij10pyXbQ3jinWjhb6iTt_6iQclgbnr3qc,1167
7
- bizydraft/static/js/hookLoadImage.js,sha256=cEaqedTnngieI-Kb0PVgLor1nVDkFQx1_7AiurwtRwI,3878
8
- bizydraft/static/js/main.js,sha256=cZ-7wR9T8aNLzIrTjc-g9xVZf7z6TXWl1zhP_wXSSVo,150
9
- bizydraft/static/js/postEvent.js,sha256=cmwycxslbbvRAvzT0Vp_rVZh46WNrskcQydcmTrsnw8,16809
10
- bizydraft/static/js/socket.js,sha256=q_SWsySJdVV7ZTH-3Pdr09pkWGQj08C9xVAQES7eJaU,2440
11
- bizydraft/static/js/tool.js,sha256=IlDVjddodT9DtfdIGiIzSIKdxbUMztDLQ4jI0uFJCwk,206
12
- bizydraft/static/js/uploadFile.js,sha256=7PXMYRlgxgDWFFbsaasjf3TelsW6r9mD1TFTjQI6X0E,4957
13
- bizydraft-0.1.8.dist-info/METADATA,sha256=0V9HmiDXuwHhrmxQO0vqlTz5cL6JRzxriV-vhERD5uQ,72
14
- bizydraft-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- bizydraft-0.1.8.dist-info/top_level.txt,sha256=XtoBq6hjZhXIM7aas4GtPDtAiKo8FdLzMABXW8qqQ8M,10
16
- bizydraft-0.1.8.dist-info/RECORD,,