siddhartharya commited on
Commit
c7528fd
·
verified ·
1 Parent(s): f3ef120

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -861,12 +861,14 @@ def chatbot_response(user_query):
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
 
868
  Relevant Bookmarks:
869
- {'\\n\\n'.join(bookmark_descriptions)}
870
 
871
  Please provide a helpful response that:
872
  1. Identifies the most relevant bookmarks for the query
@@ -933,7 +935,7 @@ def build_app():
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,7 +943,7 @@ def build_app():
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]
 
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
+ # Precompute the joined descriptions to avoid backslashes in f-string expressions
865
+ joined_bookmark_descriptions = '\\n\\n'.join(bookmark_descriptions)
866
+
867
  prompt = f"""
868
  User Query: {user_query}
869
 
870
  Relevant Bookmarks:
871
+ {joined_bookmark_descriptions}
872
 
873
  Please provide a helpful response that:
874
  1. Identifies the most relevant bookmarks for the query
 
935
  # Deleting Bookmarks
936
  delete_button.click(
937
  fn=delete_selected_bookmarks,
938
+ inputs=gr.CheckboxGroup(label="Select Bookmarks to Delete", choices=[]),
939
  outputs=[process_message, gr.Dropdown.update(), bookmarks_display]
940
  )
941
 
 
943
  edit_button.click(
944
  fn=edit_selected_bookmarks_category,
945
  inputs=[
946
+ gr.CheckboxGroup(label="Select Bookmarks to Edit", choices=[]),
947
  category_dropdown
948
  ],
949
  outputs=[process_message, gr.Dropdown.update(), bookmarks_display]