feat: update to June 2026 models (Claude Sonnet 4.6, Gemini 3.5 Flash), add glossary button, and implement cost factor quota & vision fallback
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m4s

This commit is contained in:
2026-06-14 11:05:53 +02:00
parent 5fd087979b
commit 136d40c7d8
10 changed files with 145 additions and 74 deletions

View File

@@ -501,19 +501,21 @@ def check_usage_limits(user: User) -> Dict[str, Any]:
}
def record_usage(user_id: str, pages_count: int, use_credits: bool = False) -> bool:
"""Record document translation usage"""
def record_usage(
user_id: str, pages_count: int, use_credits: bool = False, cost_factor: int = 1
) -> bool:
"""Record document translation usage with optional cost factor depending on AI model"""
user = get_user_by_id(user_id)
if not user:
return False
updates = {
"docs_translated_this_month": user.docs_translated_this_month + 1,
"pages_translated_this_month": user.pages_translated_this_month + pages_count,
"docs_translated_this_month": user.docs_translated_this_month + cost_factor,
"pages_translated_this_month": user.pages_translated_this_month + (pages_count * cost_factor),
}
if use_credits:
updates["extra_credits"] = max(0, user.extra_credits - pages_count)
updates["extra_credits"] = max(0, user.extra_credits - (pages_count * cost_factor))
result = update_user(user_id, updates)
return result is not None