Fixup merge
parent
daa97f9d86
commit
0a726b18c8
10
index.js
10
index.js
|
@ -98,9 +98,8 @@ async function chatgpt(query, callback) {
|
||||||
try {
|
try {
|
||||||
let json = JSON.parse(jsonString);
|
let json = JSON.parse(jsonString);
|
||||||
let chunk = json.choices[0].delta.content;
|
let chunk = json.choices[0].delta.content;
|
||||||
if(!chunk) {
|
if (!chunk) {
|
||||||
callback(line);
|
callback(context.end_line());
|
||||||
line = '';
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//split the chunk into lines leaving the delimiter in the array
|
//split the chunk into lines leaving the delimiter in the array
|
||||||
|
@ -124,9 +123,8 @@ async function chatgpt(query, callback) {
|
||||||
callback(context.end_line());
|
callback(context.end_line());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(line.length > 400) {
|
if (line.length > 400) {
|
||||||
callback(line);
|
callback(context.end_line());
|
||||||
line = '';
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
Loading…
Reference in New Issue