add selectbox for transformations
This commit is contained in:
parent
817b1bc7f9
commit
bfd5efcc53
1 changed files with 14 additions and 10 deletions
|
|
@ -44,17 +44,21 @@ def source_panel(source_id: str, modal=False):
|
||||||
|
|
||||||
with c2:
|
with c2:
|
||||||
transformations = Transformation.get_all()
|
transformations = Transformation.get_all()
|
||||||
for transformation in transformations["source_insights"]:
|
transformation = st.selectbox(
|
||||||
if st.button(
|
"Run a transformation",
|
||||||
transformation["name"], help=transformation["description"]
|
transformations["source_insights"],
|
||||||
):
|
key=f"transformation_{source.id}",
|
||||||
result = run_patterns(source.full_text, transformation["patterns"])
|
format_func=lambda x: x["name"],
|
||||||
source.add_insight(
|
)
|
||||||
transformation["insight_type"], surreal_clean(result)
|
st.caption(transformation["description"])
|
||||||
)
|
if st.button("Run"):
|
||||||
st.rerun(scope="fragment" if modal else "app")
|
result = run_patterns(source.full_text, transformation["patterns"])
|
||||||
|
source.add_insight(
|
||||||
|
transformation["insight_type"], surreal_clean(result)
|
||||||
|
)
|
||||||
|
st.rerun(scope="fragment" if modal else "app")
|
||||||
|
|
||||||
if st.button(
|
if source.embedded_chunks == 0 and st.button(
|
||||||
"Embed vectors",
|
"Embed vectors",
|
||||||
icon="🦾",
|
icon="🦾",
|
||||||
disabled=source.embedded_chunks > 0,
|
disabled=source.embedded_chunks > 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue