fix: prevent migration check from occurring on every page load
This commit is contained in:
parent
0aacbcaccb
commit
ca589e933d
1 changed files with 13 additions and 9 deletions
|
|
@ -98,15 +98,19 @@ def setup_stream_state(current_notebook: Notebook) -> ChatSession:
|
||||||
|
|
||||||
|
|
||||||
def check_migration():
|
def check_migration():
|
||||||
logger.critical("Running migration check")
|
if "migration_required" not in st.session_state:
|
||||||
mm = MigrationManager()
|
st.session_state["migration_required"] = None
|
||||||
if mm.needs_migration:
|
logger.critical("Running migration check")
|
||||||
st.warning("The Open Notebook database needs a migration to run properly.")
|
mm = MigrationManager()
|
||||||
if st.button("Run Migration"):
|
if mm.needs_migration:
|
||||||
mm.run_migration_up()
|
st.warning("The Open Notebook database needs a migration to run properly.")
|
||||||
st.success("Migration successful")
|
if st.button("Run Migration"):
|
||||||
st.rerun()
|
mm.run_migration_up()
|
||||||
st.stop()
|
st.success("Migration successful")
|
||||||
|
st.rerun()
|
||||||
|
st.stop()
|
||||||
|
else:
|
||||||
|
st.session_state["migration_required"] = False
|
||||||
|
|
||||||
|
|
||||||
def check_models(only_mandatory=True, stop_on_error=True):
|
def check_models(only_mandatory=True, stop_on_error=True):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue