Update app/main.py
Browse files- app/main.py +12 -2
app/main.py
CHANGED
|
@@ -932,11 +932,21 @@ def create_generation_config(request: OpenAIRequest) -> Dict[str, Any]:
|
|
| 932 |
def deobfuscate_text(text: str) -> str:
|
| 933 |
"""Removes specific obfuscation characters from text."""
|
| 934 |
if not text: return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 935 |
text = text.replace("♩", "")
|
| 936 |
text = text.replace("`♡`", "") # Handle the backtick version too
|
| 937 |
text = text.replace("♡", "")
|
| 938 |
-
|
| 939 |
-
text = re.sub(r'(?<!`)``(?!`)', '', text)
|
| 940 |
return text
|
| 941 |
|
| 942 |
# --- Response Format Conversion ---
|
|
|
|
| 932 |
def deobfuscate_text(text: str) -> str:
|
| 933 |
"""Removes specific obfuscation characters from text."""
|
| 934 |
if not text: return text
|
| 935 |
+
# Define a placeholder unlikely to be in the text
|
| 936 |
+
placeholder = "___TRIPLE_BACKTICK_PLACEHOLDER___"
|
| 937 |
+
|
| 938 |
+
# Protect triple backticks
|
| 939 |
+
text = text.replace("```", placeholder)
|
| 940 |
+
# Remove double backticks
|
| 941 |
+
text = text.replace("``", "")
|
| 942 |
+
# Restore triple backticks
|
| 943 |
+
text = text.replace(placeholder, "```")
|
| 944 |
+
|
| 945 |
+
# Remove other obfuscation characters
|
| 946 |
text = text.replace("♩", "")
|
| 947 |
text = text.replace("`♡`", "") # Handle the backtick version too
|
| 948 |
text = text.replace("♡", "")
|
| 949 |
+
|
|
|
|
| 950 |
return text
|
| 951 |
|
| 952 |
# --- Response Format Conversion ---
|