diff --git a/open_notebook/domain.py b/open_notebook/domain.py index ff0b700..33fb203 100644 --- a/open_notebook/domain.py +++ b/open_notebook/domain.py @@ -81,7 +81,10 @@ class ObjectModel(BaseModel): # Update the current instance with the result for key, value in repo_result[0].items(): if hasattr(self, key): - setattr(self, key, value) + if isinstance(getattr(self, key), BaseModel): + setattr(self, key, type(getattr(self, key))(**value)) + else: + setattr(self, key, value) except Exception as e: logger.error(f"Error saving {self.__class__.table_name}: {str(e)}") diff --git a/pages/2_📒_Notebooks.py b/pages/2_📒_Notebooks.py index ef3e6b1..60c9d4a 100644 --- a/pages/2_📒_Notebooks.py +++ b/pages/2_📒_Notebooks.py @@ -33,12 +33,12 @@ def notebook_header(current_notebook): value=current_description, placeholder="Add as much context as you can as this will be used by the AI to generate insights.", ) - if st.button("Save", key="edit_notebook"): + if st.button("Save", icon="💾", key="edit_notebook"): current_notebook.name = notebook_name current_notebook.description = notebook_description current_notebook.save() st.rerun() - if st.button("Delete forever", icon="☠️"): + if st.button("Delete forever", type="primary", icon="☠️"): current_notebook.delete() st.session_state["current_notebook"] = None st.rerun() diff --git a/stream_app/note.py b/stream_app/note.py index 3632dae..b085cad 100644 --- a/stream_app/note.py +++ b/stream_app/note.py @@ -44,7 +44,7 @@ def note_panel(session_id=None, note_id=None): if not note.id: note.add_to_notebook(st.session_state[session_id]["notebook"].id) st.rerun() - if st.button("Delete", key=f"delete_note_{note_id}"): + if st.button("Delete", type="primary", key=f"delete_note_{note_id}"): logger.debug("Deleting note") note.delete() st.rerun() diff --git a/stream_app/source.py b/stream_app/source.py index 6fffc65..9a68f7b 100644 --- a/stream_app/source.py +++ b/stream_app/source.py @@ -30,6 +30,11 @@ def source_panel(source_id): if not source: st.error("Source not found") return + current_title = source.title if source.title else "No Title" + source.title = st.text_input("Title", value=current_title) + if source.title != current_title: + st.toast("Saved new Title") + source.save() process_tab, source_tab = st.tabs(["Process", "Source"]) with process_tab: @@ -48,7 +53,9 @@ def source_panel(source_id): for insight in source.insights: with st.expander(f"**{insight.insight_type}**"): st.markdown(insight.content) - if st.button("Delete", key=f"delete_insight_{insight.id}"): + if st.button( + "Delete", type="primary", key=f"delete_insight_{insight.id}" + ): insight.delete() st.rerun(scope="fragment") @@ -75,7 +82,7 @@ def source_panel(source_id): source.vectorize() st.success("Embedding complete") - if st.button("Delete", icon="🗑️"): + if st.button("Delete", type="primary", icon="🗑️"): source.delete() st.rerun()