feat(seer): Add LLM context to widget builder page#112703
feat(seer): Add LLM context to widget builder page#112703Mihir-Mavalankar wants to merge 1 commit intomasterfrom
Conversation
0937545 to
ec1ddd1
Compare
gggritso
left a comment
There was a problem hiding this comment.
Makes sense overall but the "dummy" context is very strange. This would be tidier if you set the LLM context in the UI component that renders the widget builder, which will make test setup easier, too, since that code already exists
| useLLMContext({ | ||
| contextHint: | ||
| 'Sentry widget builder. The user is configuring a dashboard widget. visualize is the y-axis metrics (timeseries) or the aggregate (big number/table). fields are group-by columns (timeseries) or visible columns (table). query filters the data and sort controls ordering.', | ||
| mode: isEditing ? 'editing' : 'creating', | ||
| title: state.title, | ||
| description: state.description, | ||
| dataset: state.dataset, | ||
| displayType: state.displayType, | ||
| visualize: state.yAxis?.map(generateFieldAsString), | ||
| fields: state.fields?.map(generateFieldAsString), | ||
| query: state.query?.map(readableConditions), | ||
| sort: state.sort?.map(s => (s.kind === 'desc' ? `-${s.field}` : s.field)), | ||
| thresholds: state.thresholds, | ||
| legendAlias: state.legendAlias, | ||
| }); |
There was a problem hiding this comment.
Could you move this out of the custom context and put it directly into the UI component that renders the builder? It's a very unusual pattern to have a loose <WidgetBuilderLLMContext /> component. The name implies that it's a context provider, which it is not, and the fact that is has no children makes it even more confusing. All the state you need is available via hooks.
There was a problem hiding this comment.
Re-worked it, lmk if that looks good.
Register a 'widget-builder' node in the LLM context tree so the Seer Explorer agent understands what widget the user is configuring. Pushes builder state (dataset, displayType, visualize, fields, query, sort, thresholds, legendAlias) with readable condition transforms. Also adds the widget builder routes to STRUCTURED_CONTEXT_ROUTES so structured context is sent instead of ASCII when the builder is open. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ec1ddd1 to
423f37a
Compare
Register a 'widget-builder' node in the LLM context tree so the Seer Explorer agent understands what widget the user is configuring. Pushes builder state (dataset, displayType, visualize, fields, query, sort, thresholds, legendAlias) with readable condition transforms.
Also adds the widget builder routes to STRUCTURED_CONTEXT_ROUTES so structured context is sent instead of ASCII when the builder is open.