DawnC commited on
Commit
2438acf
Β·
verified Β·
1 Parent(s): 5895031

Update response_processor.py

Browse files
Files changed (1) hide show
  1. response_processor.py +5 -5
response_processor.py CHANGED
@@ -1218,7 +1218,7 @@ class ResponseProcessor:
1218
  if not re.search(r'[.!?]', response):
1219
  raise ResponseProcessingError("Response lacks proper sentence structure")
1220
 
1221
- def remove_explanatory_notes(response: str, debug: bool = False) -> str:
1222
  """
1223
  移陀 LLM ε›žζ‡‰δΈ­ηš„θ§£ι‡‹ζ€§ζ³¨ι‡‹ε’Œε…§ιƒ¨θ™•η†ζ–‡ε­—
1224
 
@@ -1387,15 +1387,15 @@ class ResponseProcessor:
1387
  result = re.sub(r'\s+([,.!?])', r'\1', result)
1388
  result = result.strip()
1389
 
1390
- if debug:
1391
- print(f"Cleaning completed. Original length: {len(original_response)}, Final length: {len(result)}")
1392
 
1393
  return result if result else original_response
1394
 
1395
  except Exception as e:
1396
  # ε¦‚ζžœθ™•η†ιŽη¨‹δΈ­η™Όη”ŸιŒ―θͺ€οΌŒθΏ”ε›žεŽŸε§‹ζ–‡ε­—
1397
- if debug:
1398
- print(f"Error during cleaning: {str(e)}")
1399
  return original_response
1400
 
1401
  def get_processor_info(self) -> Dict[str, Any]:
 
1218
  if not re.search(r'[.!?]', response):
1219
  raise ResponseProcessingError("Response lacks proper sentence structure")
1220
 
1221
+ def remove_explanatory_notes(self, response: str, debug: bool = False) -> str:
1222
  """
1223
  移陀 LLM ε›žζ‡‰δΈ­ηš„θ§£ι‡‹ζ€§ζ³¨ι‡‹ε’Œε…§ιƒ¨θ™•η†ζ–‡ε­—
1224
 
 
1387
  result = re.sub(r'\s+([,.!?])', r'\1', result)
1388
  result = result.strip()
1389
 
1390
+ if debug and hasattr(self, 'logger'):
1391
+ self.logger.info(f"Cleaning completed. Original length: {len(original_response)}, Final length: {len(result)}")
1392
 
1393
  return result if result else original_response
1394
 
1395
  except Exception as e:
1396
  # ε¦‚ζžœθ™•η†ιŽη¨‹δΈ­η™Όη”ŸιŒ―θͺ€οΌŒθΏ”ε›žεŽŸε§‹ζ–‡ε­—
1397
+ if debug and hasattr(self, 'logger'):
1398
+ self.logger.error(f"Error during cleaning: {str(e)}")
1399
  return original_response
1400
 
1401
  def get_processor_info(self) -> Dict[str, Any]: