#139 — Migrate from ChatResponseEcharts to ChatResponseWidget

Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned

Created: 2024-10-11 · Updated: 2025-09-15

Description

Need to integrate KPI tiles into Facade. Blocked by https://github.com/Twill-AI/twill-llm-engine/issues/171

Complexity here is that current “widget” table structure won’t fit to ChatResponseKPI.

We agreed with @meliascosta that instead of introducing new ChatResponseKPI we would transform ChatResponseEcharts into

class ChatResponseWidget:
    """Response with Apache ECharts code in chat."""
 
    type: Literal["echarts", "kpi", "table"]
    code: str
    sql_query: str
    headers: List[str]
    rows: List[List[Any]]
    name: str
    values_update_interval_sec: int

also in scope of #141 it would have new (like) “sql_post_processor” field.

About updating widgets idea is to:

  1. Put results of SQL query into rows (values_rows in Facade and API) field shaped in the specific way. Use “sql_post_processor” function to populate values_rows from SQL query.
  2. If type=kpi then reference values from values_rows which would be the only part which is updated in widget table during dashboard updating.

AC:

  • Facade supports ChatResponseWidget from LlmEngine output, has new column in widget table corresponding to type, persists it and returns in API.
  • Facade API is updated to:
    • renaming “widget.echarts_code” to “widget

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets