-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
ref(seer): Filter LLM context to widget-builder on builder routes #113623
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,12 @@ const NEW_STRUCTURED_CONTEXT_ROUTES = new Set([ | |
| '/dashboard/:dashboardId/widget-builder/widget/:widgetIndex/edit/', | ||
| ]); | ||
|
|
||
| /** Widget builder routes — only the builder node is relevant, not the full dashboard tree. */ | ||
| const WIDGET_BUILDER_ROUTES = new Set([ | ||
| '/dashboard/:dashboardId/widget-builder/widget/new/', | ||
| '/dashboard/:dashboardId/widget-builder/widget/:widgetIndex/edit/', | ||
| ]); | ||
|
|
||
| function supportsStructuredContext( | ||
| referrer: string, | ||
| organization: {features: string[]} | null | undefined | ||
|
|
@@ -397,7 +403,14 @@ export const useSeerExplorer = () => { | |
| let screenshot: string | undefined; | ||
| if (supportsStructuredContext(getPageReferrer(), organization)) { | ||
| try { | ||
| screenshot = JSON.stringify(getLLMContext()); | ||
| let snapshot = getLLMContext(); | ||
| if (WIDGET_BUILDER_ROUTES.has(getPageReferrer())) { | ||
| snapshot = { | ||
| ...snapshot, | ||
| nodes: snapshot.nodes.filter(n => n.nodeType === 'widget-builder'), | ||
| }; | ||
| } | ||
| screenshot = JSON.stringify(snapshot); | ||
|
Comment on lines
-400
to
+413
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might make sense to have a mechanism to figure out node priority based on the node's properties (e.g., a priority property, or something similar) rather than using routes, but this makes sense in a pinch 👍
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it's a bit hacky for sure. I'll think on this a bit and come back to it with some priority based system. |
||
| } catch (e) { | ||
| Sentry.captureException(e); | ||
| screenshot = captureAsciiSnapshot?.(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.