mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 05:10:38 +08:00
try-except
This commit is contained in:
@ -28,19 +28,24 @@ def get_setting(key: str) -> Any:
|
|||||||
except Exception:
|
except Exception:
|
||||||
return global_settings.get(key, None)
|
return global_settings.get(key, None)
|
||||||
|
|
||||||
|
|
||||||
def emphasize_header(text: str) -> str:
|
def emphasize_header(text: str) -> str:
|
||||||
# Finding the position of the first occurrence of ": "
|
try:
|
||||||
colon_position = text.find(": ")
|
# Finding the position of the first occurrence of ": "
|
||||||
|
colon_position = text.find(": ")
|
||||||
|
|
||||||
# Splitting the string and wrapping the first part in <strong> tags
|
# Splitting the string and wrapping the first part in <strong> tags
|
||||||
if colon_position != -1:
|
if colon_position != -1:
|
||||||
# Everything before the colon (inclusive) is wrapped in <strong> tags
|
# Everything before the colon (inclusive) is wrapped in <strong> tags
|
||||||
transformed_string = "<strong>" + text[:colon_position + 1] + "</strong>" + text[colon_position + 1:]
|
transformed_string = "<strong>" + text[:colon_position + 1] + "</strong>" + text[colon_position + 1:]
|
||||||
else:
|
else:
|
||||||
# If there's no ": ", return the original string
|
# If there's no ": ", return the original string
|
||||||
transformed_string = text
|
transformed_string = text
|
||||||
|
|
||||||
return transformed_string
|
return transformed_string
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().exception(f"Failed to emphasize header: {e}")
|
||||||
|
return text
|
||||||
|
|
||||||
def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
|
def convert_to_markdown(output_data: dict, gfm_supported: bool=True) -> str:
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user