#131 — Get rid of duplicating “headers” and “rows” in ChatResponseEcharts
Repo: Twill-AI/facade State: open | Status: open Assignee: Unassigned
Created: 2024-10-02 · Updated: 2025-09-15
Description
Caused by https://twill-network.slack.com/archives/C078KS0R05B/p1725381603436369. Summary:
When Facade persists LlmChatItem-s it persists them “as it were produced in WebSocket” (exclude aggregating streamed items). And it leads to situation when “headers” and “rows” for the one ChatResponseEcharts are duplicated in 2 places:
- in LlmChatItem itself (of ChatResponseEcharts type)
- in attached Widget.
“headers” and “rows” size is 30+KB (in the given by initial link example).
UI uses only LlmChatItem data (2024-09-03).
Due to plots would be generated a lot in the application they would occupy a lot of (redundant) space in db eventually.
There is an optimization idea (for future, ~next year) to move LlmChatItem-s from Postgres to some NoSQL db engine. Probably cheaper and with ability to cut some items into “cold” storage. But it appears that Widgets would cause the same issue so probably we need to move them to NoSQL db as well.
The whole “widget” data is needed only for POST /dashboards request. But we may optimize it with providing only widget’s id and if need then patch widget on the dashboard with PATCH /dashboard request.
AC:
- Optimize persistence and API to don’t store “headers” and “rows” in 2 places.
- Optionally don’t send the whole widget data both in WebSocket
ChatResponseStatus=donepacket and GET /llmchats/{id}/items.
Notes
Add implementation notes, blockers, and context here
Related
Add wikilinks to related people, meetings, or other tickets