edit note title and show delete warning
This commit is contained in:
parent
02c168615c
commit
2f63cea105
4 changed files with 16 additions and 6 deletions
|
|
@ -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)}")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue