Repository navigation
feat:ai chat charts - #1310
Closed
nicolaskempf57 wants to merge 74 commits into
Closed
feat:ai chat charts#1310nicolaskempf57 wants to merge 74 commits into
nicolaskempf57 wants to merge 74 commits into
Conversation
nicolaskempf57
force-pushed
the
feat/ai-chat-charts
branch
from
October 29, 2026 14:42
146294d to
3355340
Compare
added 29 commits
November 4, 2026 13:18
The left card now holds only the rendered title, rendered description, the chart wrapper and the source line. Verified (read-only) that ChartViewerWrapper renders no copy/fullscreen/data-tab buttons in this usage — it wraps ChartViewer, which renders a bare echarts container. Removed the leftover border-t separator that separated the (now moved) title/description inputs from the preview.
…isation' loader Adds an absolute semi-transparent overlay with a spinner over the chart area while a new chart is being fetched. ChartViewerWrapper does not expose its internal fetch status (only capture()), so the configurator mirrors the wrapper's own trigger: same watched inputs (query, resource_id) and same debounce (componentsConfig.searchDebounce), cleared two animation frames after the fetch starts. Documented in a comment at the watcher.
Two blank states in the preview card: 'Aucune source sélectionnée' (pointing at the top source band) when no resource is picked, and 'Aucun graphique créé' when a resource is selected but form.query is empty — an empty query is the simplest reliable 'no chart yet' signal, since the viewer renders nothing without one (and covers 'query returned nothing' itself with its own message). Also aligns iconography with the prototype per review: blank states use RiBarChartBoxLine in a rounded bg-gray-lower circle instead of the chart.svg illustration, and the source band status line prefixes each state with its icon (spinner while loading, green check when ready, info icon otherwise). Icons are aria-hidden; the text carries meaning.
The AI SDK emits one part per tool call (keyed by toolCallId) and mutates its state in place during streaming, so merging parts of the same type+state into a single counted card hid each call's progression and details (alternating SQL → schema → SQL collapsed into one "×2" card). Each tool part is now its own trace in arrival order; the ×N badge and the count field are gone.
Match the prototype chat UX so users can tell their messages apart from agent replies: user messages render right-aligned in a light gray bubble as plain text (whitespace-pre-wrap, no markdown), assistant messages keep the full-width trace/thinking/markdown rendering. Both article roles carry data-message-role for tests.
Selecting a resource immediately generates a first query from the profile columns (X = first name matching region/departement/categorie/ type/annee/date, Y = first numeric column) so the preview renders without a manual step, mirroring the prototype flow. Auto-fill rule: on resource change, fill only when the current query is empty or equals the last auto-generated one — a user-edited or assistant-provided query is never overwritten. Table name is 'data', the convention shared with the assistant (see tests-unit/assistant.spec.ts); the SQL endpoint addresses the resource in the URL.
The resource select moved to the always-visible source band, so the assistant panel no longer hides it. Also account for the auto-filled default query: the empty-query save test clears the field first, and the SQL textarea test asserts the auto-filled default instead of ''.
udata returns tool outputs as plain strings (pipe-joined tables), which buildToolDetails cannot flatten into key/value details — only the SQL was visible. Carry non-empty string outputs on the trace, truncated at 2000 chars with an ellipsis, and render them in a pre block below the SQL code.
The reference design frames the title/description block, the chart visualization and the source line as separate bordered areas. Wrap each in a rounded border-new-gray-light container, matching the card's vocabulary and the space-y-4 rhythm.
The default nameLocation 'end' renders the axis name past the grid edge
where the canvas crops it. Center it under the axis ('middle') with a
30px gap clearing the labels, and raise grid.bottom (60/80) to fit
labels + name on top of the legend room. Visual check pending in a real
browser.
Move the status line onto the selects row (flex row: growing selects grid on the left, status right-aligned and vertically centered), stacking below the fields on mobile. Icons, colors and logic unchanged.
Match the prototype's ri-brain-line instead of RiMindMap.
Scroll the messages container to the bottom on new messages and streaming growth, but only while the user stays within 80px of the bottom so reading history is never interrupted. The near-bottom guard is a pure predicate (happy-dom has no scroll geometry) unit-tested on plain numbers; the scroll wiring itself needs a manual browser pass.
Replace the separate source-band/preview/sidebar cards with a single rounded-md bordered white shell: the source band gets an internal border-b, the sidebar a border-l on lg (border-t when stacked), and the inter-column gaps disappear. Responsive stacking unchanged.
…t hint Match the prototype: a 12px bold heading with a small gray hint line explaining the source feeds both the preview and the assistant.
Replace the static 'Je calcule la réponse...' summary with the live state: 'Exécution en cours' until the output lands, then the row count parsed from udata's rendered pipe table (truncation notice total when present, singular for one row). Object outputs and non-SQL tools keep the static summary.
…red block One outer border (gray-default, 6px radius) with divide-y separators replaces the three separate cards and the gaps between them.
…panels Mirrors the prototype: a #f6f6f6 band titling both columns, and a darker (new-gray-medium-clic) vertical separator that runs uninterrupted through the band and the sidebar.
…band Same 12px bold title and 11px subtitle as the panel band; the source status line drops to 10px with 12px icons and a 6px gap.
An image in a model reply is fetched by the browser as soon as it renders, so a prompt injection could carry conversation data out in its URL. MarkdownViewer gains a noImages option that renders images as their alt text; the chat panel enables it.
udata answers execute_sql with plain sentences for refusals, failures and empty results; the trace summary now shows "Requête non exécutée" or "Aucune ligne" instead of "1 ligne".
The watch source returned a new array on every call, and parents rebuild the chart object on each form change, so editing a title or an axis label re-ran the SQL query and blanked the preview.
useAssistantChat imports DefaultChatTransport from ai, which only resolved through @ai-sdk/vue and the hoisted node_modules layout.
Dense line series turned into a solid bead of markers. Keep at most 12 evenly spaced markers per series, each series starting at its own offset so overlapping series do not stack them; the axis tooltip still covers every point. Lines are smoothed.
- scope prototype input and select styles to the chart form - put the data source heading beside its fields - flatten the styles accordion under the Y axis section - add a blank state until a resource is selected - make the resource schema a collapsible summary under the SQL field - align the assistant composer with the form fields
nicolaskempf57
force-pushed
the
feat/ai-chat-charts
branch
from
November 4, 2026 12:23
a74c34b to
8ddc40f
Compare
DSFR's core.css puts cursor: pointer on the whole details element, so the column list looked clickable: reset it to auto, the summary keeps its pointer.
Move the chart type out of the Y axis section into its own "Type de graphique" section, as two icon buttons (radios underneath, so the choice stays keyboard and screen-reader accessible).
Contributor
Author
|
replaced by #1334, keeping the branch |
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.
Uh oh!
There was an error while loading. Please reload this page.