Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit f422497

Browse files
author
FuseFairy
committed
style: update regular expressions for text cleanup
1 parent cf6616d commit f422497

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bing_chat/response.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ async def send_message(chatbot, user_message: str, image: str, conversation_styl
7171
suggest_responses = reply["suggestions"]
7272
text = f"{reply['text']}"
7373
urls = re.findall(r'\[(\d+)\. (.*?)\]\((https?://.*?)\)', reply["sources_link"])
74-
74+
7575
text = re.sub(r'\[\^(\d+)\^\]', '', text)
76-
text = re.sub(r'\[.*?\]\(.*?\)', '', text)
76+
text = re.sub(r':\s*\[[^\]]*\]\([^\)]*\)', '', text)
77+
text = re.sub(r'<[^>]*>', '', text)
7778

7879
# Make URL Embed, if available
7980
if len(urls) > 0:

0 commit comments

Comments
 (0)