MCPcopy Index your code
hub / github.com/caesarHQ/textSQL / modify_visualization

Function modify_visualization

byod/api/app/visualization/routes.py:24–39  ·  view source on GitHub ↗

Change Vega-Lite spec based on a command

()

Source from the content-addressed store, hash-verified

22
23@bp.route('/text_to_viz', methods=['POST'])
24def modify_visualization():
25 """
26 Change Vega-Lite spec based on a command
27 """
28 request_body = request.get_json()
29 natural_language_command = request_body.get('natural_language_command')
30 vega_lite_spec = request_body.get('vega_lite_spec')
31
32 if not natural_language_command:
33 return make_response(jsonify({"error": "`natural_language_command` is missing from request body"}), 400)
34
35 if not vega_lite_spec:
36 return make_response(jsonify({"error": "`vega_lite_spec` is missing from request body"}), 400)
37
38 changed_vega = get_changed_vega(natural_language_command, vega_lite_spec)
39 return make_response(jsonify({"changed_vega": changed_vega}), 200)

Callers

nothing calls this directly

Calls 1

get_changed_vegaFunction · 0.85

Tested by

no test coverage detected