Skip to main content

generate_chart_spec

Function generate_chart_spec 

Source
async fn generate_chart_spec(
    pool: Data<PgPool>,
    app_conf: Data<ApplicationConfiguration>,
    user: AuthUser,
    payload: Json<ChartSpecGenerationRequest>,
) -> ControllerResult<Json<ChartSpecGenerationResponse>>
Expand description

POST /api/v0/cms/ai-suggestions/chart-spec - Generate a Vega-Lite chart specification from a prompt.

This endpoint is intended for the CMS chart block editor. It requires the user to have edit access to the referenced page when page_id is provided, otherwise it falls back to requiring a teaching role for some course via Res::AnyCourse.