fix: prevent errors when transformations is empty

This commit is contained in:
LUIS NOVO 2025-06-10 11:53:07 -03:00
parent e3d9bee3b1
commit e6f7a6b0e6

View file

@ -58,6 +58,7 @@ def source_panel(source_id: str, notebook_id=None, modal=False):
with c2: with c2:
transformations = Transformation.get_all(order_by="name asc") transformations = Transformation.get_all(order_by="name asc")
if transformations:
with st.container(border=True): with st.container(border=True):
transformation = st.selectbox( transformation = st.selectbox(
"Run a transformation", "Run a transformation",
@ -65,7 +66,7 @@ def source_panel(source_id: str, notebook_id=None, modal=False):
key=f"transformation_{source.id}", key=f"transformation_{source.id}",
format_func=lambda x: x.name, format_func=lambda x: x.name,
) )
st.caption(transformation.description) st.caption(transformation.description if transformation else "")
if st.button("Run"): if st.button("Run"):
asyncio.run( asyncio.run(
transform_graph.ainvoke( transform_graph.ainvoke(
@ -73,6 +74,10 @@ def source_panel(source_id: str, notebook_id=None, modal=False):
) )
) )
st.rerun(scope="fragment" if modal else "app") st.rerun(scope="fragment" if modal else "app")
else:
st.markdown(
"No transformations created yet. Create new Transformation to use this feature."
)
if not model_manager.embedding_model: if not model_manager.embedding_model:
help = ( help = (