{"id":14007144,"url":"https://github.com/firtoz/GPT-Shell","last_synced_at":"2025-07-24T01:30:47.550Z","repository":{"id":65028775,"uuid":"578170104","full_name":"firtoz/GPT-Shell","owner":"firtoz","description":"GPT-Shell is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT. Also allows creating Dalle2 images.","archived":false,"fork":false,"pushed_at":"2023-10-05T08:33:16.000Z","size":47604,"stargazers_count":151,"open_issues_count":1,"forks_count":30,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-23T17:11:42.782Z","etag":null,"topics":["bot","chatbot","chatgpt","dall-e","dalle2","discord","discord-bot","discord-js","gpt-3","nodejs","text-davinci-003"],"latest_commit_sha":null,"homepage":"https://erin.ac?ref=github","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firtoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["firtoz"]}},"created_at":"2022-12-14T12:26:28.000Z","updated_at":"2024-10-18T06:12:41.000Z","dependencies_parsed_at":"2024-01-14T09:58:19.873Z","dependency_job_id":"fde56c39-851b-4c93-84b0-4ca240b8c46a","html_url":"https://github.com/firtoz/GPT-Shell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firtoz%2FGPT-Shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firtoz%2FGPT-Shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firtoz%2FGPT-Shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firtoz%2FGPT-Shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firtoz","download_url":"https://codeload.github.com/firtoz/GPT-Shell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227384150,"owners_count":17772327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","chatbot","chatgpt","dall-e","dalle2","discord","discord-bot","discord-js","gpt-3","nodejs","text-davinci-003"],"created_at":"2024-08-10T10:01:51.477Z","updated_at":"2024-11-30T17:32:03.905Z","avatar_url":"https://github.com/firtoz.png","language":"TypeScript","funding_links":["https://github.com/sponsors/firtoz"],"categories":["TypeScript"],"sub_categories":[],"readme":"# GPT-Shell\n\n| :exclamation:  The new version of GPT-Shell is called Erin! Find out more at [Erin's Website!](https://erin.ac/?ref=github-readme) :exclamation: |\n|--------------------------------------------------------------------------------------------------------------------------------------------------|\n\nGPT-Shell is an OpenAI based chat-bot that is similar to OpenAI's [ChatGPT](https://chat.openai.com/).\n\nIt allows users to converse with a virtual companion. It uses nodejs and typescript, as well as modern yarn,\nto create a seamless conversation experience.\n\nIt can also generate images based on your conversation!\n\nhttps://user-images.githubusercontent.com/108406948/210852737-c1a30a08-ed0d-4cb9-9fd2-9b5376ba4233.mp4\n\n## Try it out\n\nYou can try the bot on the official Discord server:\n\n[![](https://dcbadge.vercel.app/api/server/TruuVEBmcC)](https://discord.gg/TruuVEBmcC)\n\n## Usage\n\nTo interact with GPT-Shell, users can:\n- Use the `/chat-gpt` command to start a conversation with the bot\n- Ping the bot in a channel it's in\n- Message the bot directly\n\nThe `/chat-gpt` command will start a new conversation thread, and whenever the user types something,\nthe bot will respond.\n\nThe bot is able to handle multiple conversations at once,\nso you can start as many conversations as you like.\n\n## Bot Setup\nSet up a discord bot [here](https://discord.com/developers/applications/) and add it to your server.\n\nScopes:\n- bot\n- application.commands\n\nBot Permissions:\n- read messages/view channels\n- send messages\n- create public threads\n- create private threads\n- send messages in threads\n- embed links\n- attach files\n- use slash commands\n\nYou also need to enable the Message Content Intent:\n\n\u003cdetails\u003e\n\u003csummary\u003eExpand to see image\u003c/summary\u003e\n\n![image](https://user-images.githubusercontent.com/108406948/210853245-31728f5a-3017-4a26-9caa-0541b6fe1aae.png)\n\n\u003c/details\u003e\n\n## Setup\n\n- You can try to fork the [replit here](https://replit.com/@Ephemeros/GPT-Shell)\n\n- Or you can set it up on your machine.\n\n### Prerequisites:\n\n- [Nodejs](https://nodejs.org/en/): (18 or above)\n\n- [Yarn](https://yarnpkg.com/getting-started/install): (after installing nodejs)\n\n- [pm2](https://pm2.io/docs/runtime/guide/installation/): To keep your bot alive even after killing your terminal.\n\nTo use GPT-Shell, you will need to:\n- Clone the project:\n```\ngit clone https://github.com/firtoz/GPT-Shell.git\n```\n- Open the terminal in the project's folder:\n```\ncd GPT-Shell\n```\n(in windows, right click somewhere in the folder and select \"Open In Terminal\")\nif you see something about powershell, type `cmd` and hit enter, to go to the simpler command line terminal.\n- Install yarn:\n```\nyarn install\n```\n- Set up environment variables\n\n## Setting up Environment Variables\n\nThe following environment variables are required for GPT-Shell to work properly.\n\nYou can set the environment variables in any way you like, or place an .env.local file at the root of your project (rename `example.env.local` to `.env.local`),\nEnsure that your `.env.local` looks like this:\n\u003cdetails\u003e\n  \u003csummary\u003e [EXPAND] Click to see .env.local\u003c/summary\u003e\n  \n```\n# MongoDB:\nMONGODB_URI=\nDB_NAME=CHAT_DB\n\n# Bot Token from Discord:\nBOT_TOKEN=\n\n# Commands:\nCOMMAND_NAME=chat-gpt\nPRIVATE_COMMAND_NAME=chat-gpt-private\nCONFIG_COMMAND_NAME=chat-gpt-config\nCUSTOM_PROMPT_COMMAND_NAME=chat-gpt-prompt\nDRAW_COMMAND_NAME=draw-gpt\n\n# Discord Server Details:\nMAIN_SERVER_ID=\nLOG_CHANNEL_ID=\nMAIN_SERVER_INVITE=\nADMIN_PING_ID=\nUSE_SAME_API_KEY_FOR_ALL=false\nIGNORE_INIT=false\n```\n\u003c/details\u003e\n\n\nMongoDB:\n- MONGODB_URI: The MongoDB connection string.\n  - Should look something like this: mongodb+srv://\u003cusername\u003e:\u003cpassword\u003e\u003ccluster\u003e.\u003csomething\u003e.mongodb.net/?retryWrites=true\u0026w=majority\n- DB_NAME: The name of the collection in MongoDB. You can use `CHAT_DB` or anything you like.\n\nBot Token:\n- BOT_TOKEN: The Discord bot token\n  - You can get it by following https://discord.com/developers/applications then selecting your app and then selecting\n    \"Bot\".\n\nCommands:\n- COMMAND_NAME: The name of the chat-gpt command\n- PRIVATE_COMMAND_NAME: Command to create private threads.\n- CONFIG_COMMAND_NAME: The name of the config command\n- CUSTOM_PROMPT_COMMAND_NAME: (Optional) The name of the command for custom prompts\n- DRAW_COMMAND_NAME: (Optional) The name of the draw command.\n\nDiscord Server Details:\n- MAIN_SERVER_ID: The Discord server where the bot lives\n- LOG_CHANNEL_ID: (Optional) The channel for log messages\n- MAIN_SERVER_INVITE: (Optional) The ideally non-expiring server invite link (if you want users to add the bot to their\n  server)\n- USE_SAME_API_KEY_FOR_ALL: (Optional) When set to 'true', it will allow any server or user to use the bot without needing to provide their own API keys.\n- ADMIN_PING_ID: Bot owner's Discord id (that's you!)\n  \n  Used to let you send some special commands and configure the bot.\n- IGNORE_INIT: (Optional) When set to 'true', when it starts, will not check active threads for new messages\n  since the bot was last online.\n  If you're in many servers, there may be many active threads, so that would hit a rate limit. In that case, it's better\n  to handle messages as they come, instead of checking many threads at once.\n\nExtras:\n- WOLFRAM_APP_ID: Used for the Wolfram Alpha ability.\n\n  Can create an app at https://developer.wolframalpha.com/portal/myapps and get its id.\n\n## Start your bot\nSet up the environment variables as described above.\n- Install pm2:\n\nWith yarn:\n```bash\nyarn global add pm2\n```\nWith npm:\n```bash\nnpm install pm2 -g\n```\nWith debian, use the install script:\n```bash\napt update \u0026\u0026 apt install sudo curl \u0026\u0026 curl -sL https://raw.githubusercontent.com/Unitech/pm2/master/packager/setup.deb.sh | sudo -E bash -\n```\n- Then to start a development environment, run \n```bash\nyarn dev\n```\nThis way, whenever you change the code, it will restart the bot to update.\n\n- To build and start the bot, run \n```bash\nyarn build\n``` \nand then \n```bash\nyarn start\n```\nYou can also run `npm start` or `npm run start` to start the bot.\n\nNOTE: running `yarn start`, `npm start` or `npm run start` will start the bot with PM2 and give it the name \"GPT-Shell\". You can replace \"GPT-Shell\" with a name of your choice in [package.json](https://github.com/firtoz/GPT-Shell/blob/main/package.json). It will also show logs for the PM2 running processes and save them.\n\nIf you are in dev environment, use `node .` to test your code:\n```bash\nnode .\n```\nOnce you are satisfied with the changes run:\n```bash\npm2 restart GPT-Shell \u0026\u0026 pm2 logs\n```\nIn order to stop the bot, run:\n```bash\nyarn run stop\n```\nYou can also restart it from the [pm2.io dashboard](https://pm2.io/) as shown bellow:\n\u003cdetails\u003e\n\u003csummary\u003eExpand to see image\u003c/summary\u003e\n\n![image](https://cdn.discordapp.com/attachments/1072834906742345808/1076183450417123358/image.png)\n\n\u003c/details\u003e\n\n## Configuration\n\nGo to your server, and type the config command, and set the API key for your server using the config.\n\n```\n/chat-gpt-config\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eExpand to see config image\u003c/summary\u003e\n\n![config-api-key.png](config-api-key.png)\n\n\u003c/details\u003e\n\n\n\n## Long-Term Memory\n\nStarting from 2.0.0, the bot has the capacity to have a long-term memory.\n\n\u003cdetails\u003e\n\n\u003csummary\u003e Expand to see how to configure long term memory. \u003c/summary\u003e\n\nThis functionality is experimental, but internal testing shows that it works quite well for typical conversation.\n\nDoes not work so well if the conversation has long pieces of code, because of token limitations.\n\nHow it works:\n- the bot creates [embeddings](https://openai.com/blog/new-and-improved-embedding-model/) for every message in the conversation\n- if the conversation is short, all the conversation history is included in the prompt\n- if the conversation is long enough, when a new message is sent, that message's embedding is compared to the conversation history, and only the most relevant messages will be included in the prompt.\n\nTo be able to set this up, use the config command on the main server:\n\n```\n/chat-gpt-config\n```\n\n![config.png](config.png)\n\nThen enter the pinecone configuration details.\n\nYou can create an account at https://app.pinecone.io/.\n\nIf you did it correctly, you should see something like this:\n\n![config-set.png](config-set.png)\n\n\u003c/details\u003e\n\n\n## Custom Prompts\nBy default, the bot behaves like a helpful software engineer.\n\nIf you want the bot to behave differently, you can use a custom prompt.\n\nThis can be done in a new channel dedicated to the bot, or a new conversation thread, or in DMs.\n\nYou can use the `/chat-gpt-prompt` command, if you have the permissions, and you can set the custom prompt\nfor the bot by filling the form.\n\nThis command can be used in:\n- channels (if you are a server admin)\n- threads (if you are the one who created the thread)\n- DMs\n\nThe temperature is the same as OpenAI's temperature parameter. 0 means it becoems repetitive, 1 means it becomes a bit chaotic.\nDefault is 0.8 for GPT-Shell.\n\n![custom-prompt.png](custom-prompt.png)\n\n\n## Contributions\n\nWe welcome contributions to GPT-Shell. If you have an idea for a new feature or have found a bug,\nplease open an issue on GitHub. We would also appreciate any sponsorships or donations.\n\nYou can sponsor us through our GitHub sponsor page [here](https://github.com/sponsors/firtoz).\n\n## License\n\nGPT-Shell is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirtoz%2FGPT-Shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirtoz%2FGPT-Shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirtoz%2FGPT-Shell/lists"}