Skip to content

Instantly share code, notes, and snippets.

View kkdai's full-sized avatar

Evan Lin kkdai

View GitHub Profile
@kkdai
kkdai / github-isssue-rag-langchain.ipynb
Last active February 21, 2024 03:36
Github Issues LangChain RAG Q&A 的 Colab
View github-isssue-rag-langchain.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kkdai
kkdai / devday2023.ipynb
Created November 8, 2023 16:04
devday2023.ipynb
View devday2023.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pdf.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View qa.txt
如何登入賣家中心?
①至賣家中心後台:<https://sellercenter.line.biz/giftshop> ,點選「登入ID」
②點選「使用LINE帳號登入」
③輸入帳號、密碼
• 電子郵件帳號:<XXX@l.ine> (前方代碼為廠商自訂,後方固定為@l.ine)
• 如無法順利登入可透過首頁上的「忘記密碼」來取得登入資訊。
無法登入賣家中心
賣家中心的網址2022/07改版後更新為: <https://sellercenter.line.biz/giftshop/>
View langchain_mem.py
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
View poi.go
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)
View data_process.go
// 如果有預設 DABTASE_URL 就建立 PostGresSQL; 反之則建立 Mem DB
pSQL := os.Getenv("DATABASE_URL")
if pSQL != "" {
summaryQueue = NewPGSql(pSQL)
} else {
summaryQueue = NewMemDB()
}
//....
View select_db.go
// 如果有預設 DABTASE_URL 就建立 PostGresSQL; 反之則建立 Mem DB
pSQL := os.Getenv("DATABASE_URL")
if pSQL != "" {
summaryQueue = NewPGSql(pSQL)
} else {
summaryQueue = NewMemDB()
}
// DB Access
View pgsql_db.go
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
View memory_db.go
type MemStorage map[string]GroupData
type MemDB struct {
db MemStorage
}
func (mdb *MemDB) ReadGroupInfo(roomID string) GroupData {
return mdb.db[roomID]
}