backend-manager 3.2.104 → 3.2.106

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "3.2.104",
3
+ "version": "3.2.106",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -253,9 +253,18 @@ OpenAI.prototype.request = function (options) {
253
253
  // Format history
254
254
  history.map((m) => {
255
255
  m.role = m.role || 'system';
256
- m.content = [
257
- { type: 'text', text: m.text },
258
- ]
256
+
257
+ m.content = [];
258
+
259
+ // Set content
260
+ if (m.text) {
261
+ m.content.push({
262
+ type: 'text',
263
+ text: m.text,
264
+ })
265
+ }
266
+
267
+ // Set images
259
268
  m.images = m.images || [];
260
269
 
261
270
  // Loop through and add
@@ -277,7 +286,9 @@ OpenAI.prototype.request = function (options) {
277
286
  })
278
287
 
279
288
  // Log message
280
- _log('Messages', history);
289
+ history.forEach((m) => {
290
+ _log('Message', m.role, m.content);
291
+ });
281
292
 
282
293
  request.body = {
283
294
  model: options.model,
@@ -349,6 +360,7 @@ OpenAI.prototype.request = function (options) {
349
360
  _request('chatgpt', options)
350
361
  .then((r) => {
351
362
  _log('Response', r);
363
+ _log('Tokens', self.tokens);
352
364
 
353
365
  // Try to parse JSON response if needed
354
366
  try {