Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

chore: Rename color-console.js to helper.js and add askQuestion as exported fn

LaraClara6c5bea0096f9
diff --git a/config/color-console.js b/config/helpers.js
similarity index 55%
rename from config/color-console.js
rename to config/helpers.js
index a85f78b367..661342163d 100644
--- a/config/color-console.js
+++ b/config/helpers.js
@@ -1,8 +1,24 @@
/**
- * Console changes
+ * Helper functions
* This allows us to give the console some colour when running in a terminal
*/
+const readline = require("readline");
+const askQuestion = (query) => {
+ const rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ });
+
+ return new Promise((resolve) =>
+ rl.question("\x1b[36m" + query + "\n> " + "\x1b[0m", (ans) => {
+ rl.close();
+ resolve(ans);
+ })
+ );
+};
+
+// Set the console colours
console.orange = (msg) => console.log('\x1b[33m%s\x1b[0m', msg);
console.green = (msg) => console.log('\x1b[32m%s\x1b[0m', msg);
console.red = (msg) => console.log('\x1b[31m%s\x1b[0m', msg);
@@ -11,4 +27,8 @@ console.purple = (msg) => console.log('\x1b[35m%s\x1b[0m', msg);
console.cyan = (msg) => console.log('\x1b[36m%s\x1b[0m', msg);
console.yellow = (msg) => console.log('\x1b[33m%s\x1b[0m', msg);
console.white = (msg) => console.log('\x1b[37m%s\x1b[0m', msg);
-console.gray = (msg) => console.log('\x1b[90m%s\x1b[0m', msg);
\ No newline at end of file
+console.gray = (msg) => console.log('\x1b[90m%s\x1b[0m', msg);
+
+module.exports = {
+ askQuestion,
+}
\ No newline at end of file
diff --git a/config/install.js b/config/install.js
index 4f7c79b48f..a977c9a1f5 100644
--- a/config/install.js
+++ b/config/install.js
@@ -2,9 +2,8 @@
* Install script: WIP
*/
const fs = require('fs');
-const readline = require('readline');
const { exit } = require('process');
-require('./color-console');
+const { askQuestion } = require('./helpers');
// Save the original console.log function
const originalConsoleWarn = console.warn;
@@ -38,22 +37,6 @@ loader.addSecureEnvVar(rootEnvPath, 'MEILI_MASTER_KEY', 32);
// Init env
let env = {};
-// Function to ask for user input
-const askQuestion = (query) => {
- const rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout,
- });
-
- return new Promise((resolve) =>
- rl.question("\x1b[34m" + query + "\n> " + "\x1b[0m", (ans) => {
- rl.close();
- resolve(ans);
- })
- );
-};
-
-
(async () => {
// If the terminal accepts questions, lets ask for the env vars
if (!process.stdin.isTTY) {
@@ -76,7 +59,7 @@ const askQuestion = (query) => {
// Lets colour the console
console.purple('=== LibreChat First Install ===');
- console.cyan('Note: Leave blank to use the default value.');
+ console.blue('Note: Leave blank to use the default value.');
console.log(''); // New line
// Ask for the app title
@@ -111,6 +94,18 @@ const askQuestion = (query) => {
console.orange('Warning: Your mongodb url looks incorrect, please double check it in the `.env` file.');
}
+ // Lets ask about open registration
+ const openReg = await askQuestion(
+ 'Do you want to allow user registration (y/n)? Default: y'
+ );
+ if (openReg === 'n' || openReg === 'no') {
+ env['ALLOW_REGISTRATION'] = 'false';
+ // Lets tell them about how to create an account:
+ console.red('Note: You can create an account by running: `npm run create-user <email> <name> <username>`');
+ // sleep for 1 second so they can read this
+ await new Promise((resolve) => setTimeout(resolve, 1000));
+ }
+
// Update the env file
loader.writeEnvFile(rootEnvPath, env);
@@ -119,4 +114,3 @@ const askQuestion = (query) => {
console.green('Success! Please read our docs if you need help setting up the rest of the app.');
console.log(''); // New line
})();
-