backend-manager 4.2.20 → 4.2.21
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/package.json
CHANGED
|
@@ -385,6 +385,13 @@ OpenAI.prototype.request = function (options) {
|
|
|
385
385
|
images: options.message.images,
|
|
386
386
|
});
|
|
387
387
|
|
|
388
|
+
// Trim all history content
|
|
389
|
+
history.forEach((m) => {
|
|
390
|
+
if (typeof m.content === 'string') {
|
|
391
|
+
m.content = m.content.trim();
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
|
|
388
395
|
// Format history
|
|
389
396
|
history.map((m) => {
|
|
390
397
|
const originalContent = m.content;
|
|
@@ -541,6 +548,12 @@ OpenAI.prototype.request = function (options) {
|
|
|
541
548
|
// Request
|
|
542
549
|
_request('chatgpt', options)
|
|
543
550
|
.then((r) => {
|
|
551
|
+
// Trim response
|
|
552
|
+
if (typeof r === 'string') {
|
|
553
|
+
r = r.trim();
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// Log
|
|
544
557
|
_log('Response', r.length, typeof r, r);
|
|
545
558
|
_log('Tokens', self.tokens);
|
|
546
559
|
|