Skip to content

Commit

Permalink
Merge pull request #5 from kkdai/cicd_refine
Browse files Browse the repository at this point in the history
chore: refactor GitHub action names and remove unused files
  • Loading branch information
kkdai authored Jan 12, 2024
2 parents 311bc1d + d3a7ae2 commit f1b398a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/heroku.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy
name: Heroku Deploy

on:
release:
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/render_deploy.yml

This file was deleted.

7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ LINE Bot 使用 Google Gemini Pro 來做的名片小幫手

[![GoDoc](https://godoc.org/github.com/kkdai/linebot-gemini-pro.svg?status.svg)](https://godoc.org/github.com/kkdai/LineBotTemplate) ![Go](https://github.com/kkdai/linebot-gemini-pro/workflows/Go/badge.svg) [![goreportcard.com](https://goreportcard.com/badge/github.com/kkdai/linebot-gemini-pro)](https://goreportcard.com/report/github.com/kkdai/linebot-gemini-pro)

<img src="img/cook.jpeg" style="zoom:25%;" />

# LINE Bot Screen

<img src="img/app_1.png" style="zoom:25%;" /><img src="img/app_2.png" style="zoom:25%;" />

## 如何快速架設在自己平台

請根據以下的流程,來直接透過開源的程式碼來架設一個 LINEBot 跟 GCP STT 與 GCS (Google Cloud Storage) 的結合。
Expand All @@ -31,9 +27,6 @@ LINE Bot 使用 Google Gemini Pro 來做的名片小幫手

2.1. 按下: [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) 來部署到你的 Heroku 帳號

2.2 按下: [![Deploy to Render](http://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy)
來部署到你的 Render 帳號

3. 除了填寫 App Name 以外,以下的參數必須要填入才能完整運行。

1. **ChannelAccessToken**: 請到 LINE Developers Console issue 一個。
Expand Down
6 changes: 4 additions & 2 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ func replyText(replyToken, text string) error {
// callbackHandler: Handle callback from LINE server.
func callbackHandler(w http.ResponseWriter, r *http.Request) {
card_prompt := os.Getenv("CARD_PROMPT")
channelToken = os.Getenv("ChannelAccessToken")
if card_prompt == "" {
card_prompt = ImagePrompt
}

cb, err := webhook.ParseRequest(os.Getenv("ChannelSecret"), r)
cb, err := webhook.ParseRequest(ChannelSecret, r)
if err != nil {
if err == linebot.ErrInvalidSignature {
w.WriteHeader(400)
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
var bucketName string
var geminiKey string
var channelToken string
var ChannelSecret string

var bot *messaging_api.MessagingApiAPI
var blob *messaging_api.MessagingApiBlobAPI
Expand All @@ -32,6 +33,7 @@ func main() {
var err error
geminiKey = os.Getenv("GOOGLE_GEMINI_API_KEY")
channelToken = os.Getenv("ChannelAccessToken")
ChannelSecret = os.Getenv("ChannelSecret")

bot, err = messaging_api.NewMessagingApiAPI(channelToken)
if err != nil {
Expand Down

0 comments on commit f1b398a

Please sign in to comment.