ai work
This commit is contained in:
@@ -47,3 +47,17 @@ func RPGetChatPrompt(db *laniakea.DatabaseContext, userId, waifuId int) string {
|
||||
}
|
||||
return res.Val()
|
||||
}
|
||||
|
||||
func RPSetCounter(db *laniakea.DatabaseContext, userId, waifuId, counter int) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.counter", userId, waifuId)
|
||||
return db.Redis.Set(ctx, key, counter, 0).Err()
|
||||
}
|
||||
func RPGetCounter(db *laniakea.DatabaseContext, userId, waifuId int) int {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.counter", userId, waifuId)
|
||||
res := db.Redis.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
i, _ := res.Int()
|
||||
return i
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user