Skip to content

Commit

Permalink
🐛 Fix insighter case with no subtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
larsyencken committed Sep 19, 2024
1 parent 9bbe577 commit c05de03
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/wizard/app_pages/datainsight_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ def get_trajectory_prompt(base_prompt: str, slug: str) -> str:
df_s = df.to_csv()

title = chart.config["title"]
subtitle = chart.config["subtitle"]
subtitle = chart.config.get("subtitle")
context = f"## {title}\n\n{subtitle}\n\n" if subtitle else f"## {title}n\n"

return f"{base_prompt}\n\n---\n\n## {title}\n\n{subtitle}\n\n{df_s}"
return f"{base_prompt}\n\n---\n\n{context}{df_s}"


(tab1, tab2) = st.tabs(["Insight from chart", "Explain raw data"])
Expand Down Expand Up @@ -167,6 +168,9 @@ def get_trajectory_prompt(base_prompt: str, slug: str) -> str:
help="Introduce the URL to a Grapher URL. Query parameters work!",
key="tab2_url",
)
if len(slugs) > 1:
st.warning("More than one slug selected, only the first one will be used")

slug = None if len(slugs) == 0 else slugs[0]

with st.expander("Edit the prompt"):
Expand Down

0 comments on commit c05de03

Please sign in to comment.