-
Notifications
You must be signed in to change notification settings - Fork 159
feat: add dashboard chat context support #8217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Di7design
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Aditya!
After testing, I noticed the current hover action feels a bit slow if I click the tag without waiting. Can we display the list with the click behavior as well — when clicking the tag, it should both apply the filter and open the list, and clicking anywhere else will close the list. The remove action should only be triggered by the close icon, not by clicking the tag itself.
I also noticed that when I use the Explain feature, it doesn’t update the measure filter in the tag — is this intentional, or is the measure filter missing in this case? Also, when I add a measure filter manually, it doesn’t update in the tag either.

|
Thanks @Di7design . Measure name being in the filter will be a future enhancement. For now we have opted to skip things in the chat being identified as a context item. |
34356ca to
032e99d
Compare
Di7design
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context in chat box looks good. Here is design input for additional context in chat history: Figma
Screenshot for preview

ericpgreen2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UXQA:
- I asked a question on Dashboard A, kept the chat open, and I navigated to Dashboard B. I hit this error that crashed the app:

- The new designs (as of Friday) no longer have the "scoped to current dashboard" message & constraint. The AI should be able to query other metrics views. (Similar to how Cursor knows the context of your current open file, yet it's still able to query other files that are not open.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move these formatters to be colocated with their respective state management? For example:
- The time range formatter should live in
features/dashboards/time-controls - The filter formatter should live in
features/dashboards/filters
114a431 to
fd88c9c
Compare
fd88c9c to
7119b31
Compare
7fd9119 to
e6a4de0
Compare
e1f9a08 to
3dd529a
Compare
Question:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding to the above feedback, see my UXQA findings here, which map to the difficulty of hand-rolling the chat input.
Below are a few smaller comments.
| {@html DOMPurify.sanitize( | ||
| convertPromptWithInlineContextToHTML(content, $contextMetadataStore), | ||
| )} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should live in its own UserMessage component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt TextMessage the user message component? Or you mean similar to Markdown component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TextMessage component currently handles some assistant messages too.
Given how the inline context makes the user message rendering more complex, it could warrant encapsulating that complexity in its own UserMessage component.
Di7design
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding my reviews to the Notion doc as well. See here.
|
Hmmm I did take a look at tiptap. The link to the I was honestly putting my effort into implementing different changes to the design/requirement. I wrote the editor at the beginning and didnt touch it too much. |
Code Review - PR #8217Nice work on the inline chat context feature! The Tiptap integration is clean and the separation of concerns is well done. A few items to address before merge: High Priority
Medium Priority
Developed in collaboration with Claude Code |
ericpgreen2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I left a few more UXQA findings here.
- Generally, I find the context feature feels broken without keyboard shortcuts for selecting items. I'd expect the primary way to select context will be keyboard-only, not point-and-click.
- Can you please add e2e tests for the "explain this" feature and chatting w/ user-provided context? (Though, I'm open to these tests being added when we remove the feature flag.)
- See the Claude Code feedback above for some detailed feedback.
web-common/src/features/chat/core/context/AddInlineChatDropdown.svelte
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming nit: InlineContextSpan.svelte could be cleaner. It'd help imply there could be multiple instances of the component within the Chat Input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you think Context doesnt imply multiple instances? Also Span feels out of place, so would be good to stuck with Context
| export const INLINE_CHAT_TYPE_ATTR = "data-type"; | ||
| export const INLINE_CHAT_METRICS_VIEW_ATTR = "data-metrics-view"; | ||
| export const INLINE_CHAT_MEASURE_ATTR = "data-measure"; | ||
| export const INLINE_CHAT_DIMENSION_ATTR = "data-dimension"; | ||
| export const INLINE_CHAT_TIME_RANGE_ATTR = "data-time-range"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere in the code, like at the top of this file, it'd be helpful to have a clear explanatory comment that shows a couple example serializations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting to html is not needed right now, LLM doesnt get the attributes.
There are tests for these methods for serialisation examples. Lemme know if they are not enough.
Naming InconsistenciesDeveloped in collaboration with Claude Code. I've reviewed the naming patterns throughout this PR and found several inconsistencies that could create confusion for future maintainers. 1. Inconsistent Terminology: "inline" and "chat" QualifiersThe codebase uses inconsistent combinations of "inline" and "chat" to describe the same concept: Pattern 1: "InlineChatContext" (both qualifiers) // Component names
InlineChatContext.svelte
InlineChatContextPicker.svelte
InlineChatMetricsViewContextPicker.svelte
// Type definition
type InlineChatContext = { ... }
// Functions
function normalizeInlineChatContext() { ... }
function getInlineChatContextMetadata() { ... }Pattern 2: "ChatContext" (no "inline") // Enum
enum ChatContextEntryType { ... }
// Variables
selectedChatContext: InlineChatContext
const chatElement: HTMLSpanElementPattern 3: "inline-context" (no "chat") Pattern 4: "inline-chat-context" (both qualifiers, different order) // CSS classes
.inline-chat-context
.inline-chat-context-value
.inline-chat-context-dropdownPattern 5: "chat-reference" (different term entirely) // HTML tag
export const INLINE_CHAT_CONTEXT_TAG = "chat-reference";
// Renders as: <chat-reference>...</chat-reference>The ProblemWhen do we say "inline" and when do we omit it? When do we include "chat" and when do we not? This creates confusion:
Developer impact:
Discussion: What should the canonical name be?The core question: What is this feature called? Option A: "ChatContext" (drop "inline" everywhere)
Option B: "InlineChatContext" (add "inline" everywhere)
Option C: "InlineContext" (drop "chat", add "inline" everywhere)
RecommendationI recommend Option C: "InlineContext" because:
Proposed changes: // Types
- type InlineChatContext = { ... }
+ type InlineContext = { ... }
// Enum
- enum ChatContextEntryType { ... }
+ enum InlineContextType { ... }
// Files (already correct!)
inline-context.ts ✓
inline-context-data.ts ✓
// Components
- InlineChatContext.svelte
+ InlineContext.svelte
- InlineChatContextPicker.svelte
+ InlineContextPicker.svelte
// Add missing prefixes
- chat-plugins.ts
+ inline-context-plugins.ts
- convertors.ts
+ inline-context-convertors.ts
// HTML tag - can keep as-is with comment
export const INLINE_CONTEXT_TAG = "chat-reference"; // Using "reference" in HTML for semantic clarityAlternative: If you prefer keeping "InlineChatContext", then files need to be renamed to match: What's your take? The key decision is whether to:
2. Component Naming - Container vs Item Pattern Not ClearThere are two "Picker" components with unclear boundaries: InlineChatContextPicker.svelte (lines 68-76):
InlineChatMetricsViewContextPicker.svelte:
The ArchitectureThe ProblemBoth are called "Picker" but serve different roles:
The parent/child relationship isn't obvious from the names. RecommendationOption A: Make the hierarchy explicit Option B: Use semantic component names (recommended) Option B is clearer because:
ImpactThese naming inconsistencies make the codebase harder to:
Recommendation: Address these naming issues before merge. The terminology decision (section 1) is foundational and should be resolved first, as it informs all other naming choices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature feels much better with the keyboard controls! Overall, code is nicely readable and well-documented!
- I've added a couple more items to the UXQA doc
- See below for a few specific code comments
- See above for a Claude Code comment about naming
Otherwise looks good to merge 👍
| {@html DOMPurify.sanitize( | ||
| convertPromptWithInlineContextToHTML(content, $contextMetadataStore), | ||
| )} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TextMessage component currently handles some assistant messages too.
Given how the inline context makes the user message rendering more complex, it could warrant encapsulating that complexity in its own UserMessage component.
* feat: add dashboard chat context support * Some fixes * Update context colors * Fix lint * Add basic rich text input * Add inline context add/edit support * Update inline context in chat history * Integrate explain anomaly with new context * Add dimension value selection support * Improve add/remove * Fix backspace not removing elements accurately * Disable context in non-explore context * Cleanup * Add shortcuts for dimension/measures * Update to the latest design * Update explain anomaly feature for new design * Add current/recently used metrics view * Cleanup * Fix edge cases with prompt synching * Move to using tiptap * Add keyboard navigation for dropdown * Add explicit add mention button * Fix lint * Final PR comments

Adds inline mention-like chat context support.
Also includes measure quick explanation feature.
This is behind a feature flag:
dashboard_chatPRD: https://www.notion.so/rilldata/AI-Chat-experience-2a2ba33c8f578036802fd3e20c7029ec?source=copy_link#2a2ba33c8f578154a5d2ca6c88ee2113
UXQA https://www.notion.so/rilldata/Inline-chat-context-UXQA-2b0ba33c8f57808999a8d37cc0da573e#2b5ba33c8f5780fc8966e48409b3bb43
Closes APP-439 APP-432
Checklist: