Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@waylaidwanderer/chatgpt-api

Package Overview
Dependencies
Maintainers
1
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@waylaidwanderer/chatgpt-api - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

5

bin/cli.js

@@ -49,3 +49,4 @@ #!/usr/bin/env node

}
const spinner = ora('ChatGPT is typing...');
const chatGPTLabel = settings.chatGptClient?.chatGPTLabel || 'ChatGPT';
const spinner = ora(`${chatGPTLabel} is typing...`);
spinner.prefixText = '\n';

@@ -58,3 +59,3 @@ spinner.start();

parentMessageId = response.messageId;
console.log(boxen(response.response, { title: 'ChatGPT', padding: 0.7, margin: 1, dimBorder: true }));
console.log(boxen(response.response, { title: chatGPTLabel, padding: 0.7, margin: 1, dimBorder: true }));
await clipboard.write(response.response);

@@ -61,0 +62,0 @@ } catch (error) {

2

package.json
{
"name": "@waylaidwanderer/chatgpt-api",
"version": "1.3.1",
"version": "1.4.0",
"description": "A ChatGPT implementation using the official ChatGPT model via OpenAI's API.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -56,2 +56,6 @@ <p align="center">

// promptPrefix: 'You are not ChatGPT...\n\n',
// (Optional) Set a custom name for the user
// userLabel: 'User',
// (Optional) Set a custom name for ChatGPT
// chatGPTLabel: 'ChatGPT',
// (Optional) Set to true to enable `console.debug()` logging

@@ -99,2 +103,6 @@ debug: false,

// promptPrefix: 'You are not ChatGPT...\n\n',
// (Optional) Set a custom name for the user
// userLabel: 'User',
// (Optional) Set a custom name for ChatGPT
// chatGPTLabel: 'ChatGPT',
// (Optional) Set to true to enable `console.debug()` logging

@@ -101,0 +109,0 @@ debug: false,

@@ -13,2 +13,6 @@ export default {

// promptPrefix: 'You are not ChatGPT...\n\n',
// (Optional) Set a custom name for the user
// userLabel: 'User',
// (Optional) Set a custom name for ChatGPT
// chatGPTLabel: 'ChatGPT',
// (Optional) Set to true to enable `console.debug()` logging

@@ -15,0 +19,0 @@ debug: false,

@@ -127,3 +127,3 @@ import fetch from 'node-fetch';

if (!promptPrefix.endsWith('<|im_sep|>\n\n')) {
promptPrefix = `${promptPrefix}<|im_sep|>\n\n`;
promptPrefix = `${promptPrefix.trim()}<|im_sep|>\n\n`;
}

@@ -138,4 +138,8 @@ } else {

}
const promptSuffix = "ChatGPT:\n"; // Prompt should end with 2 newlines, so we add one here.
const userLabel = this.options.userLabel || 'User';
const chatGPTLabel = this.options.chatGPTLabel || 'ChatGPT';
const promptSuffix = `${chatGPTLabel}:\n`; // Prompt should end with 2 newlines, so we add one here.
let currentTokenCount = this.getTokenCount(`${promptPrefix}${promptSuffix}`);

@@ -148,3 +152,4 @@ let promptBody = '';

const message = orderedMessages.pop();
const messageString = `${message.role}:\n${message.message}<|im_sep|>\n`;
const roleLabel = message.role === 'User' ? userLabel : chatGPTLabel;
const messageString = `${roleLabel}:\n${message.message}<|im_sep|>\n`;
const newPromptBody = `${messageString}${promptBody}`;

@@ -151,0 +156,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc