{"id":13466171,"url":"https://github.com/nekomeowww/insights-bot","last_synced_at":"2025-04-06T01:09:32.907Z","repository":{"id":148849188,"uuid":"616524717","full_name":"nekomeowww/insights-bot","owner":"nekomeowww","description":"A bot works with OpenAI GPT models to provide insights for your info flows.","archived":false,"fork":false,"pushed_at":"2024-08-29T08:24:25.000Z","size":1670,"stargazers_count":274,"open_issues_count":8,"forks_count":27,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T16:10:05.090Z","etag":null,"topics":["bot","discord-bot","golang","gpt-bot","llm-agent","slack-bot","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nekomeowww.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,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["nekomeowww","LittleSound"]}},"created_at":"2023-03-20T14:57:11.000Z","updated_at":"2025-03-07T03:43:00.000Z","dependencies_parsed_at":"2023-06-02T13:45:28.004Z","dependency_job_id":"f33a056c-70ff-4207-9946-5cfc4826f918","html_url":"https://github.com/nekomeowww/insights-bot","commit_stats":{"total_commits":197,"total_committers":14,"mean_commits":"14.071428571428571","dds":0.1725888324873096,"last_synced_commit":"967fa028caf356b0a96eaf19d85dcaa2968bbd1f"},"previous_names":[],"tags_count":97,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekomeowww%2Finsights-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekomeowww%2Finsights-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekomeowww%2Finsights-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekomeowww%2Finsights-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nekomeowww","download_url":"https://codeload.github.com/nekomeowww/insights-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419860,"owners_count":20936012,"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","discord-bot","golang","gpt-bot","llm-agent","slack-bot","telegram-bot"],"created_at":"2024-07-31T15:00:40.286Z","updated_at":"2025-04-06T01:09:32.888Z","avatar_url":"https://github.com/nekomeowww.png","language":"Go","funding_links":["https://github.com/sponsors/nekomeowww","https://github.com/sponsors/LittleSound"],"categories":["Go","Chatbots"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimage src=\"./docs/images/icon.png\" width=\"200px\" height=\"200px\" /\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003einsights-bot\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/nekomeowww/insights-bot/actions/workflows/ci.yml/badge.svg\"\u003e\n  \u003cimg src=\"https://github.com/nekomeowww/insights-bot/actions/workflows/build.yml/badge.svg\" /\u003e\n  \u003cimg src=\"https://github.com/nekomeowww/insights-bot/actions/workflows/release-build.yml/badge.svg\" /\u003e\n  \u003ca href=\"https://goreportcard.com/badge/github.com/nekomeowww/insights-bot\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/nekomeowww/insights-bot\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/nekomeowww/insights-bot\"\u003e\n    \u003cimg src=\"https://img.shields.io/docker/pulls/nekomeowww/insights-bot\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/nekomeowww/insights-bot\"\u003e\n    \u003cimg src=\"https://img.shields.io/docker/v/nekomeowww/insights-bot\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://t.me/ayaka_insights_bot_group\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Chat%20on-Telegram-%235AA9E6?logo=telegram\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://slack.com/oauth/v2/authorize?client_id=2628877438886.5144808095409\u0026scope=chat:write,commands\u0026user_scope=\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Add_to_Slack-4A154B?logo=slack\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nA bot works with OpenAI GPT models to provide insights for your info flows.\n\n[简体中文](./README.zh-CN.md)\n\n---\n\n## Supported IMs\n\n- Telegram\n- Slack\n- Discord\n\n---\n\n## Usage\n\n### Commands\n\nInsights Bot ships with a set of commands, you can use `/help` to get a list of available commands when talking to the bot in Telegram.\nYou can also use `/cancel` to cancel any ongoing actions with the bot.\n\n#### Summarize webpages\n\nCommand: `/smr`\n\nArguments: URL, Replied message with only URL\n\nUsage:\n\n```txt\n/smr https://www.example.com\n```\n\n```txt\n/smr [Reply to a message with only URL]\n```\n\nBy sending `/smr` command with a URL or replying to a message that only contains a URL, the bot will try to summarize the webpage and return the result.\n\n#### Configure chat history recapturing\n\n\u003e **Warning**\n\u003e **This command is not available in Slack/Discord integration currently.**\n\nCommand: `/configure_recap`\n\nArguments: None\n\n```txt\n/configure_recap\n```\n\nBy sending `/configure_recap` command, the bot will send you a message with options you can interact with. Click the buttons to choose the settings you want to configure.\n\n#### Summarize chat histories or Recap\n\n\u003e **Warning**\n\u003e **This command is not available in Slack/Discord integration currently.**\n\nCommand: `/recap`\n\nArguments: None\n\n```txt\n/recap\n```\n\nBy sending `/recap` command, the bot will try to summarize the chat histories and return the result you choose later.\n\n#### Subscribe to chat histories recap for a group\n\n\u003e **Warning**\n\u003e **This command is not available in Slack/Discord integration currently.**\n\nCommand: `/subscribe_recap`\n\nArguments: None\n\n```txt\n/subscribe_recap\n```\n\nBy sending `/subscribe_recap` command, the bot will start to capture the messages from the group you subscribed and then send a copy of the recap message to you through private chat when it is available.\n\n#### Unsubscribe to chat histories recap for a group\n\n\u003e **Warning**\n\u003e **This command is not available in Slack/Discord integration currently.**\n\nCommand: `/unsubscribe_recap`\n\nArguments: None\n\n```txt\n/unsubscribe_recap\n```\n\nBy sending `/unsubscribe_recap` command, the bot will no longer send the copy of the recap message for the group you subscribe.\n\n#### Summarize forwarded messages in private chat\n\n\u003e **Warning**\n\u003e **This command is not available in Slack/Discord integration currently.**\n\nCommands: `/recap_forwarded_start`, `/recap_forwarded`\n\nArguments: None\n\n```txt\n/recap_forwarded_start\n```\n\n```txt\n\u003cForwarded messages\u003e\n```\n\n```txt\n/recap_forwarded\n```\n\nBy sending `/recap_forwarded_start` command, the bot will start to capture the forwarded messages you send later in private chat and try to summarize them when you send `/recap_forwarded` command afterwards.\n\n## Deployment\n\n### Run with binary\n\nYou will have to clone this repository and then build the binary by yourself.\n\n```shell\ngit clone https://github.com/nekomeowww/insights-bot\n```\n\n```shell\ngo build -a -o \"build/insights-bot\" \"github.com/nekomeowww/insights-bot/cmd/insights-bot\"\n```\n\nThen copy the `.env.example` file to `build` directory and rename it to `.env`, and then fill in the environment variables.\n\n```shell\ncd build\ncp ../.env.example .env\nvim .env\n```\n\n```shell\n# assign executable permission to the binary\n$ chmod +x ./insights-bot\n# run the binary\n$ ./insights-bot\n```\n\n### Run with docker\n\n```shell\ndocker run -it --rm -e TELEGRAM_BOT_TOKEN=\u003cTelegram Bot API Token\u003e -e OPENAI_API_SECRET=\u003cOpenAI API Secret Key\u003e -e DB_CONNECTION_STR=\"\u003cPostgresSQL connection URL\u003e\" insights-bot ghcr.io/nekomeowww/insights-bot:latest\n```\n\n### Run with Docker Compose\n\nClone this project:\n\n```shell\ngit clone github.com/nekomeowww/insights-bot\n```\n\nOr only copy or download the necessary `.env.example` and `docker-compose.yml` files (but you will only be able to run the bot with pre-bundled docker image):\n\n```shell\ncurl -O https://raw.githubusercontent.com/nekomeowww/insights-bot/main/.env.example\ncurl -O https://raw.githubusercontent.com/nekomeowww/insights-bot/main/docker-compose.yml\n```\n\nCreate your `.env` by making a copy of the contents from `.env.example` file. The .env file should be placed at the root of the project directory next to your `docker-compose.yml` file.\n\n```shell\ncp .env.example .env\n```\n\nReplace your OpenAI token and other environment variables in `.env`, and then run:\n\n```shell\ndocker compose --profile hub up -d\n```\n\nIf you prefer run docker image from local codes (which means build it manually, you will need the entire source code of this project), then run:\n\n```shell\ndocker compose --profile local up -d --build\n```\n\n### Build on your own\n\n#### Build with go\n\n```shell\ngo build -a -o \"release/insights-bot\" \"github.com/nekomeowww/insights-bot/cmd/insights-bot\"\n```\n\n#### Build with Docker\n\n```shell\ndocker buildx build --platform linux/arm64,linux/amd64 -t \u003ctag\u003e -f Dockerfile .\n```\n\n## Ports we use\n\n| Port | Description |\n|------|-------------|\n| 6060 | pprof Debug server |\n| 7069 | Health check server |\n| 7070 | Slack App/Bot webhook server |\n| 7071 | Telegram Bot webhook server |\n| 7072 | Discord Bot webhook server |\n\n## Configurations\n\n### Environment variables\n\n| Name                                          | Required | Default                                                                                  | Description                                                                                                                                                                                                                                                                                                                                                             |\n| --------------------------------------------- | -------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `TIMEZONE_SHIFT_SECONDS`                      | `false`  | `0`                                                                                      | Timezone shift in seconds used for auto generating recap messages for groups, default is 0.                                                                                                                                                                                                                                                                             |\n| `TELEGRAM_BOT_TOKEN`                          | `true`   |                                                                                          | Telegram Bot API token, you can create one and obtain the token through [@BotFather](https://t.me/BotFather)                                                                                                                                                                                                                                                            |\n| `TELEGRAM_BOT_WEBHOOK_URL`                    | `false`  |                                                                                          | Telegram Bot webhook URL and port, you can use [https://ngrok.com/](https://ngrok.com/) or Cloudflare tunnel to expose your local server to the internet.                                                                                                                                                                                                               |\n| `TELEGRAM_BOT_WEBHOOK_PORT`                   | `false`  | `7071`                                                                                   | Telegram Bot Webhook server port, default is 7071                                                                                                                                                                                                                                                                                                                       |\n| `OPENAI_API_SECRET`                           | `true`   |                                                                                          | OpenAI API Secret Key that looks like `sk-************************************************`, you can obtain one by signing in to OpenAI platform and create one at [http://platform.openai.com/account/api-keys](http://platform.openai.com/account/api-keys).                                                                                                          |\n| `OPENAI_API_HOST`                             | `false`  | `https://api.openai.com`                                                                 | OpenAI API Host, you can specify one if you have a relay or reversed proxy configured. Such as `https://openai.example.workers.dev`                                                                                                                                                                                                                                     |\n| `OPENAI_API_MODEL_NAME`                       | `false`  | `gpt-3.5-turbo`                                                                          | OpenAI API model name, default is `gpt-3.5-turbo`, you can specify one if you want to use another model. Such as `gpt-4`                                                                                                                                                                                                                                                |\n| `OPENAI_API_TOKEN_LIMIT`                      | `false`  | `4096`                                                                                   | OpenAI API token limit used to computed the splits and truncations of texts before calling Chat Completion API generally set to the maximum token limit of a model, and let insights-bot to determine how to process it, default is `4096`                                                                                                                              |\n| `OPENAI_API_CHAT_HISTORIES_RECAP_TOKEN_LIMIT` | `false`  | `2000`                                                                                   | OpenAI chat histories recap token limit, token length of generated and response chat histories recap message, default is 2000, this will leave OPENAI_API_TOKEN_LIMIT - 2000 tokens for actual chat context.                                                                                                                                                            |\n| `DB_CONNECTION_STR`                           | `true`   | `postgresql://postgres:123456@db_local:5432/postgres?search_path=public\u0026sslmode=disable` | PostgreSQL database URL. Such as `postgres://postgres:postgres@localhost:5432/postgres`. You could also suffix with `?search_path=\u003cschema name\u003e` if you want to specify a schema.                                                                                                                                                                                       |\n| `SLACK_CLIENT_ID`                             | `false`  |                                                                                          | Slack app client id, you can create a slack app and get it, see: [tutorial](https://api.slack.com/tutorials/slack-apps-and-postman)                                                                                                                                                                                                                                     |\n| `SLACK_CLIENT_SECRET`                         | `false`  |                                                                                          | Slack app client secret, you can create a slack app and get it, see: [tutorial](https://api.slack.com/tutorials/slack-apps-and-postman)                                                                                                                                                                                                                                 |\n| `SLACK_WEBHOOK_PORT`                          | `false`  | `7070`                                                                                   | Port for Slack Bot/App Webhook server, default is 7070                                                                                                                                                                                                                                                                                                                  |\n| `DISCORD_BOT_TOKEN`                           | `false`  |                                                                                          | Discord bot token, you can create a discord app and get it, see: [Get started document](https://discord.com/developers/docs/getting-started)                                                                                                                                                                                                                            |\n| `DISCORD_BOT_PUBLIC_KEY`                      | `false`  |                                                                                          | Discord bot public key, you can create a discord app and get it, see: [Get started document](https://discord.com/developers/docs/getting-started), required if `DISCORD_BOT_TOKEN` provided.                                                                                                                                                                            |\n| `DISCORD_BOT_WEBHOOK_PORT`                    | `false`  | `7072`                                                                                   | Port for Discord Bot Webhook server, default is 7702                                                                                                                                                                                                                                                                                                                    |\n| `REDIS_HOST`                                  | `true`   | `localhost`                                                                              | Redis host connects to, default is `localhost`                                                                                                                                                                                                                                                                                                                          |\n| `REDIS_PORT`                                  | `true`   | `6379`                                                                                   | Redis port, default is `6379`                                                                                                                                                                                                                                                                                                                                           |\n| `REDIS_TLS_ENABLED`                           | `false`  | `false`                                                                                  | Redis TLS enabled, default is `false`                                                                                                                                                                                                                                                                                                                                   |\n| `REDIS_USERNAME`                              | `false`  |                                                                                          | Redis username.                                                                                                                                                                                                                                                                                                                                                         |\n| `REDIS_PASSWORD`                              | `false`  |                                                                                          | Redis password.                                                                                                                                                                                                                                                                                                                                                         |\n| `REDIS_DB`                                    | `false`  | `0`                                                                                      | Redis database, default is `0`                                                                                                                                                                                                                                                                                                                                          |\n| `REDIS_CLIENT_CACHE_ENABLED`                  | `false`  | `false`                                                                                  | Redis client cache enabled, default is `false`, read more about client cache at [https://redis.io/docs/manual/client-side-caching/](https://redis.io/docs/manual/client-side-caching/) and [https://github.com/redis/rueidis#client-side-caching](https://github.com/redis/rueidis#client-side-caching) for more details.                                               |\n| `LOG_FILE_PATH`                               | `false`  | `\u003cinsights-bot_executable\u003e/logs/insights-bot.log`                                        | Log file path, you can specify one if you want to specify a path to store logs when executed and ran with binary. The default path is `/var/log/insights-bot/insights-bot.log` in Docker volume, you can override the defaults `-e LOG_FILE_PATH=\u003cpath\u003e` when executing `docker run` command or modify and prepend a new `LOG_FILE_PATH` the `docker-compose.yml` file. |\n| `LOG_LEVEL`                                   | `false`  | `info`                                                                                   | Log level, available values are `debug`, `info`, `warn`, `error`                                                                                                                                                                                                                                                                                                        |\n| `LOCALES_DIR`                                 | `false`  | `locales`                                                                                | Locales directory, default is `locales`, it is recommended to configure as an absolute path.                                                                                                                                                                                                                                                                            |\n\n## Acknowledgements\n\n- Project logo was generated by [Midjourney](https://www.midjourney.com/app/jobs/ff3e9b42-181b-4181-a9ae-6777f957835d/)\n- [OpenAI](https://openai.com/) for providing the GPT series models\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekomeowww%2Finsights-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnekomeowww%2Finsights-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekomeowww%2Finsights-bot/lists"}