Spaces:
Sleeping
Sleeping
| # | |
| # SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org> | |
| # SPDX-License-Identifier: Apache-2.0 | |
| # | |
| from config import MAXIMUM_INPUT_LENGTH | |
| def validate_text_input(text_content): | |
| if not text_content or not isinstance(text_content, str): | |
| return False, "" | |
| cleaned_text = text_content.strip() | |
| if not cleaned_text: | |
| return False, "" | |
| if len(cleaned_text) > MAXIMUM_INPUT_LENGTH: | |
| return False, f"Input exceeds maximum length of {MAXIMUM_INPUT_LENGTH} characters." | |
| return True, cleaned_text |