bibibi12345 commited on
Commit
7fe287f
·
1 Parent(s): 072c66b
Files changed (1) hide show
  1. app/main.py +16 -0
app/main.py CHANGED
@@ -932,10 +932,26 @@ 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
  text = text.replace("``", "")
 
 
 
 
 
939
  return text
940
 
941
  # --- 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
+
943
+
944
+ # Remove other obfuscation characters
945
  text = text.replace("♩", "")
946
  text = text.replace("`♡`", "") # Handle the backtick version too
947
  text = text.replace("♡", "")
948
+ text = text.replace("` `", "")
949
  text = text.replace("``", "")
950
+ text = text.replace("`", "")
951
+
952
+ # Restore triple backticks
953
+ text = text.replace(placeholder, "```")
954
+
955
  return text
956
 
957
  # --- Response Format Conversion ---