@innovastudio/contentbox 1.5.72 → 1.5.73
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -111224,9 +111224,9 @@ ${answer}
|
|
111224
111224
|
if (activeSection) {
|
111225
111225
|
if (activeSection.classList.contains('is-box')) sectionBox = true; // A single box section
|
111226
111226
|
}
|
111227
|
-
}
|
111227
|
+
} // if(this.builder.sendCommandUrl==='') return;
|
111228
|
+
|
111228
111229
|
|
111229
|
-
if (this.builder.sendCommandUrl === '') return;
|
111230
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 => {
|
111231
111231
|
const args = JSON.parse(response);
|
111232
111232
|
if (this.builder.consoleLog) console.log(args);
|
@@ -114057,16 +114057,33 @@ ${currentHtml}
|
|
114057
114057
|
};
|
114058
114058
|
|
114059
114059
|
try {
|
114060
|
+
/*
|
114060
114061
|
const response = await fetch(this.builder.sendCommandUrl, {
|
114061
|
-
|
114062
|
-
|
114063
|
-
|
114064
|
-
|
114065
|
-
|
114066
|
-
|
114067
|
-
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),
|
114068
114068
|
});
|
114069
|
-
|
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
|
+
}
|
114070
114087
|
|
114071
114088
|
if (data.error) {
|
114072
114089
|
// Error response from OpenAI goes here.
|
@@ -117265,6 +117282,7 @@ class ContentBox {
|
|
117265
117282
|
speechTranscribeUrl: '',
|
117266
117283
|
// http://localhost:8081
|
117267
117284
|
autoSendDelay: 4000,
|
117285
|
+
// sendCommand: async (message)=>{ },
|
117268
117286
|
onlineDemo: false,
|
117269
117287
|
startAIAssistant: false,
|
117270
117288
|
temperature: 0.6,
|
@@ -119110,7 +119128,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
119110
119128
|
let info = box.querySelector('.is-box-info');
|
119111
119129
|
if (info) info.parentNode.removeChild(info);
|
119112
119130
|
|
119113
|
-
if (this.sendCommandUrl && this.AIToolbar) {
|
119131
|
+
if ((this.sendCommandUrl || this.sendCommand) && this.AIToolbar) {
|
119114
119132
|
dom.appendHtml(box, `<div class="is-box-info is-tool" style="transform-origin: right top;">
|
119115
119133
|
<button data-title="${out('AI Rewrite')}" title="${out('AI Rewrite')}" class="input-box-rewrite" style="padding-left:3px">
|
119116
119134
|
<svg class="is-icon-flex" style="width:15px;height:15px;flex:none;fill:#000;"><use xlink:href="#icon-pencil"></use></svg>
|