캐릭터 챗봇 #338

Merged
klaus merged 119 commits from test into main 2025-09-10 06:08:47 +00:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 37ac52116a - Show all commits

View File

@ -12,7 +12,7 @@ class ChatQuotaService(
) {
companion object {
private const val FREE_BUCKET = 10
private const val RECHARGE_HOURS = 6L
private const val RECHARGE_HOURS = 1L
}
data class QuotaStatus(
@ -41,20 +41,20 @@ class ChatQuotaService(
quota.remainingFree > 0 -> {
quota.remainingFree -= 1
if (quota.remainingFree + quota.remainingPaid == 0 && quota.nextRechargeAt == null) {
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
}
}
quota.remainingPaid > 0 -> {
quota.remainingPaid -= 1
if (quota.remainingFree + quota.remainingPaid == 0 && quota.nextRechargeAt == null) {
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
}
}
else -> {
if (quota.nextRechargeAt == null) {
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
}
throw SodaException("채팅 가능 횟수가 모두 소진되었습니다. 다음 무료 충전 이후 이용해주세요.")
}