Skip to content

feat:ai chat charts - #1310

Closed
nicolaskempf57 wants to merge 74 commits into
mainfrom
feat/ai-chat-charts
Closed

nicolaskempf57 wants to merge 74 commits into
mainfrom
feat/ai-chat-charts

Conversation

@nicolaskempf57

@nicolaskempf57 nicolaskempf57 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Conciergerie AI 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
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).
@nicolaskempf57

Copy link
Copy Markdown
Contributor Author

replaced by #1334, keeping the branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant