Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ wizard: expert #3317

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions apps/wizard/app_pages/chart_diff/chart_diff_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@
gm.ChartStatus.APPROVED.value: {
"label": "Approve",
"color": "green",
# "icon": ":material/done_outline:",
"icon": "✅",
},
gm.ChartStatus.REJECTED.value: {
"label": "Reject",
"color": "red",
# "icon": ":material/delete:",
"icon": "❌",
},
gm.ChartStatus.PENDING.value: {
"label": "Pending",
"color": "gray",
# "icon": ":material/schedule:",
"icon": "⏳",
},
}
Expand Down Expand Up @@ -89,20 +92,20 @@ def box_label(self):

This contains the state of the approval (by means of an emoji), the slug of the chart, and any tags (like "NEW" or "DRAFT").
"""
label = self.diff.slug
label = f"{self.diff.slug} "
tags = []
if self.diff.is_new:
tags.append(" :blue-background[**NEW**]")
tags.append(" :blue-background[:material/grade: **NEW**]")
if self.diff.is_draft:
tags.append(" :gray-background[**DRAFT**]")
tags.append(" :gray-background[:material/draft: **DRAFT**]")
for change in self.diff.change_types:
tags.append(f":red-background[**{change.upper()} CHANGE**]")
tags.append(f":red-background[:material/refresh: **{change.upper()} CHANGE**]")

# Add TAG if modified and no change_types is provided
if (self.diff.is_modified) and (tags == []):
label += ":break[:rainbow-background[**UNKNOWN -- REPORT THIS**]]"
label += ":rainbow-background[**UNKNOWN -- REPORT THIS**]"
else:
label += f":break[{' '.join(tags)}]"
label += f"{' '.join(tags)}"
return label

@property
Expand Down Expand Up @@ -497,7 +500,7 @@ def _show(self) -> None:

# SHOW MODIFIED CHART
if self.diff.is_modified:
tab1, tab2, tab3 = st.tabs(["Charts", "Config diff", "Change history"])
tab1, tab2, tab3 = st.tabs(["Charts", "Config diff", "Status log"])
with tab1:
self._show_chart_comparison()
with tab2:
Expand All @@ -507,7 +510,7 @@ def _show(self) -> None:

# SHOW NEW CHART
elif self.diff.is_new:
tab1, tab2 = st.tabs(["Chart", "Change history"])
tab1, tab2 = st.tabs(["Chart", "Status log"])
with tab1:
self._show_chart_comparison()
with tab2:
Expand Down
3 changes: 2 additions & 1 deletion apps/wizard/app_pages/expert/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def read_page_md(page_path: str) -> str:
"""

# DATASETTE ORACLE
# TODO: Schema should be auto-generated. Maybe extract from http://analytics/private.json? Problem: how can one get the variable names linking tables?
SYSTEM_PROMPT_DATASETTE = """
## Datasette Oracle V2

Expand Down Expand Up @@ -635,5 +636,5 @@ def read_page_md(page_path: str) -> str:

Your job is to create a SQL query for the user that answers their question given the schema above. You may ask the user for clarification, e.g. if it is unclear if unpublished items should be included (when applicable) or if there is ambiguity in which tables to use to answer a question.

Upon generating a query, Datasette Oracle will always provide the SQL query both as text and as a clickable Datasette link, formatted for the user's convenience. The datasette URL is http://datasette-private and the database name is owid. An example query to get all rows from the algolia_searches_by_week table is this one that demonstrates the escaping: `http://datasette-private/owid?sql=select+*+from+algolia_searches_by_week` Remember, you cannot actually run the SQL query, you are just to output the query as text and a datasette link that will run that query!
Upon generating a query, Datasette Oracle will always provide the SQL query both as text and as a clickable Datasette link, formatted for the user's convenience. The datasette URL is http://analytics/private and the database name is owid. An example query to get all rows from the algolia_searches_by_week table is this one that demonstrates the escaping: `http://analytics/private?sql=select+*+from+algolia_searches_by_week` Remember, you cannot actually run the SQL query, you are just to output the query as text and a datasette link that will run that query!
"""
Loading