Giter VIP home page Giter VIP logo

linebot-gemini-summarize's Introduction

群組摘要王 v2

群組摘要王 v2 是一款使用 FastAPI、LINE Messaging API 和 Google Generative AI,來為 LINE 群組的訊息進行摘要的開源專案。

點子來自:「如何開發一個「LINE Bot 群組聊天摘要生成器

功能

  • 接收 LINE 群組中的訊息
  • 透過命令清空對話歷史紀錄
  • 透過命令產生訊息的摘要

流程圖

   ┌─┐
   ║"│
   └┬┘
   ┌┼┐
    │            ┌─────┐          ┌──────────────┐               ┌────────┐          ┌──────┐
   ┌┴┐           │Group│          │Webhook_Server│               │Firebase│          │Gemini│
  User           └─────┘          └──────┬───────┘               └────────┘          └──────┘
   │    傳送文章訊息  │                    │                           │                  │
   │ ──────────────>│                    │                           │                  │
   │                │     傳送用戶指令     │                           │                  │
   │                │───────────────────>│                           │                  │
   │                │                    │   儲存聊天狀態在 Realtime DB│                  │
   │                │                    │ ────────────────────────> |                 │
   │                │                    │           儲存完畢         │                  │
   │                │                    │ <──────────────────────── |                  │
   │                │    回傳已完成文字    │                           │                  │
   │                │<───────────────────│                           │                  │
   │   輸入 "!摘要"  │                    │                           │                  │
   │ ──────────────>│                    │                           │                  │
   │                │     傳送用戶指令     │                           │                  │
   │                │───────────────────>│                           │                  │
   │                │                    │          抓取聊天記錄       │                  │
   │                │                    │ ────────────────────────> |                  │
   │                │                    │           回傳清單         │                  │
   │                │                    │ <─────────────────────────|                  │
   │                │                    │               下prompt 進行摘要運算            │
   │                │                    │ ────────────────────────────────────────────>|
   │                │                    │                   回傳摘要清單                 │
   │                │                    │ <────────────────────────────────────────────|
   │                │   回傳摘要資訊至群組  │                           │                  │
   │                │<───────────────────│                           │                  │
  User           ┌─────┐          ┌──────┴───────┐               ┌────────┐          ┌──────┐
   ┌─┐           │Group│          │Webhook_Server│               │Firebase│          │Gemini│
   ║"│           └─────┘          └──────────────┘               └────────┘          └──────┘
   └┬┘
   ┌┼┐
    │
   ┌┴┐

開始使用

環境變數

在開始之前,您需要設定以下環境變數:

  • LINE_CHANNEL_SECRET: 您的 LINE Bot Channel 密鑰
  • LINE_CHANNEL_ACCESS_TOKEN: 您的 LINE Bot Channel 令牌
  • FIREBASE_URL: 您的 Firebase 資料庫 URL
  • GEMINI_API_KEY: 您的 Gemini API 金鑰

如果您不在生產環境,請使用 .env 檔案來設定這些變數。

使用方式

Run on Google Cloud

git clone https://github.com/louis70109/linebot-gemini-summarize.git

cd linebot-gemini-summarize/

gcloud run deploy my-linebot-summarize --source .

Q&A

遇到 AttributeError: type object 'MethodOptions' has no attribute 'RegisterExtension'

在此專案中有可能是套件相依過程有本版比較舊,因此建議使用 venv 之類的虛擬環境,重新安裝套件

python3 -m venv venv
source venv/bin/activate

pip install -r requirements.txt

部屬上 GCP 遇到 container 權限問題?

gcloud auth configure-docker # Y

授權

MIT

linebot-gemini-summarize's People

Contributors

louis70109 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.