new ai provider
This commit is contained in:
@@ -61,3 +61,21 @@ func RPGetCounter(db *laniakea.DatabaseContext, userId, waifuId int) int {
|
||||
i, _ := res.Int()
|
||||
return i
|
||||
}
|
||||
|
||||
func RPSetIndex(db *laniakea.DatabaseContext, userId, waifuId, index int) error {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.index", userId, waifuId)
|
||||
return db.Redis.Set(ctx, key, index, 0).Err()
|
||||
}
|
||||
func RPGetIndex(db *laniakea.DatabaseContext, userId, waifuId int) int {
|
||||
key := fmt.Sprintf("ai.chats.rp.%d.%d.index", userId, waifuId)
|
||||
res := db.Redis.Get(ctx, key)
|
||||
if res.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
i, err := res.Int()
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return i
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user