mirror of
https://github.com/awslabs/amazon-bedrock-agentcore-samples.git
synced 2025-09-08 20:50:46 +00:00
* feat(customer-support): updated code * Delete 02-use-cases/customer-support-assistant/Dockerfile Signed-off-by: Eashan Kaushik <50113394+EashanKaushik@users.noreply.github.com> * Update .gitignore Signed-off-by: Eashan Kaushik <50113394+EashanKaushik@users.noreply.github.com> * identity * /app/customersupport/agentcore/runtime_iam_role name changed issue#154 Signed-off-by: Eashan Kaushik <50113394+EashanKaushik@users.noreply.github.com> * Update README.md Signed-off-by: Eashan Kaushik <50113394+EashanKaushik@users.noreply.github.com> * Update README.md Signed-off-by: Eashan Kaushik <50113394+EashanKaushik@users.noreply.github.com> * Update README.md Signed-off-by: Eashan Kaushik <50113394+EashanKaushik@users.noreply.github.com> --------- Signed-off-by: Eashan Kaushik <50113394+EashanKaushik@users.noreply.github.com>
21 lines
721 B
Python
21 lines
721 B
Python
import re
|
|
|
|
|
|
def make_urls_clickable(text):
|
|
"""Convert URLs in text to clickable HTML links."""
|
|
url_pattern = r"https?://(?:[-\w.])+(?:\:[0-9]+)?(?:/(?:[\w/_.])*(?:\?(?:[\w&=%.])*)?(?:\#(?:[\w.])*)?)?"
|
|
|
|
def replace_url(match):
|
|
url = match.group(0)
|
|
return f'<a href="{url}" target="_blank" style="color:#4fc3f7;text-decoration:underline;">{url}</a>'
|
|
|
|
return re.sub(url_pattern, replace_url, text)
|
|
|
|
|
|
def create_safe_markdown_text(text, message_placeholder):
|
|
"""Create safe markdown text with proper encoding"""
|
|
safe_text = text.encode("utf-16", "surrogatepass").decode("utf-16")
|
|
message_placeholder.markdown(
|
|
safe_text.replace("\\n", "<br>"), unsafe_allow_html=True
|
|
)
|