@innovastudio/contentbox 1.5.71 → 1.5.73
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/public/contentbox/contentbox.esm.js +247 -57
- package/public/contentbox/contentbox.min.js +2 -2
- package/readme.txt +29 -42
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@innovastudio/contentbox",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.5.
|
4
|
+
"version": "1.5.73",
|
5
5
|
"description": "",
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
7
7
|
"files": [
|
@@ -50,7 +50,7 @@
|
|
50
50
|
"ws": "^8.13.0"
|
51
51
|
},
|
52
52
|
"dependencies": {
|
53
|
-
"@innovastudio/contentbuilder": "^1.4.
|
53
|
+
"@innovastudio/contentbuilder": "^1.4.89",
|
54
54
|
"js-beautify": "^1.14.0"
|
55
55
|
}
|
56
56
|
}
|
@@ -94467,7 +94467,7 @@ class ContentBuilder {
|
|
94467
94467
|
speechRecognitionLang: 'en-US',
|
94468
94468
|
assistantMode: 'general',
|
94469
94469
|
triggerWords: {
|
94470
|
-
send: ['send', 'okay', 'execute', 'run'],
|
94470
|
+
send: ['send', 'okay', 'ok', 'execute', 'run'],
|
94471
94471
|
abort: ['abort', 'cancel'],
|
94472
94472
|
clear: ['clear', 'erase']
|
94473
94473
|
},
|
@@ -106797,7 +106797,7 @@ Example:
|
|
106797
106797
|
</div>
|
106798
106798
|
<div class="row">
|
106799
106799
|
<div class="column">
|
106800
|
-
<div class="spacer height-
|
106800
|
+
<div class="spacer height-60"></div>
|
106801
106801
|
</div>
|
106802
106802
|
</div>
|
106803
106803
|
<div class="row">
|
@@ -107016,7 +107016,7 @@ Example:
|
|
107016
107016
|
</div>
|
107017
107017
|
<div class="row">
|
107018
107018
|
<div class="column">
|
107019
|
-
<div class="spacer height-
|
107019
|
+
<div class="spacer height-60"></div>
|
107020
107020
|
</div>
|
107021
107021
|
</div>
|
107022
107022
|
<div class="row relative sm-items-1">
|
@@ -107106,9 +107106,9 @@ To create a section with a list of photos or a photo gallery:
|
|
107106
107106
|
|
107107
107107
|
Example:
|
107108
107108
|
|
107109
|
-
<div class="is-section is-box is-section-100 box-autofit type-poppins
|
107109
|
+
<div class="is-section is-box is-section-100 box-autofit type-poppins">
|
107110
107110
|
<div class="is-overlay"></div>
|
107111
|
-
<div class="is-container v2 leading-13 is-content-1640 size-
|
107111
|
+
<div class="is-container v2 leading-13 is-content-1640 size-16">
|
107112
107112
|
<div class="row">
|
107113
107113
|
<div class="column">
|
107114
107114
|
<h1 class="font-light size-54 leading-none">We deliver extraordinary things.</h1>
|
@@ -107119,18 +107119,21 @@ Example:
|
|
107119
107119
|
</div>
|
107120
107120
|
<div class="row">
|
107121
107121
|
<div class="column">
|
107122
|
-
<div class="spacer height-
|
107122
|
+
<div class="spacer height-80"></div>
|
107123
107123
|
</div>
|
107124
107124
|
</div>
|
107125
107125
|
<div class="row">
|
107126
107126
|
<div class="column"><img src="{{IMAGEURL}}" alt="" data-filename="img-024.jpg">
|
107127
|
-
<
|
107127
|
+
<h3 class="font-normal leading-11 size-36 size-24">Image title</h3>
|
107128
|
+
<p>Paragraph here</p>
|
107128
107129
|
</div>
|
107129
107130
|
<div class="column"><img src="{{IMAGEURL}}" alt="" data-filename="img-083.jpg">
|
107130
|
-
<
|
107131
|
+
<h3 class="font-normal leading-11 size-36 size-24">Image title</h3>
|
107132
|
+
<p>Paragraph here</p>
|
107131
107133
|
</div>
|
107132
107134
|
<div class="column"><img src="{{IMAGEURL}}" alt="" data-filename="img-190.jpg">
|
107133
|
-
<
|
107135
|
+
<h3 class="font-normal leading-11 size-36 size-24">Image title</h3>
|
107136
|
+
<p>Paragraph here</p>
|
107134
107137
|
</div>
|
107135
107138
|
</div>
|
107136
107139
|
</div>
|
@@ -107173,6 +107176,76 @@ Example:
|
|
107173
107176
|
</div>
|
107174
107177
|
|
107175
107178
|
`],
|
107179
|
+
short_content: `This is the template:
|
107180
|
+
|
107181
|
+
<div class="is-section is-box type-poppins box-autofit min-height-60 is-section-100">
|
107182
|
+
<div class="is-overlay"></div>
|
107183
|
+
<div class="is-container v2 leading-13 size-19 is-content-800 content-pt-60 content-pb-60">
|
107184
|
+
<div class="row">
|
107185
|
+
<div class="column">
|
107186
|
+
<p class="size-32">{{CONTENT}}</p>
|
107187
|
+
</div>
|
107188
|
+
</div>
|
107189
|
+
</div>
|
107190
|
+
</div>
|
107191
|
+
|
107192
|
+
`,
|
107193
|
+
new_section_answer: `This is the template:
|
107194
|
+
|
107195
|
+
<div class="is-section is-box type-poppins box-autofit min-height-60 is-section-100">
|
107196
|
+
<div class="is-overlay"></div>
|
107197
|
+
<div class="is-container v2 leading-13 size-19 is-content-800 content-pt-60 content-pb-60">
|
107198
|
+
<div class="row">
|
107199
|
+
<div class="column">
|
107200
|
+
<div class="spacer height-100"></div>
|
107201
|
+
</div>
|
107202
|
+
</div>
|
107203
|
+
<div class="row">
|
107204
|
+
<div class="column">
|
107205
|
+
<h1 class="font-normal leading-11 size-64">{{TITLE}}</h1>
|
107206
|
+
</div>
|
107207
|
+
</div>
|
107208
|
+
<div class="row">
|
107209
|
+
<div class="column">
|
107210
|
+
<div class="spacer height-20"></div>
|
107211
|
+
</div>
|
107212
|
+
</div>
|
107213
|
+
<div class="row">
|
107214
|
+
<div class="column">
|
107215
|
+
<p>{{CONTENT}}</p>
|
107216
|
+
</div>
|
107217
|
+
</div>
|
107218
|
+
<div class="row">
|
107219
|
+
<div class="column">
|
107220
|
+
<div class="spacer height-20"></div>
|
107221
|
+
</div>
|
107222
|
+
</div>
|
107223
|
+
<div class="row">
|
107224
|
+
<div class="column">
|
107225
|
+
<h2>{{SUBTITLE}}</h2>
|
107226
|
+
<p>{{CONTENT}}</p>
|
107227
|
+
</div>
|
107228
|
+
</div>
|
107229
|
+
<div class="row">
|
107230
|
+
<div class="column">
|
107231
|
+
<div class="spacer height-20"></div>
|
107232
|
+
</div>
|
107233
|
+
</div>
|
107234
|
+
<div class="row">
|
107235
|
+
<div class="column">
|
107236
|
+
<h2>{{SUBTITLE}}</h2>
|
107237
|
+
<p>{{CONTENT}}</p>
|
107238
|
+
</div>
|
107239
|
+
</div>
|
107240
|
+
<div class="row">
|
107241
|
+
<div class="column">
|
107242
|
+
<div class="spacer height-20"></div>
|
107243
|
+
</div>
|
107244
|
+
</div>
|
107245
|
+
</div>
|
107246
|
+
</div>
|
107247
|
+
|
107248
|
+
`,
|
107176
107249
|
new_section_others: `Use one of these templates that is more suitable:
|
107177
107250
|
|
107178
107251
|
|
@@ -109438,7 +109511,12 @@ class Lib {
|
|
109438
109511
|
properties: {
|
109439
109512
|
asking_info: {
|
109440
109513
|
type: 'boolean',
|
109441
|
-
description: 'User request an information'
|
109514
|
+
description: 'User request an information.'
|
109515
|
+
},
|
109516
|
+
add_info: {
|
109517
|
+
// Without this, adding info will be considered as asking_info. Tha add_info should be the same as change_text
|
109518
|
+
type: 'boolean',
|
109519
|
+
description: 'User request an information to be added to the current content.'
|
109442
109520
|
},
|
109443
109521
|
|
109444
109522
|
/*
|
@@ -109458,11 +109536,11 @@ class Lib {
|
|
109458
109536
|
},
|
109459
109537
|
change_text: {
|
109460
109538
|
type: 'boolean',
|
109461
|
-
description: 'User explicitely requests to update text of the current content, rewrite, paraphrase or change text.'
|
109539
|
+
description: 'User explicitely requests to update text of the current content, rewrite, paraphrase, translate or change text.'
|
109462
109540
|
},
|
109463
109541
|
write_based_on_the_current_content: {
|
109464
109542
|
type: 'boolean',
|
109465
|
-
description: 'User request create new content based on the current content, such as to summarize, expand, make short,
|
109543
|
+
description: 'User request to create new content based on the current content, such as to summarize, expand, make short, create a tweet or social media post, etc'
|
109466
109544
|
},
|
109467
109545
|
change_style: {
|
109468
109546
|
type: 'boolean',
|
@@ -109710,9 +109788,17 @@ class Lib {
|
|
109710
109788
|
|
109711
109789
|
elementContext(context, args) {
|
109712
109790
|
if (args.add_headline) {
|
109713
|
-
let info = `- To add a headline, use this class: 'font-normal leading-11 size-64':
|
109791
|
+
let info = `- To add a headline or title, use this class: 'font-normal leading-11 size-64':
|
109714
109792
|
<h1 class="font-normal leading-11 size-64">Headline Text Here</h1>
|
109715
109793
|
|
109794
|
+
`;
|
109795
|
+
context = context + '\n' + info;
|
109796
|
+
}
|
109797
|
+
|
109798
|
+
if (args.add_paragraph) {
|
109799
|
+
let info = `- To add a paragraph (long or short), just add:
|
109800
|
+
<p>Paragraph here</p>
|
109801
|
+
|
109716
109802
|
`;
|
109717
109803
|
context = context + '\n' + info;
|
109718
109804
|
}
|
@@ -109805,7 +109891,9 @@ Button Example:
|
|
109805
109891
|
|
109806
109892
|
if (args.add_image) {
|
109807
109893
|
// to differentiate from bg image
|
109808
|
-
let info = `- To add an image,
|
109894
|
+
let info = `- To add an image, just add <img> element inside 'div.columns' element:
|
109895
|
+
|
109896
|
+
<img src="{{IMAGEURL}}">
|
109809
109897
|
|
109810
109898
|
`;
|
109811
109899
|
context = context + '\n' + info;
|
@@ -110853,19 +110941,26 @@ Example: To create a block with a headline and a paragraph:
|
|
110853
110941
|
`;
|
110854
110942
|
} else if (args.new_column_onright || args.new_column_onleft) {
|
110855
110943
|
systemCmd = 'You will be asked to create content (in HTML) and return the HTML without any additional explanation.';
|
110856
|
-
context = `To add a column
|
110857
|
-
- Create
|
110944
|
+
context = `To add a column that contains a content:
|
110945
|
+
- Create one 'div.column' element and add the content inside it:
|
110858
110946
|
|
110859
110947
|
<div class="column">
|
110860
110948
|
{{CONTENT}}
|
110861
110949
|
</div>
|
110862
110950
|
|
110863
|
-
Example: To create a column with a headline and a paragraph:
|
110951
|
+
Example 1: To create a column with a headline and a paragraph:
|
110864
110952
|
|
110865
110953
|
<div class="column">
|
110866
110954
|
<h2 class="font-normal leading-none size-48">Heading here</h2>
|
110867
110955
|
<p>Paragraph here.</p>
|
110868
110956
|
</div>
|
110957
|
+
|
110958
|
+
|
110959
|
+
Example 2: To create a column with an image:
|
110960
|
+
|
110961
|
+
<div class="column">
|
110962
|
+
<img src="{{IMAGEURL}}">
|
110963
|
+
</div>
|
110869
110964
|
|
110870
110965
|
`;
|
110871
110966
|
} else {
|
@@ -110896,6 +110991,10 @@ ${blockContent}
|
|
110896
110991
|
return false;
|
110897
110992
|
}
|
110898
110993
|
|
110994
|
+
if (args.new_column_onright || args.new_column_onleft) {
|
110995
|
+
html = this.fixNewBlock(answer);
|
110996
|
+
}
|
110997
|
+
|
110899
110998
|
this.builder.editor.saveForUndo();
|
110900
110999
|
|
110901
111000
|
if (args.new_block) {
|
@@ -110911,14 +111010,18 @@ ${blockContent}
|
|
110911
111010
|
}
|
110912
111011
|
} else if (args.new_column_onright) {
|
110913
111012
|
if (block) {
|
111013
|
+
const row = block.parentNode;
|
110914
111014
|
block.insertAdjacentHTML('afterend', html);
|
111015
|
+
this.builder.editor.util.fixLayout(row);
|
110915
111016
|
setTimeout(() => {
|
110916
111017
|
block.nextElementSibling.click();
|
110917
111018
|
}, 300);
|
110918
111019
|
}
|
110919
111020
|
} else if (args.new_column_onleft) {
|
110920
111021
|
if (block) {
|
111022
|
+
const row = block.parentNode;
|
110921
111023
|
block.insertAdjacentHTML('beforebegin', html);
|
111024
|
+
this.builder.editor.util.fixLayout(row);
|
110922
111025
|
setTimeout(() => {
|
110923
111026
|
block.previousElementSibling.click();
|
110924
111027
|
}, 300);
|
@@ -110949,19 +111052,40 @@ ${blockContent}
|
|
110949
111052
|
|
110950
111053
|
const sendOtherCommand = async question => {
|
110951
111054
|
let systemCmd = '';
|
110952
|
-
let context = 'You are a helpful assistant. You will provide direct answers without a prologue.';
|
111055
|
+
let context = 'You are a helpful assistant. You don\'t need to answer \'Sure!\' or \'Certainly\'. You will just provide direct answers without a prologue. No talk; just do.';
|
110953
111056
|
|
110954
111057
|
const callback = answer => {
|
110955
111058
|
if (this.builder.consoleLog) console.log(answer);
|
110956
|
-
let systemCmd = '';
|
110957
|
-
let question = `
|
111059
|
+
let systemCmd = 'You will be provided with a text content and your task is to put the content (completely) as it is in the provided template.';
|
111060
|
+
let question = `Place my content in the provided template. Ensure that all the content are placed in the result. Feel free to add more rows/columns if needed, but don't change/add/reduce the content.
|
111061
|
+
|
111062
|
+
This is my content:
|
110958
111063
|
|
110959
111064
|
${answer}
|
111065
|
+
`;
|
110960
111066
|
|
110961
|
-
|
110962
|
-
|
110963
|
-
|
110964
|
-
|
111067
|
+
const containsSingleSentence = text => {
|
111068
|
+
// Count the occurrences of dots (periods)
|
111069
|
+
const dotCount = (text.match(/\./g) || []).length; // If there's exactly one dot, it's likely a single sentence
|
111070
|
+
|
111071
|
+
return dotCount === 1;
|
111072
|
+
};
|
111073
|
+
|
111074
|
+
const countWords = str => {
|
111075
|
+
// Remove extra whitespaces and split the string into words
|
111076
|
+
const wordsArray = str.trim().split(/\s+/); // Return the count of words
|
111077
|
+
|
111078
|
+
return wordsArray.length;
|
111079
|
+
};
|
111080
|
+
|
111081
|
+
let context;
|
111082
|
+
if (this.builder.consoleLog) console.log(containsSingleSentence(answer), countWords(answer));
|
111083
|
+
|
111084
|
+
if (containsSingleSentence(answer) || countWords(answer) <= 100) {
|
111085
|
+
context = cl.short_content;
|
111086
|
+
} else {
|
111087
|
+
context = cl.new_section_answer;
|
111088
|
+
}
|
110965
111089
|
|
110966
111090
|
const callback = html => {
|
110967
111091
|
if (this.builder.consoleLog) console.log(html);
|
@@ -110979,9 +111103,21 @@ Please use this content to create a new section using the provided template.
|
|
110979
111103
|
this.dictation.finish();
|
110980
111104
|
};
|
110981
111105
|
|
111106
|
+
if (this.builder.consoleLog) {
|
111107
|
+
console.log(systemCmd);
|
111108
|
+
console.log(question);
|
111109
|
+
console.log(context);
|
111110
|
+
}
|
111111
|
+
|
110982
111112
|
this.sendCommand('html', question, context, systemCmd, [], callback);
|
110983
111113
|
};
|
110984
111114
|
|
111115
|
+
if (this.builder.consoleLog) {
|
111116
|
+
console.log(systemCmd);
|
111117
|
+
console.log(question);
|
111118
|
+
console.log(context);
|
111119
|
+
}
|
111120
|
+
|
110985
111121
|
this.sendCommand('assistant', question, context, systemCmd, [], callback);
|
110986
111122
|
};
|
110987
111123
|
|
@@ -111009,15 +111145,32 @@ ${currentHtml}
|
|
111009
111145
|
|
111010
111146
|
const callback = answer => {
|
111011
111147
|
if (this.builder.consoleLog) console.log(answer);
|
111012
|
-
|
111013
|
-
let question = `
|
111148
|
+
systemCmd = 'You will be provided with a text content and your task is to put the content (completely) as it is in the provided template.';
|
111149
|
+
let question = `Place my content in the provided template. Ensure that all the content are placed in the result. Feel free to add more rows/columns if needed, but don't change/add/reduce the content.
|
111150
|
+
|
111151
|
+
This is my content:
|
111014
111152
|
|
111015
111153
|
${answer}
|
111154
|
+
`;
|
111016
111155
|
|
111017
|
-
|
111018
|
-
|
111019
|
-
|
111020
|
-
|
111156
|
+
const containsSingleSentence = text => {
|
111157
|
+
const dotCount = (text.match(/\./g) || []).length;
|
111158
|
+
return dotCount === 1;
|
111159
|
+
};
|
111160
|
+
|
111161
|
+
const countWords = str => {
|
111162
|
+
const wordsArray = str.trim().split(/\s+/);
|
111163
|
+
return wordsArray.length;
|
111164
|
+
};
|
111165
|
+
|
111166
|
+
let context;
|
111167
|
+
if (this.builder.consoleLog) console.log(containsSingleSentence(answer), countWords(answer));
|
111168
|
+
|
111169
|
+
if (containsSingleSentence(answer) || countWords(answer) <= 100) {
|
111170
|
+
context = cl.short_content;
|
111171
|
+
} else {
|
111172
|
+
context = cl.new_section_answer;
|
111173
|
+
}
|
111021
111174
|
|
111022
111175
|
const callback = html => {
|
111023
111176
|
if (this.builder.consoleLog) console.log(html);
|
@@ -111035,6 +111188,12 @@ Place this content into the provided template. Adjust the template so that the c
|
|
111035
111188
|
this.dictation.finish();
|
111036
111189
|
};
|
111037
111190
|
|
111191
|
+
if (this.builder.consoleLog) {
|
111192
|
+
console.log(systemCmd);
|
111193
|
+
console.log(question);
|
111194
|
+
console.log(context);
|
111195
|
+
}
|
111196
|
+
|
111038
111197
|
this.sendCommand('html', question, context, systemCmd, [], callback);
|
111039
111198
|
};
|
111040
111199
|
|
@@ -111065,14 +111224,14 @@ Place this content into the provided template. Adjust the template so that the c
|
|
111065
111224
|
if (activeSection) {
|
111066
111225
|
if (activeSection.classList.contains('is-box')) sectionBox = true; // A single box section
|
111067
111226
|
}
|
111068
|
-
}
|
111227
|
+
} // if(this.builder.sendCommandUrl==='') return;
|
111228
|
+
|
111069
111229
|
|
111070
|
-
if (this.builder.sendCommandUrl === '') return;
|
111071
111230
|
this.sendCommand('analyze', `This is the command: "${question}"`, '', 'You will analyze the user\'s command and return what the user needs.', this.lib.getFunctions(), response => {
|
111072
111231
|
const args = JSON.parse(response);
|
111073
111232
|
if (this.builder.consoleLog) console.log(args);
|
111074
111233
|
|
111075
|
-
if (args.asking_info) {
|
111234
|
+
if (args.asking_info && !args.add_info) {
|
111076
111235
|
if (this.builder.consoleLog) console.log('asking_info');
|
111077
111236
|
sendOtherCommand(question);
|
111078
111237
|
return;
|
@@ -111364,15 +111523,7 @@ Place this content into the provided template. Adjust the template so that the c
|
|
111364
111523
|
|
111365
111524
|
let context = '';
|
111366
111525
|
|
111367
|
-
if (args.
|
111368
|
-
/*
|
111369
|
-
Handle Unrelated Request
|
111370
|
-
*/
|
111371
|
-
args.new_section = true;
|
111372
|
-
context = cl.cl.new_section_others; // Update prompt
|
111373
|
-
|
111374
|
-
question = `Add a new section containing your response on this user request: ${question}`;
|
111375
|
-
} else if (args.new_section || args.new_section_two_boxes || args.new_section_three_boxes || args.new_section_four_boxes) {
|
111526
|
+
if (args.new_section || args.new_section_two_boxes || args.new_section_three_boxes || args.new_section_four_boxes) {
|
111376
111527
|
if (args.new_section) {
|
111377
111528
|
if (args.add_image === 'gallery') {
|
111378
111529
|
context = cl.new_section_with_gallery;
|
@@ -111449,10 +111600,10 @@ Place this content into the provided template. Adjust the template so that the c
|
|
111449
111600
|
context = context.replaceAll('{{_IMAGEURL}}', imageUrl);
|
111450
111601
|
}
|
111451
111602
|
} else {
|
111452
|
-
context = this.chooseContext(cl.new_section_article);
|
111603
|
+
context = this.chooseContext(cl.new_section_article); // Or use: context = cl.new_section_others;
|
111453
111604
|
}
|
111454
111605
|
} else {
|
111455
|
-
//if(args.redesign_layout || args.change_text || args.change_style) {
|
111606
|
+
//if(args.redesign_layout || args.change_text || args.change_style || args.add_info) {
|
111456
111607
|
if (!this.checkSelectedContent(activeBox)) {
|
111457
111608
|
this.dictation.finish(true);
|
111458
111609
|
return;
|
@@ -113682,6 +113833,24 @@ ${currentHtml}
|
|
113682
113833
|
return html;
|
113683
113834
|
}
|
113684
113835
|
|
113836
|
+
fixNewBlock(html) {
|
113837
|
+
// Fix icons
|
113838
|
+
const replacementClass = 'ion-checkmark';
|
113839
|
+
const regexPattern = /(<i class="icon )(ion-\S+)/g;
|
113840
|
+
html = html.replace(regexPattern, `$1${replacementClass}`);
|
113841
|
+
const parser = new DOMParser();
|
113842
|
+
let doc = parser.parseFromString(html, 'text/html'); // Fix embedded images
|
113843
|
+
|
113844
|
+
const gallery = this.builder.media.images;
|
113845
|
+
const imageList = gallery.square;
|
113846
|
+
const imageUrl = this.lib.chooseMedia(imageList);
|
113847
|
+
const imgs = doc.querySelectorAll('img');
|
113848
|
+
imgs.forEach(img => {
|
113849
|
+
img.setAttribute('src', imageUrl);
|
113850
|
+
});
|
113851
|
+
return doc.documentElement.innerHTML;
|
113852
|
+
}
|
113853
|
+
|
113685
113854
|
fixHtmlBlock(html) {
|
113686
113855
|
html = this.getHtmlBlock(html);
|
113687
113856
|
|
@@ -113888,16 +114057,33 @@ ${currentHtml}
|
|
113888
114057
|
};
|
113889
114058
|
|
113890
114059
|
try {
|
114060
|
+
/*
|
113891
114061
|
const response = await fetch(this.builder.sendCommandUrl, {
|
113892
|
-
|
113893
|
-
|
113894
|
-
|
113895
|
-
|
113896
|
-
|
113897
|
-
|
113898
|
-
body: JSON.stringify(messages)
|
114062
|
+
signal: this.signal, // Abort
|
114063
|
+
method: 'POST',
|
114064
|
+
headers: {
|
114065
|
+
'Content-Type': 'application/json',
|
114066
|
+
},
|
114067
|
+
body: JSON.stringify(messages),
|
113899
114068
|
});
|
113900
|
-
|
114069
|
+
const data = await response.json();
|
114070
|
+
*/
|
114071
|
+
let data;
|
114072
|
+
|
114073
|
+
if (this.builder.sendCommand) {
|
114074
|
+
data = await this.builder.sendCommand(messages);
|
114075
|
+
} else {
|
114076
|
+
const response = await fetch(this.builder.sendCommandUrl, {
|
114077
|
+
signal: this.signal,
|
114078
|
+
// Abort
|
114079
|
+
method: 'POST',
|
114080
|
+
headers: {
|
114081
|
+
'Content-Type': 'application/json'
|
114082
|
+
},
|
114083
|
+
body: JSON.stringify(messages)
|
114084
|
+
});
|
114085
|
+
data = await response.json();
|
114086
|
+
}
|
113901
114087
|
|
113902
114088
|
if (data.error) {
|
113903
114089
|
// Error response from OpenAI goes here.
|
@@ -113930,6 +114116,8 @@ ${currentHtml}
|
|
113930
114116
|
callback(answer);
|
113931
114117
|
});
|
113932
114118
|
} else {
|
114119
|
+
// mode===analyze
|
114120
|
+
|
113933
114121
|
/*
|
113934
114122
|
Handle Unrelated Request
|
113935
114123
|
If OpenAI Function Call stopped (when user is asking unrelated things), it returns:
|
@@ -117094,6 +117282,7 @@ class ContentBox {
|
|
117094
117282
|
speechTranscribeUrl: '',
|
117095
117283
|
// http://localhost:8081
|
117096
117284
|
autoSendDelay: 4000,
|
117285
|
+
// sendCommand: async (message)=>{ },
|
117097
117286
|
onlineDemo: false,
|
117098
117287
|
startAIAssistant: false,
|
117099
117288
|
temperature: 0.6,
|
@@ -117113,7 +117302,7 @@ class ContentBox {
|
|
117113
117302
|
enableShortCommands: true,
|
117114
117303
|
speechRecognitionLang: 'en-US',
|
117115
117304
|
triggerWords: {
|
117116
|
-
send: ['send', 'okay', 'execute', 'run'],
|
117305
|
+
send: ['send', 'okay', 'ok', 'execute', 'run'],
|
117117
117306
|
abort: ['abort', 'cancel'],
|
117118
117307
|
clear: ['clear', 'erase']
|
117119
117308
|
},
|
@@ -117129,7 +117318,7 @@ class ContentBox {
|
|
117129
117318
|
maps: ['https://www.youtube-nocookie.com/embed/P5yHEKqx86U?rel=0&autoplay=1&color=white'],
|
117130
117319
|
audios: ['example.mp3'],
|
117131
117320
|
images: {
|
117132
|
-
square: ['person-01.jpg', 'person-02.jpg', 'person-03.jpg', 'person-04.jpg', 'person-05.jpg', 'person-06.jpg', 'person-08.jpg']
|
117321
|
+
square: ['desk.jpg', 'chair.jpg', 'coffee.jpg', 'product.jpg', 'table.jpg', 'person-01.jpg', 'person-02.jpg', 'person-03.jpg', 'person-04.jpg', 'person-05.jpg', 'person-06.jpg', 'person-08.jpg']
|
117133
117322
|
},
|
117134
117323
|
bg_images: {
|
117135
117324
|
box: ['person-01.jpg', 'person-02.jpg', 'person-03.jpg', 'person-04.jpg', 'person-05.jpg', 'person-06.jpg', 'person-07.jpg', 'person-08.jpg', 'person-09.jpg', 'person-10.jpg', 'building.jpg', 'desk.jpg', 'chair.jpg', 'coffee.jpg', 'product.jpg', 'table.jpg'],
|
@@ -117333,7 +117522,8 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
117333
117522
|
others: {
|
117334
117523
|
title: 'Ask Questions or Request Information',
|
117335
117524
|
description: 'Commands that are <u>not related to designing and editing of the current content</u>.',
|
117336
|
-
list: ['Provide well-researched information about bookstores in the Melbourne city area that offer collections of classic titles. Include specific details such as locations, website links, the range of classic titles they offer, and any unique features they have.', 'Can you explain the process of baking a classic chocolate cake from scratch?', 'Give me a list of effective home workouts for beginners without any equipment.',
|
117525
|
+
list: ['Provide well-researched information about bookstores in the Melbourne city area that offer collections of classic titles. Include specific details such as locations, website links, the range of classic titles they offer, and any unique features they have.', 'Explain our galaxy in a beginner-friendly and interesting way.', 'Can you explain the process of baking a classic chocolate cake from scratch?', // 'Give me a list of effective home workouts for beginners without any equipment.',
|
117526
|
+
// 'Give me ideas for designing a cozy and functional home office space.',
|
117337
117527
|
'Provide me with a 10-hour plan for learning practical data science.' // 'Can you explain how to set up a new React project?'
|
117338
117528
|
]
|
117339
117529
|
},
|
@@ -118096,7 +118286,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
118096
118286
|
display: none;
|
118097
118287
|
border-radius: 50px;
|
118098
118288
|
overflow:hidden;
|
118099
|
-
background: rgba(243, 243, 243, 0.9);
|
118289
|
+
/* background: rgba(243, 243, 243, 0.9); */
|
118100
118290
|
width: 92px;
|
118101
118291
|
justify-content: center;
|
118102
118292
|
}
|
@@ -118938,7 +119128,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
118938
119128
|
let info = box.querySelector('.is-box-info');
|
118939
119129
|
if (info) info.parentNode.removeChild(info);
|
118940
119130
|
|
118941
|
-
if (this.sendCommandUrl && this.AIToolbar) {
|
119131
|
+
if ((this.sendCommandUrl || this.sendCommand) && this.AIToolbar) {
|
118942
119132
|
dom.appendHtml(box, `<div class="is-box-info is-tool" style="transform-origin: right top;">
|
118943
119133
|
<button data-title="${out('AI Rewrite')}" title="${out('AI Rewrite')}" class="input-box-rewrite" style="padding-left:3px">
|
118944
119134
|
<svg class="is-icon-flex" style="width:15px;height:15px;flex:none;fill:#000;"><use xlink:href="#icon-pencil"></use></svg>
|