diff --git a/routes/translate_routes.py b/routes/translate_routes.py index fcba732..8a9a7e3 100644 --- a/routes/translate_routes.py +++ b/routes/translate_routes.py @@ -573,13 +573,28 @@ async def translate_document_v1( if prompt_id in ("null", "undefined", ""): prompt_id = None if file_url in ("null", "undefined", ""): file_url = None - # Story 3.12 / Bugfix: If user is on the free tier, they might have stale Pro features + # Story 3.12 / Bugfix: If user is on the free tier, they might have stale Pro features # in their frontend localStorage (e.g., they downgraded, or switched accounts). - # Instead of hard-blocking the translation, we simply strip the Pro features. + # These features require a paid plan. if tier == "free": - glossary_id = None - custom_prompt = None - prompt_id = None + if glossary_id: + raise TranslateEndpointError( + code=TranslateEndpointError.PRO_FEATURE_REQUIRED, + message="Glossaries are reserved for Pro users.", + details={"feature": "glossary_id", "tier": tier}, + ) + if custom_prompt: + raise TranslateEndpointError( + code=TranslateEndpointError.PRO_FEATURE_REQUIRED, + message="Custom prompts are reserved for Pro users.", + details={"feature": "custom_prompt", "tier": tier}, + ) + if prompt_id: + raise TranslateEndpointError( + code=TranslateEndpointError.PRO_FEATURE_REQUIRED, + message="Saved prompts are reserved for Pro users.", + details={"feature": "prompt_id", "tier": tier}, + ) if file_url: if tier == "free":