Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gs1068/fast-api-slack-gpt-bot
This bot is a service that analyzes Slack thread messages and automatically generates responses using ChatGPT. It is built with FastAPI and follows Domain-Driven Design (DDD). Its main use cases include improving team communication efficiency and automating question responses.
https://github.com/gs1068/fast-api-slack-gpt-bot
ddd fastapi gpt-4 python slack spreadsheet
Last synced: 17 days ago
JSON representation
This bot is a service that analyzes Slack thread messages and automatically generates responses using ChatGPT. It is built with FastAPI and follows Domain-Driven Design (DDD). Its main use cases include improving team communication efficiency and automating question responses.
- Host: GitHub
- URL: https://github.com/gs1068/fast-api-slack-gpt-bot
- Owner: gs1068
- Created: 2024-12-05T07:50:17.000Z (18 days ago)
- Default Branch: master
- Last Pushed: 2024-12-05T08:24:08.000Z (18 days ago)
- Last Synced: 2024-12-05T08:33:29.338Z (18 days ago)
- Topics: ddd, fastapi, gpt-4, python, slack, spreadsheet
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Slack GPT Bot
## ディレクトリ構成
```
├── Dockerfile
├── Makefile
├── README.md
├── config
│ └── load_env.py
├── domain
│ ├── model
│ │ ├── gpt.py
│ │ ├── slack.py
│ │ └── spreadsheet.py
│ └── repository
│ ├── gpt.py
│ ├── slack.py
│ └── spreadsheet.py
├── infrastructure
│ ├── __init__.py
│ ├── gpt
│ │ └── gpt.py
│ ├── slack
│ │ └── slack.py
│ └── spreadsheet
│ └── spreadsheet.py
├── interfaces
│ ├── __init__.py
│ ├── gpt.py
│ └── slack.py
├── main.py
├── requirements.txt
├── router
│ ├── __init__.py
│ ├── gpt.py
│ ├── ping.py
│ └── slack.py
└── usecase
├── __init__.py
├── gpt.py
└── slack.py
```## インフラ構成
![インフラ構成](./images/001.jpg)
### 使用技術
- **言語**: Python(FastAPI)
- **API**:
- Slack API
- OpenAI GPT API
- Google Spreadsheet API
- **インフラ**:
- Docker
- ECR
- AWS App Runner
## Slack APP
OAuth & Permissions
- app_mentions:read
- channels:history
- channels:read
- chat:write
- groups:history
- groups:read
- im:history
- im:read
- im:writeEvent Subscription
- app_mention
- message.im## スプレッドシート
GCPでこのプロジェクトを作成し、credential.jsonを取得
プレッドシートの作成とActivityタブを作る最終利用日時が変わると「一日のトークン使用量」がリセットされる。
![スプレッドシート](./images/002.jpg)
## 環境設定
### `.env` ファイル
以下の環境変数を設定してください。
```plaintext
SLACK_BOT_TOKEN="xoxb-xxxx-xxxx-xxxx-xxxx"
OPENAI_API_KEY="sk-xxxx-xxxx-xxxx-xxxx"
SPREADSHEET_ID="xxxx-xxxx-xxxx-xxxx-xxxx"
GOOGLE_CREDENTIALS_PATH="./credential.json"
```GCP から取得した `credentials.json` ファイルを `./` ディレクトリに配置してください。