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