From dc04ca93060443a3ce6263a476f4dafc66afc6b3 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sat, 28 Oct 2023 07:21:00 +0200 Subject: Add arkose_token to OpenaiChat --- .../lib/mock/pending-interceptors-formatter.js | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 g4f/Provider/npm/node_modules/undici/lib/mock/pending-interceptors-formatter.js (limited to 'g4f/Provider/npm/node_modules/undici/lib/mock/pending-interceptors-formatter.js') diff --git a/g4f/Provider/npm/node_modules/undici/lib/mock/pending-interceptors-formatter.js b/g4f/Provider/npm/node_modules/undici/lib/mock/pending-interceptors-formatter.js new file mode 100644 index 00000000..1bc7539f --- /dev/null +++ b/g4f/Provider/npm/node_modules/undici/lib/mock/pending-interceptors-formatter.js @@ -0,0 +1,40 @@ +'use strict' + +const { Transform } = require('stream') +const { Console } = require('console') + +/** + * Gets the output of `console.table(…)` as a string. + */ +module.exports = class PendingInterceptorsFormatter { + constructor ({ disableColors } = {}) { + this.transform = new Transform({ + transform (chunk, _enc, cb) { + cb(null, chunk) + } + }) + + this.logger = new Console({ + stdout: this.transform, + inspectOptions: { + colors: !disableColors && !process.env.CI + } + }) + } + + format (pendingInterceptors) { + const withPrettyHeaders = pendingInterceptors.map( + ({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ + Method: method, + Origin: origin, + Path: path, + 'Status code': statusCode, + Persistent: persist ? '✅' : '❌', + Invocations: timesInvoked, + Remaining: persist ? Infinity : times - timesInvoked + })) + + this.logger.table(withPrettyHeaders) + return this.transform.read().toString() + } +} -- cgit v1.2.3