small changes

This commit is contained in:
2026-01-21 22:02:48 +03:00
parent b8391e9c6b
commit 3489d0fff2
2 changed files with 33 additions and 0 deletions

View File

@@ -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})
}