Skip to content

Commit

Permalink
fixed regex DeprecationWarning: invalid escape sequence '\['
Browse files Browse the repository at this point in the history
  • Loading branch information
aledipa authored Sep 24, 2023
1 parent 5f3de9d commit eef9141
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/FreeGPT4_Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ async def index() -> str:
# Cleans the response from the resources links
# INFO: Unsupported escape sequence in string literal
if (args.remove_sources):
if re.search("\[\^[0-9]+\^\]\[[0-9]+\]", resp_str):
if re.search(r"\[\^[0-9]+\^\]\[[0-9]+\]", resp_str):
resp_str = resp_str.split("\n\n")
if len(resp_str) > 1:
resp_str.pop(0)
resp_str = re.sub("\[\^[0-9]+\^\]\[[0-9]+\]", "", str(resp_str[0]))
resp_str = re.sub(r"\[\^[0-9]+\^\]\[[0-9]+\]", "", str(resp_str[0]))
# Returns the response
return resp_str
# return "<p id='response'>" + resp + "</p>" # Uncomment if preferred
Expand Down

0 comments on commit eef9141

Please sign in to comment.