diff --git a/backend/prompt.py b/backend/prompt.py index 6c35132..10ed6db 100644 --- a/backend/prompt.py +++ b/backend/prompt.py @@ -37,8 +37,13 @@ def _sanitize_language_id(language_id: str) -> str: def _prepare_context(prefix: str, suffix: str) -> Tuple[str, str]: """ Prepare prefix/suffix for model completion context. + Filter out potential web-scraping or legacy artifacts like
,
, . """ - return prefix, suffix + import re + br_pattern = re.compile(r'', re.IGNORECASE) + clean_prefix = br_pattern.sub('', prefix or "") + clean_suffix = br_pattern.sub('', suffix or "") + return clean_prefix, clean_suffix def prepare_prompt_context(prefix: str, suffix: str) -> Tuple[str, str]: