{"id":13677773,"url":"https://github.com/Electric-Hydrogen/GPTBot","last_synced_at":"2025-04-29T12:31:39.323Z","repository":{"id":154175205,"uuid":"615621196","full_name":"Electric-Hydrogen/GPTBot","owner":"Electric-Hydrogen","description":"A fully serverless (AWS Lambda, API Gateway, DynamoDB) Slack bot with GPT-4 support and full conversation mode","archived":false,"fork":false,"pushed_at":"2024-01-10T13:38:03.000Z","size":3343,"stargazers_count":68,"open_issues_count":2,"forks_count":9,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-08-28T21:15:55.474Z","etag":null,"topics":["bot","chatgpt","slack"],"latest_commit_sha":null,"homepage":"https://opichon.medium.com/gptbot-an-open-source-gpt-4-slack-bot-647be5e7152a","language":"JavaScript","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/Electric-Hydrogen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-03-18T07:12:22.000Z","updated_at":"2024-08-09T06:39:16.000Z","dependencies_parsed_at":"2024-01-11T23:04:55.327Z","dependency_job_id":"a3656fc1-dc8e-4df4-9e72-9dbbd9bb43b8","html_url":"https://github.com/Electric-Hydrogen/GPTBot","commit_stats":null,"previous_names":["electric-hydrogen/gptbot","lifte-h2/gptbot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electric-Hydrogen%2FGPTBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electric-Hydrogen%2FGPTBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electric-Hydrogen%2FGPTBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electric-Hydrogen%2FGPTBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Electric-Hydrogen","download_url":"https://codeload.github.com/Electric-Hydrogen/GPTBot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224173110,"owners_count":17268050,"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","chatgpt","slack"],"created_at":"2024-08-02T13:00:46.822Z","updated_at":"2024-11-11T20:30:15.817Z","avatar_url":"https://github.com/Electric-Hydrogen.png","language":"JavaScript","funding_links":[],"categories":["Demo"],"sub_categories":["充当旅行向导"],"readme":"# GPTBot\n![GPTBot Logo](assets/logo.png)\n\n*A fully serverless (AWS Lambda, API Gateway, DynamoDB) Slack bot with GPT-4 support and full conversation mode.*\n\n## Demo\n![GPTBot Logo](assets/demo.gif)\n\n## Features \u0026 Usage\n* Support a one-off response from GPTBot when mentioning the bot (`@GPTBot`) in a channel you are both a member of.\n(Make sure the Bot is added to whichever channel in which you want to talk to the Bot).\n* Support full conversation with context carried over. To start a full conversation, run the command: `/gptbot start`.\nTo end the conversation, run the command: `/gptbot stop`.\n* Support latest GPT-4 model. If you want to start a conversation with the new GPT-4 model, run the command \n`/gptbot start gpt-4`. In this mode, responses take a longer time. By default, the model used is `gpt-3.5-turbo`.\n* Support collaboration mode. eg: add the Bot to a channel, start a conversation with it (`/gptbot start`): every\nchannel members can reply to the Bot to help refine the answers it provides.\n\n## Installation and deployment to your AWS environment\n1. `npm install`\n2. `npm install -g serverless`\n3. Ensure the environment variables set in `.envrc_example` are set properly. If you use [direnv](https://direnv.net/),\nyou can execute `cp .envrc_example .envrc` to get you started. (`SLACK_BOT_TOKEN` is obtained after creating a first \nversion of the Bot in the [Slack Admin Console](https://api.slack.com/apps/) and installing it. \nThe token is then listed under `OAuth \u0026 Permissions` -\u003e `Bot User OAuth Token`). \n4. Deploy the stack: `npm run deploy`. For this command to be successful, you need to have your AWS environment variables \nproperly set (Access Key Id and Security Token). Using temporary credentials via a tool like\n[aws-vault](https://github.com/99designs/aws-vault) is recommended. \n\n## Setting up Slack\n1. If you haven't already, create a new bot using this link: https://api.slack.com/apps/new\n2. Our bot replies to a slash command. On the left Menu, click `Slash Commands` -\u003e `Create new Command` and set: \n   * Command: `/gptbot`\n   * Request URL: [Url of API Gateway provided by `npm run deploy`]\n   * Short Description: `Start or stop a full conversation with GPTBot`\n   * Usage Hint: `start|stop [engine]`\n3. Our bot subscribes to Events. On the left Menu, click `Event Subscriptions`. Under Request URL, add again the link \nto API Gateway created by `npm run deploy`. Then make sure to select these events under `Subscribe to Bot Events`:\n   * `app_mention`\n   * `message.channels`\n   * `message.groups`\n   * `message.im` \n5. Our bot requires permissions. On the left Menu, click `OAuth \u0026 Permissions` -\u003e `Scopes`.\nMake sure all these scopes are added:\n   * `app_mentions:read`\n   * `channels:history`\n   * `chat:write`\n   * `commands`\n   * `groups:history`\n   * `im:history`\n6. Our bot can talk to people via DM. On the left Menu, click `App Home` -\u003e `Show Tabs`.\nMake sure `Messages Tab` is ticked and also `Allow users to send Slash commands and messages from the messages tab`.\n\n## What is being installed in my AWS account?\nHere are the main resources this Bot deploys:\n* 1 API Gateway instance\n* 2 AWS Lambda functions\n* 1 DynamoDB table\n* 1 S3 deployment bucket (used by serverless)\n\nTo be able to subscribe to Slack events, we need an API endpoint, so we create an API Gateway instance.\n\nEvents that are sent via Slack need acknowledgement within 3 seconds, otherwise they are retried. To go around this\nwe are provisioning the lambda function. But calling OpenAI is taking often longer than 3 seconds. So we create two\nfunctions:\n* 1 acknowledger: this function acknowledges the event as fast as it possibly can. It then invokes asynchronously the\nbot function.\n* 1 bot function: this function calls OpenAI and sends the OpenAI response back to Slack.\n\nThe Bot supports full conversation mode, ie it keeps the context of what was previously exchanged to provide a new \nanswer. To do that `/gptbot start` creates a record in DynamoDB for the conversation. When `/gptbot stop` is called, \nthe conversation is deleted.\n\n## Deprovision\nShould you want to remove all the resources created on AWS and deprovision the bot, you could just type: \n`npm run deprovision`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElectric-Hydrogen%2FGPTBot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FElectric-Hydrogen%2FGPTBot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElectric-Hydrogen%2FGPTBot/lists"}