feat: add STARROCKS_CHART_DEFAULT_FORMAT env var for query_and_plotly_chart#44
Open
DanRoscigno wants to merge 1 commit into
Open
feat: add STARROCKS_CHART_DEFAULT_FORMAT env var for query_and_plotly_chart#44DanRoscigno wants to merge 1 commit into
DanRoscigno wants to merge 1 commit into
Conversation
…_chart The `format` argument of `query_and_plotly_chart` was hardcoded to default to "jpeg", so callers that want a saved interactive HTML chart had to pass `format="html"` on every call. There was no way to change the default. Add a `STARROCKS_CHART_DEFAULT_FORMAT` environment variable that sets the default format used when `format` is omitted. Values are validated against json|png|jpeg|jpg|html, `jpg` is normalized to `jpeg`, and invalid values fall back to `jpeg` with a logged warning. Behavior is unchanged when the variable is unset (still `jpeg`), and an explicit `format` argument still takes precedence. Also document the new variable in the README along with the two existing but previously undocumented chart variables, STARROCKS_CHART_OUTPUT_DIR and STARROCKS_CHART_INCLUDE_PLOTLYJS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
query_and_plotly_chart'sformatargument is hardcoded to default tojpeg(an inline image; no file is written). Callers that want a saved interactive HTML chart must therefore passformat="html"on every call — there is currently no way to change the default.This PR adds a
STARROCKS_CHART_DEFAULT_FORMATenvironment variable that controls the default format used whenformatis omitted. This mirrors the existingSTARROCKS_CHART_OUTPUT_DIR/STARROCKS_CHART_INCLUDE_PLOTLYJSchart configuration vars.Behavior
STARROCKS_CHART_DEFAULT_FORMAT; valid values arejson | png | jpeg | jpg | html.jpgis normalized tojpeg.jpegwith a logged warning (server still starts).jpeg, so existing behavior is fully preserved.formatargument on the tool call still takes precedence over the env var.Example — always produce a saved interactive chart:
Docs
Documents the new variable in the README, plus the two existing-but-undocumented chart variables (
STARROCKS_CHART_OUTPUT_DIR,STARROCKS_CHART_INCLUDE_PLOTLYJS).Testing
python -m astparse check onserver.pypasses.html,jpeg,JPG→jpeg,png,json, whitespace trimming (" HTML "→html), and invalid (svg→jpeg+ warning) all behave as expected.🤖 Generated with Claude Code