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

fix: draw figure bug #495

Merged
merged 2 commits into from
Jun 18, 2024
Merged
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
7 changes: 2 additions & 5 deletions src/vanna/flask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,12 @@ def download_csv(user: any, id: str, df):
def generate_plotly_figure(user: any, id: str, df, question, sql):
chart_instructions = flask.request.args.get('chart_instructions')

if chart_instructions is not None:
question = f"{question}. When generating the chart, use these special instructions: {chart_instructions}"

try:
# If chart_instructions is not set then attempt to retrieve the code from the cache
if chart_instructions is None or len(chart_instructions) == 0:
code = self.cache.get(id=id, field="plotly_code")

if code is None:
else:
question = f"{question}. When generating the chart, use these special instructions: {chart_instructions}"
code = vn.generate_plotly_code(
question=question,
sql=sql,
Expand Down