doomiaichat 3.4.0 → 3.5.0
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/dist/openai.js +3 -3
- package/package.json +1 -1
- package/src/openai.ts +3 -3
package/dist/openai.js
CHANGED
|
@@ -136,7 +136,7 @@ class OpenAIGpt extends gptbase_1.default {
|
|
|
136
136
|
if (message === '[DONE]') {
|
|
137
137
|
let output = { successed: true, requestid, text: replytext.join(''), finish_reason: finishreason, usage };
|
|
138
138
|
if (attach)
|
|
139
|
-
output = Object.assign(output, attach);
|
|
139
|
+
output = Object.assign({}, output, attach);
|
|
140
140
|
this.emit('chatdone', output);
|
|
141
141
|
return; // Stream finished
|
|
142
142
|
}
|
|
@@ -150,8 +150,8 @@ class OpenAIGpt extends gptbase_1.default {
|
|
|
150
150
|
replytext.push(streamtext);
|
|
151
151
|
let output = { successed: true, requestid, text: replytext.join(''), finish_reason: finishreason, index: parsed.choices[0].index, usage };
|
|
152
152
|
if (attach)
|
|
153
|
-
output = Object.assign(output, attach);
|
|
154
|
-
this.emit('chattext',
|
|
153
|
+
output = Object.assign({}, output, attach);
|
|
154
|
+
this.emit('chattext', output);
|
|
155
155
|
}
|
|
156
156
|
catch (error) {
|
|
157
157
|
this.emit('chaterror', { successed: false, requestid, error: 'JSON parse stream message', message });
|
package/package.json
CHANGED
package/src/openai.ts
CHANGED
|
@@ -124,7 +124,7 @@ export default class OpenAIGpt extends GptBase {
|
|
|
124
124
|
const message = line.replace(/^data: /, '');
|
|
125
125
|
if (message === '[DONE]') {
|
|
126
126
|
let output = { successed: true, requestid, text: replytext.join(''), finish_reason: finishreason, usage };
|
|
127
|
-
if (attach) output = Object.assign(output, attach);
|
|
127
|
+
if (attach) output = Object.assign({},output, attach);
|
|
128
128
|
this.emit('chatdone', output)
|
|
129
129
|
return; // Stream finished
|
|
130
130
|
}
|
|
@@ -137,8 +137,8 @@ export default class OpenAIGpt extends GptBase {
|
|
|
137
137
|
let streamtext = parsed.choices[0].delta.content;
|
|
138
138
|
replytext.push(streamtext);
|
|
139
139
|
let output = { successed: true, requestid, text: replytext.join(''), finish_reason: finishreason, index: parsed.choices[0].index, usage };
|
|
140
|
-
if (attach) output = Object.assign(output, attach);
|
|
141
|
-
this.emit('chattext',
|
|
140
|
+
if (attach) output = Object.assign({},output, attach);
|
|
141
|
+
this.emit('chattext', output )
|
|
142
142
|
} catch (error) {
|
|
143
143
|
this.emit('chaterror', { successed: false, requestid, error: 'JSON parse stream message', message });
|
|
144
144
|
}
|