From 074158d4780e9d100f670deff45a698d96e2b2d5 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Wed, 8 Mar 2023 21:04:05 -0700 Subject: [PATCH] Brrt --- config.json.default | 2 +- gpt-test.js | 50 --------------------------------------------- 2 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 gpt-test.js diff --git a/config.json.default b/config.json.default index 7c3a96b..36b5f19 100644 --- a/config.json.default +++ b/config.json.default @@ -6,6 +6,6 @@ "openai": { "key": "", "resetTime": 600000, - "basePrompt": {"role": "system", "name": "Bot", "content": "You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible. Knowledge cutoff: 2021, You do not have access to the current date or time. The maximum number of characters in your response is exactly 2000 characters, no more."} + "basePrompt": {"role": "system", "name": "Bot"} } } \ No newline at end of file diff --git a/gpt-test.js b/gpt-test.js deleted file mode 100644 index 0355310..0000000 --- a/gpt-test.js +++ /dev/null @@ -1,50 +0,0 @@ -const config = require("./config.json"); -const { - Configuration, - OpenAIApi -} = require("openai"); -const openai = new OpenAIApi(new Configuration({ - apiKey: config.openai.key -})); - -// Take user input via command line -const readline = require("readline").createInterface({ - input: process.stdin, - output: process.stdout -}); - -sessions = {}; - -// Command line is session 0 -sessions[0] = { - messages: [] -}; - -// The ask() function but as a promise -const askPromise = (prompt, session) => { - return new Promise((resolve, reject) => { - // If the session doesn't exist, create it - if (!sessions[session]) { - sessions[session] = { - messages: [] - - -// Ask the user for a prompt -const ask = () => { - readline.question("What would you like to ask the bot? ", async (prompt) => { - // Create a new session - sessions[0].messages.push({ - role: "user", - content: prompt - }); - await openai.createChatCompletion({ - model: "gpt-3.5-turbo", - messages: sessions[0].messages - }).then((data) => { - sessions[0].messages.push(data.data.choices[0].message); - console.log(`${data.data.choices[0].message.role}: ${data.data.choices[0].message.content}`); - ask(); - }); - }); -}; -ask(); \ No newline at end of file