@waylaidwanderer/chatgpt-api
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -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) { |
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168346
301
183