@innovastudio/contentbox 1.6.102 → 1.6.103

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.
package/index.d.ts CHANGED
@@ -314,6 +314,7 @@ interface ContentBoxOptions {
314
314
  commandList?: any[];
315
315
  commandInfo?: any[];
316
316
  commandInfoCanvasMode?: any[];
317
+ onStartRequest?: () => void;
317
318
  }
318
319
 
319
320
  declare class ContentBox {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.102",
4
+ "version": "1.6.103",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "types": "index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "ws": "^8.13.0"
55
55
  },
56
56
  "dependencies": {
57
- "@innovastudio/contentbuilder": "^1.5.99",
57
+ "@innovastudio/contentbuilder": "^1.5.101",
58
58
  "js-beautify": "^1.14.0",
59
59
  "sortablejs": "^1.15.2"
60
60
  }
@@ -76260,10 +76260,13 @@ class Module {
76260
76260
  let btnOk = moduleModal.querySelector('.input-ok');
76261
76261
  dom.addEventListener(btnOk, 'click', () => {
76262
76262
  let modalIframe = moduleModal.querySelector('iframe');
76263
- if (modalIframe.contentWindow.construct) modalIframe.contentWindow.construct();
76263
+ if (modalIframe.contentWindow.construct) modalIframe.contentWindow.construct(); // transfer module code to hidContentModuleCode & hidContentModuleSettings for saving
76264
+
76264
76265
  this.builder.uo.saveForUndo();
76265
76266
  let module = this.builder.activeModule;
76266
76267
 
76268
+ // The saving (saved in data attributes)
76269
+
76267
76270
  //Save Html (original)
76268
76271
  module.setAttribute('data-html', encodeURIComponent(builderStuff.querySelector('#hidContentModuleCode').value));
76269
76272
 
@@ -112989,6 +112992,7 @@ ${answer}
112989
112992
  let temperature = localStorage.getItem('_temp') || this.builder.temperature;
112990
112993
  let topP = localStorage.getItem('_top_p') || this.builder.topP;
112991
112994
  let num = 1;
112995
+ if (this.builder.settings.onStartRequest) this.builder.settings.onStartRequest();
112992
112996
  const messages = {
112993
112997
  question,
112994
112998
  context,
@@ -112996,8 +113000,12 @@ ${answer}
112996
113000
  functs,
112997
113001
  temperature,
112998
113002
  topP,
112999
- num
113003
+ num,
113004
+ metadata: this.builder.settings.metadata || {}
113000
113005
  };
113006
+
113007
+ // console.log(messages);
113008
+
113001
113009
  try {
113002
113010
  /*
113003
113011
  const response = await fetch(this.builder.sendCommandUrl, {
@@ -123889,6 +123897,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
123889
123897
  }
123890
123898
  this.ai_width = width;
123891
123899
  this.ai_height = height;
123900
+ if (this.settings.onStartRequest) this.settings.onStartRequest();
123892
123901
  const messages = {
123893
123902
  model,
123894
123903
  prompt: prompt,
@@ -123899,8 +123908,12 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
123899
123908
  guidance,
123900
123909
  scheduler,
123901
123910
  output_format: 'jpeg',
123902
- folder_path: ''
123911
+ folder_path: '',
123912
+ metadata: this.settings.metadata || {}
123903
123913
  };
123914
+
123915
+ // console.log(messages);
123916
+
123904
123917
  try {
123905
123918
  let url = this.textToImageUrl;
123906
123919
  let headers = {
@@ -151802,6 +151815,7 @@ ${currentHtml}
151802
151815
  let temperature = localStorage.getItem('_temp') || this.builder.temperature;
151803
151816
  let topP = localStorage.getItem('_top_p') || this.builder.topP;
151804
151817
  let num = 1;
151818
+ if (this.builder.settings.onStartRequest) this.builder.settings.onStartRequest();
151805
151819
  const messages = {
151806
151820
  question,
151807
151821
  context,
@@ -151809,8 +151823,9 @@ ${currentHtml}
151809
151823
  functs,
151810
151824
  temperature,
151811
151825
  topP,
151812
- num
151813
- };
151826
+ num,
151827
+ metadata: this.builder.settings.metadata || {}
151828
+ }; // console.log(messages);
151814
151829
 
151815
151830
  try {
151816
151831
  /*
@@ -159813,6 +159828,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
159813
159828
 
159814
159829
  editorSetup() {
159815
159830
  this.editor = new ContentBuilder({
159831
+ onStartRequest: this.settings.onStartRequest,
159816
159832
  controlPanel: this.settings.controlPanel,
159817
159833
  canvas: this.settings.canvas,
159818
159834
  docContainer: this.settings.wrapper,