Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -548,6 +548,10 @@ def display_bookmarks():
|
|
548 |
card_style = "border: 2px solid #00C851; background-color: rgba(0, 200, 81, 0.1);"
|
549 |
text_style = "color: var(--text-color);"
|
550 |
|
|
|
|
|
|
|
|
|
551 |
card_html = f'''
|
552 |
<div class="card" style="{card_style} padding: 15px; margin: 15px 0; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);">
|
553 |
<div class="card-content">
|
@@ -558,7 +562,7 @@ def display_bookmarks():
|
|
558 |
<p style="{text_style}"><strong>Category:</strong> {category}</p>
|
559 |
<p style="{text_style}"><strong>URL:</strong> <a href="{url}" target="_blank" style="{text_style}">{url}</a></p>
|
560 |
<p style="{text_style}"><strong>ETag:</strong> {etag}</p>
|
561 |
-
<p style="{text_style}"><strong>Summary:</strong> {
|
562 |
</div>
|
563 |
</div>
|
564 |
'''
|
@@ -857,6 +861,7 @@ def chatbot_response(user_query):
|
|
857 |
desc = f"{i}. Title: {bm['title']}\n URL: {bm['url']}\n Category: {bm['category']}\n Summary: {bm['summary']}"
|
858 |
bookmark_descriptions.append(desc)
|
859 |
|
|
|
860 |
prompt = f"""
|
861 |
User Query: {user_query}
|
862 |
|
@@ -928,7 +933,7 @@ def build_app():
|
|
928 |
# Deleting Bookmarks
|
929 |
delete_button.click(
|
930 |
fn=delete_selected_bookmarks,
|
931 |
-
inputs=gr.CheckboxGroup(label="Select Bookmarks to Delete", choices=[]),
|
932 |
outputs=[process_message, gr.Dropdown.update(), bookmarks_display]
|
933 |
)
|
934 |
|
@@ -936,7 +941,7 @@ def build_app():
|
|
936 |
edit_button.click(
|
937 |
fn=edit_selected_bookmarks_category,
|
938 |
inputs=[
|
939 |
-
gr.CheckboxGroup(label="Select Bookmarks to Edit", choices=[]),
|
940 |
category_dropdown
|
941 |
],
|
942 |
outputs=[process_message, gr.Dropdown.update(), bookmarks_display]
|
|
|
548 |
card_style = "border: 2px solid #00C851; background-color: rgba(0, 200, 81, 0.1);"
|
549 |
text_style = "color: var(--text-color);"
|
550 |
|
551 |
+
# Properly escape any backslashes if present in summary or other fields
|
552 |
+
# (Not strictly necessary here, but good practice)
|
553 |
+
summary_escaped = summary.replace('\\', '\\\\')
|
554 |
+
|
555 |
card_html = f'''
|
556 |
<div class="card" style="{card_style} padding: 15px; margin: 15px 0; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);">
|
557 |
<div class="card-content">
|
|
|
562 |
<p style="{text_style}"><strong>Category:</strong> {category}</p>
|
563 |
<p style="{text_style}"><strong>URL:</strong> <a href="{url}" target="_blank" style="{text_style}">{url}</a></p>
|
564 |
<p style="{text_style}"><strong>ETag:</strong> {etag}</p>
|
565 |
+
<p style="{text_style}"><strong>Summary:</strong> {summary_escaped}</p>
|
566 |
</div>
|
567 |
</div>
|
568 |
'''
|
|
|
861 |
desc = f"{i}. Title: {bm['title']}\n URL: {bm['url']}\n Category: {bm['category']}\n Summary: {bm['summary']}"
|
862 |
bookmark_descriptions.append(desc)
|
863 |
|
864 |
+
# **Corrected f-string with escaped backslashes**
|
865 |
prompt = f"""
|
866 |
User Query: {user_query}
|
867 |
|
|
|
933 |
# Deleting Bookmarks
|
934 |
delete_button.click(
|
935 |
fn=delete_selected_bookmarks,
|
936 |
+
inputs=gr.CheckboxGroup(label="Select Bookmarks to Delete", choices=[f"{i+1}. {bookmark['title']} (Category: {bookmark['category']})" for i, bookmark in enumerate(bookmarks)]),
|
937 |
outputs=[process_message, gr.Dropdown.update(), bookmarks_display]
|
938 |
)
|
939 |
|
|
|
941 |
edit_button.click(
|
942 |
fn=edit_selected_bookmarks_category,
|
943 |
inputs=[
|
944 |
+
gr.CheckboxGroup(label="Select Bookmarks to Edit", choices=[f"{i+1}. {bookmark['title']} (Category: {bookmark['category']})" for i, bookmark in enumerate(bookmarks)]),
|
945 |
category_dropdown
|
946 |
],
|
947 |
outputs=[process_message, gr.Dropdown.update(), bookmarks_display]
|