backend-manager 5.0.11 → 5.0.13
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
|
@@ -426,7 +426,7 @@ BackendAssistant.prototype.errorify = function (e, options) {
|
|
|
426
426
|
if (isBetween(options.code, 500, 599)) {
|
|
427
427
|
self.error(newError);
|
|
428
428
|
} else {
|
|
429
|
-
self.log(
|
|
429
|
+
self.log(`⚠️ Client error (${options.code}):`, newError);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
|
|
@@ -259,7 +259,6 @@ OpenAI.prototype.request = function (options) {
|
|
|
259
259
|
return reject(assistant.errorify(`Error loading message: ${message}`, {code: 400}));
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
|
|
263
262
|
// Moderate if needed
|
|
264
263
|
let moderation = null;
|
|
265
264
|
if (options.moderate) {
|
|
@@ -407,13 +406,23 @@ function loadAttachment(type, content, _log) {
|
|
|
407
406
|
}
|
|
408
407
|
}
|
|
409
408
|
|
|
410
|
-
function formatMessageContent(content, attachments, _log, mode = 'responses') {
|
|
409
|
+
function formatMessageContent(content, attachments, _log, mode = 'responses', role = 'user') {
|
|
411
410
|
const formattedContent = [];
|
|
412
411
|
|
|
413
412
|
// Format text content
|
|
414
413
|
if (content) {
|
|
414
|
+
let contentType = 'text';
|
|
415
|
+
|
|
416
|
+
if (mode === 'moderations') {
|
|
417
|
+
contentType = 'text';
|
|
418
|
+
} else if (role === 'assistant') {
|
|
419
|
+
contentType = 'output_text';
|
|
420
|
+
} else {
|
|
421
|
+
contentType = 'input_text';
|
|
422
|
+
}
|
|
423
|
+
|
|
415
424
|
formattedContent.push({
|
|
416
|
-
type:
|
|
425
|
+
type: contentType,
|
|
417
426
|
text: content,
|
|
418
427
|
});
|
|
419
428
|
}
|
|
@@ -520,7 +529,7 @@ function formatHistory(options, prompt, message, _log) {
|
|
|
520
529
|
|
|
521
530
|
// Set properties
|
|
522
531
|
m.role = m.role || 'developer';
|
|
523
|
-
m.content = formatMessageContent(originalContent, originalAttachments, _log);
|
|
532
|
+
m.content = formatMessageContent(originalContent, originalAttachments, _log, 'responses', m.role);
|
|
524
533
|
m.attachments = [];
|
|
525
534
|
|
|
526
535
|
// Delete any field except for role, content
|