This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
如何登入賣家中心? | |
①至賣家中心後台:<https://sellercenter.line.biz/giftshop> ,點選「登入ID」 | |
②點選「使用LINE帳號登入」 | |
③輸入帳號、密碼 | |
• 電子郵件帳號:<[email protected]> (前方代碼為廠商自訂,後方固定為@l.ine) | |
• 如無法順利登入可透過首頁上的「忘記密碼」來取得登入資訊。 | |
無法登入賣家中心 | |
賣家中心的網址2022/07改版後更新為: <https://sellercenter.line.biz/giftshop/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import aiohttp | |
from fastapi import Request, FastAPI, HTTPException | |
from langchain.chat_models import ChatOpenAI | |
from langchain.chains import ConversationChain | |
from langchain.memory import ConversationBufferWindowMemory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getPOIsFlexBubble(records ResponsePOI) []*linebot.BubbleContainer { | |
log.Println("getPOIsFlexBubble") | |
if len(records.Pois) == 0 { | |
log.Println("err1") | |
return nil | |
} | |
var columnList []*linebot.BubbleContainer | |
for _, result := range records.Pois { | |
log.Println("Add flex:", result.Name, result.CoverPhoto, result.PoiURL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 如果有預設 DABTASE_URL 就建立 PostGresSQL; 反之則建立 Mem DB | |
pSQL := os.Getenv("DATABASE_URL") | |
if pSQL != "" { | |
summaryQueue = NewPGSql(pSQL) | |
} else { | |
summaryQueue = NewMemDB() | |
} | |
//.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 如果有預設 DABTASE_URL 就建立 PostGresSQL; 反之則建立 Mem DB | |
pSQL := os.Getenv("DATABASE_URL") | |
if pSQL != "" { | |
summaryQueue = NewPGSql(pSQL) | |
} else { | |
summaryQueue = NewMemDB() | |
} | |
// DB Access |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PGSqlDB struct { | |
Db *pg.DB | |
} | |
func (mdb *PGSqlDB) ReadGroupInfo(roomID string) GroupData { | |
pgsql := &DBStorage{ | |
RoomID: roomID, | |
} | |
if ret, err := pgsql.Get(mdb); err == nil { | |
return ret.Dataset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type MemStorage map[string]GroupData | |
type MemDB struct { | |
db MemStorage | |
} | |
func (mdb *MemDB) ReadGroupInfo(roomID string) GroupData { | |
return mdb.db[roomID] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type GroupDB interface { | |
ReadGroupInfo(string) GroupData | |
AppendGroupInfo(string, MsgDetail) | |
} | |
type MsgDetail struct { | |
MsgText string | |
UserName string | |
Time time.Time | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// 把聊天群組裡面的訊息都捲出來(依照先後順序) | |
oriContext := "" | |
q := summaryQueue[event.Source.GroupID] | |
for _, m := range q { | |
// [xxx]: 他講了什麼... 時間 | |
oriContext = oriContext + fmt.Sprintf("[%s]: %s . %s\n", m.UserName, m.MsgText, m.Time.Local().UTC().Format("2006-01-02 15:04:05")) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
gpt3 "github.com/sashabaranov/go-gpt3" | |
) | |