small changes
This commit is contained in:
@@ -38,3 +38,9 @@ func UpdateChatHistory(db *laniakea.DatabaseContext, chatId, role, message strin
|
||||
})
|
||||
return err
|
||||
}
|
||||
func GetChatHistorySize(db *laniakea.DatabaseContext, chatId string) (int64, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
col := database.GetMongoCollection(db, "rp_chat_messages")
|
||||
return col.CountDocuments(ctx, bson.M{"chat_id": chatId})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user