From cf8e31e75fd6fb2b0269690fe0d3b3b52dd84939 Mon Sep 17 00:00:00 2001 From: Darshana Venkatesh Date: Mon, 1 Jun 2026 08:56:53 -0700 Subject: [PATCH 1/9] add token usage link and banner --- .../atlas-service/src/url-builders.spec.ts | 11 +++++ packages/atlas-service/src/url-builders.ts | 8 +++- .../src/components/banner-button-styles.ts | 14 +++++++ .../focus-mode/focus-mode-modal-header.tsx | 22 ++++++++++ .../components/rerank-first-stage-banner.tsx | 8 +--- .../src/components/rerank-tokens-banner.tsx | 40 +++++++++++++++++-- .../rerank-version-warning-banner.tsx | 6 +-- .../src/components/server-error-banner.tsx | 26 +++++++----- packages/compass-assistant/src/prompts.ts | 12 +++++- 9 files changed, 119 insertions(+), 28 deletions(-) create mode 100644 packages/compass-aggregations/src/components/banner-button-styles.ts diff --git a/packages/atlas-service/src/url-builders.spec.ts b/packages/atlas-service/src/url-builders.spec.ts index 56cc0bbb9af..600d838e9bc 100644 --- a/packages/atlas-service/src/url-builders.spec.ts +++ b/packages/atlas-service/src/url-builders.spec.ts @@ -73,6 +73,17 @@ describe('url-builders', function () { `${TEST_ORIGIN}/v2/proj123#/settings/groupSettings` ); }); + + it('builds project settings url with highlight param', function () { + expect( + buildProjectSettingsUrl({ + projectId: 'proj123', + highlight: 'nativeReranking', + }) + ).to.equal( + `${TEST_ORIGIN}/v2/proj123#/settings/groupSettings?highlight=nativeReranking` + ); + }); }); describe('buildMonitoringUrl', function () { diff --git a/packages/atlas-service/src/url-builders.ts b/packages/atlas-service/src/url-builders.ts index 5830feb7620..c02c34a1662 100644 --- a/packages/atlas-service/src/url-builders.ts +++ b/packages/atlas-service/src/url-builders.ts @@ -16,9 +16,13 @@ export function buildPerformanceMetricsUrl({ export function buildProjectSettingsUrl({ projectId, -}: Pick): string { + highlight, +}: Pick & { highlight?: string }): string { const url = new URL(`/v2/${projectId}`, window.location.origin); - return `${url}#/settings/groupSettings`; + const hash = highlight + ? `/settings/groupSettings?highlight=${encodeURIComponent(highlight)}` + : `/settings/groupSettings`; + return `${url}#${hash}`; } export function buildMonitoringUrl({ diff --git a/packages/compass-aggregations/src/components/banner-button-styles.ts b/packages/compass-aggregations/src/components/banner-button-styles.ts new file mode 100644 index 00000000000..7b37ee08dfe --- /dev/null +++ b/packages/compass-aggregations/src/components/banner-button-styles.ts @@ -0,0 +1,14 @@ +import { css } from '@mongodb-js/compass-components'; + +// Shared styling for action buttons rendered inside banners. Keeps the label +// contained on a single line within the button, and removes the underline that +// the Banner applies to descendant anchors (a Button with an `href` renders as +// an ``). The `:any-link` selector is needed to outweigh the Banner's own +// `a` rule. +export const bannerButtonStyles = css({ + flexShrink: 0, + whiteSpace: 'nowrap', + '&:any-link': { + textDecorationLine: 'none', + }, +}); diff --git a/packages/compass-aggregations/src/components/focus-mode/focus-mode-modal-header.tsx b/packages/compass-aggregations/src/components/focus-mode/focus-mode-modal-header.tsx index 5dcc6c0fcad..abc2d980882 100644 --- a/packages/compass-aggregations/src/components/focus-mode/focus-mode-modal-header.tsx +++ b/packages/compass-aggregations/src/components/focus-mode/focus-mode-modal-header.tsx @@ -3,6 +3,7 @@ import { Button, css, Icon, + Link, Menu, MenuItem, Option, @@ -35,6 +36,8 @@ import { import type { ServerEnvironment } from '../../modules/env'; import { getIsRerankFirstStage } from '../../modules/pipeline-builder/builder-helpers'; import { useRerankInsight } from '../rerank-first-stage-banner'; +import { useConnectionInfo } from '@mongodb-js/compass-connections/provider'; +import { buildRerankTokenUsageUrl } from '@mongodb-js/atlas-service/provider'; type Stage = { idxInStore: number; @@ -119,6 +122,15 @@ export const FocusModeModalHeader: React.FunctionComponent< }) => { const [menuOpen, setMenuOpen] = useState(false); const showInsights = usePreference('showInsights'); + const enableRerank = usePreference('enableRerank'); + const { atlasMetadata } = useConnectionInfo(); + + const viewTokenUsageHref = + enableRerank && stage?.stageOperator === '$rerank' + ? atlasMetadata + ? buildRerankTokenUsageUrl(atlasMetadata) + : 'https://dochub.mongodb.org/core/$rerank#metrics' + : null; const performanceInsight = useMemo(() => { if (stage) { @@ -354,6 +366,16 @@ export const FocusModeModalHeader: React.FunctionComponent< + {viewTokenUsageHref && ( + + View token usage + + )} + {showInsights && insight && ( { const { tellMoreAboutInsight } = useAssistantActions(); @@ -132,6 +133,7 @@ const bannerContentStyles = css({ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', + gap: spacing[200], }); const bannerTextStyles = css({ @@ -139,12 +141,6 @@ const bannerTextStyles = css({ minWidth: 0, }); -const bannerButtonStyles = css({ - flexShrink: 0, - whiteSpace: 'nowrap', - marginLeft: spacing[200], -}); - export const RerankFirstStageBanner = ({ 'data-testid': dataTestId, }: { diff --git a/packages/compass-aggregations/src/components/rerank-tokens-banner.tsx b/packages/compass-aggregations/src/components/rerank-tokens-banner.tsx index 0914a98ac2a..276a8c58da4 100644 --- a/packages/compass-aggregations/src/components/rerank-tokens-banner.tsx +++ b/packages/compass-aggregations/src/components/rerank-tokens-banner.tsx @@ -1,6 +1,16 @@ import React from 'react'; -import { Banner, css, usePersistedState } from '@mongodb-js/compass-components'; +import { + Banner, + Button, + Icon, + css, + spacing, + usePersistedState, +} from '@mongodb-js/compass-components'; import { usePreference } from 'compass-preferences-model/provider'; +import { useConnectionInfo } from '@mongodb-js/compass-connections/provider'; +import { buildRerankTokenUsageUrl } from '@mongodb-js/atlas-service/provider'; +import { bannerButtonStyles } from './banner-button-styles'; const bannerStyles = css({ borderRadius: 0, @@ -10,12 +20,19 @@ const bannerStyles = css({ }, }); +const bannerContentStyles = css({ + display: 'flex', + alignItems: 'center', + gap: spacing[200], +}); + export const RerankTokensBanner = ({ 'data-testid': dataTestId, }: { 'data-testid'?: string; }) => { const enableRerank = usePreference('enableRerank'); + const { atlasMetadata } = useConnectionInfo(); const [isDismissed, setIsDismissed] = usePersistedState( 'mongodb_compass_dismissed_rerank_tokens_banner', false @@ -25,6 +42,10 @@ export const RerankTokensBanner = ({ return null; } + const viewTokenUsageHref = atlasMetadata + ? buildRerankTokenUsageUrl(atlasMetadata) + : 'https://dochub.mongodb.org/core/$rerank#metrics'; + return ( $rerank consumes tokens
- Turn off the preview or disable the stage to avoid running $rerank while - editing. +
+ + Turn off the preview or disable the stage to avoid running $rerank + while editing. + + +
); }; diff --git a/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx b/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx index 1c133e3ebfb..ff7d86b21f2 100644 --- a/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx +++ b/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx @@ -9,6 +9,7 @@ import { import { useConnectionInfo } from '@mongodb-js/compass-connections/provider'; import { buildUpgradeClusterUrl } from '@mongodb-js/atlas-service/provider'; import { RERANK_MIN_SERVER_VERSION } from '../utils/search-stage-errors'; +import { bannerButtonStyles } from './banner-button-styles'; const bannerContentStyles = css({ display: 'flex', @@ -18,11 +19,6 @@ const bannerContentStyles = css({ flexWrap: 'nowrap', }); -const bannerButtonStyles = css({ - flexShrink: 0, - whiteSpace: 'nowrap', -}); - export const RerankVersionWarningBanner = ({ 'data-testid': dataTestId, }: { diff --git a/packages/compass-aggregations/src/components/server-error-banner.tsx b/packages/compass-aggregations/src/components/server-error-banner.tsx index 164b67413a7..5a3bc97db52 100644 --- a/packages/compass-aggregations/src/components/server-error-banner.tsx +++ b/packages/compass-aggregations/src/components/server-error-banner.tsx @@ -6,6 +6,7 @@ import { Icon, Link, css, + spacing, useDrawerActions, } from '@mongodb-js/compass-components'; import { @@ -21,6 +22,10 @@ import { type SearchExtensionType, } from '../utils/search-stage-errors'; import RateLimitExceededBanner from './rate-limit-exceeded-banner'; +import { bannerButtonStyles } from './banner-button-styles'; + +const RERANK_DOCS_URL = + 'https://www.mongodb.com/docs/vector-search/query/aggregation-stages/rerank/#navigate-to-the-project-settings-page'; const bannerStyles = css({ textAlign: 'left', @@ -28,9 +33,8 @@ const bannerStyles = css({ const bannerContentStyles = css({ display: 'flex', - justifyContent: 'space-between', alignItems: 'center', - width: '100%', + gap: spacing[200], }); type ServerErrorBannerProps = { @@ -53,13 +57,14 @@ export default function ServerErrorBanner({ const track = useTelemetry(); const { atlasMetadata } = useConnectionInfo(); const rerankNotEnabled = isRerankNotEnabledError(message); - const description = rerankNotEnabled - ? 'Enable native reranking in project settings.' - : message; - const projectSettingsHref = - rerankNotEnabled && atlasMetadata - ? buildProjectSettingsUrl({ projectId: atlasMetadata.projectId }) - : null; + const projectSettingsHref = rerankNotEnabled + ? atlasMetadata + ? buildProjectSettingsUrl({ + projectId: atlasMetadata.projectId, + highlight: 'nativeReranking', + }) + : RERANK_DOCS_URL + : null; const rateLimitInfo = getVoyageProjectRateLimitInfo(message); if (rateLimitInfo) { @@ -79,13 +84,14 @@ export default function ServerErrorBanner({ Native reranking not enabled
- {description} + Enable native reranking in project settings. {projectSettingsHref && ( diff --git a/packages/compass-assistant/src/prompts.ts b/packages/compass-assistant/src/prompts.ts index 57678d883e9..62562d660ed 100644 --- a/packages/compass-assistant/src/prompts.ts +++ b/packages/compass-assistant/src/prompts.ts @@ -204,9 +204,17 @@ ${context.query} }; case 'rerank-first-stage': return { - prompt: `Why you should use $rerank after a search stage`, + prompt: `The given MongoDB aggregation pipeline uses $rerank as the first stage. Provide a concise, human-readable explanation of best practices for using $rerank effectively and efficiently. +Your explanation must cover the following points: + +- $rerank should follow an initial retrieval stage such as $vectorSearch or $search, and explain why. +- Use $rerank.numDocsToRerank to limit how many documents are passed to the reranker, and explain the performance tradeoff of reranking more vs. fewer documents. +- Only include fields in $rerank.path that are actually used for reranking — unnecessary fields increase payload size and latency without improving results. + +Where relevant, flag if the pipeline in question does not follow these practices. +Respond with as much concision and clarity as possible. Do not recommend changes without briefly explaining the tradeoff.`, metadata: { - displayText: 'Why you should use $rerank after a search stage', + displayText: 'What are best practices for using $rerank?', }, }; } From 5265a46987085b38816151bf29ef2ce1c352aa20 Mon Sep 17 00:00:00 2001 From: Darshana Venkatesh Date: Fri, 5 Jun 2026 10:04:03 -0700 Subject: [PATCH 2/9] render as buttons instead of links --- .../src/components/banner-button-styles.ts | 10 ++--- .../src/components/rerank-tokens-banner.tsx | 6 ++- .../rerank-version-warning-banner.spec.tsx | 38 +++++++++++++------ .../rerank-version-warning-banner.tsx | 5 ++- .../src/components/server-error-banner.tsx | 9 ++++- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/packages/compass-aggregations/src/components/banner-button-styles.ts b/packages/compass-aggregations/src/components/banner-button-styles.ts index 7b37ee08dfe..3b9f16d80fe 100644 --- a/packages/compass-aggregations/src/components/banner-button-styles.ts +++ b/packages/compass-aggregations/src/components/banner-button-styles.ts @@ -1,14 +1,10 @@ import { css } from '@mongodb-js/compass-components'; // Shared styling for action buttons rendered inside banners. Keeps the label -// contained on a single line within the button, and removes the underline that -// the Banner applies to descendant anchors (a Button with an `href` renders as -// an ``). The `:any-link` selector is needed to outweigh the Banner's own -// `a` rule. +// contained on a single line within the button. Buttons use `onClick` (not an +// `href`) so they render as `
{showRerankFirstStageBanner && ( - + )} {showRerankTokensBanner && ( diff --git a/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx b/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx index 323d335ff5c..99be611ebe9 100644 --- a/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx +++ b/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx @@ -146,15 +146,27 @@ const bannerTextStyles = css({ export const RerankFirstStageBanner = ({ 'data-testid': dataTestId, + onBeforeAssistantOpen, }: { 'data-testid'?: string; + onBeforeAssistantOpen?: () => void; }) => { const enableRerank = usePreference('enableRerank'); const [isDismissed, setIsDismissed] = usePersistedState( 'mongodb_compass_dismissed_rerank_first_stage_banner', false ); - const onInsightAction = useRerankInsightAction(); + const insightAction = useRerankInsightAction(); + const onInsightAction = useMemo( + () => + insightAction + ? () => { + onBeforeAssistantOpen?.(); + insightAction(); + } + : undefined, + [insightAction, onBeforeAssistantOpen] + ); if (!enableRerank || isDismissed) { return null; From 94fd0daa9568522844bfc5d29370537df16cdfd0 Mon Sep 17 00:00:00 2001 From: Darshana Venkatesh Date: Mon, 22 Jun 2026 19:23:04 -0700 Subject: [PATCH 8/9] remove rerank consumes token banner --- .../src/components/focus-mode/focus-mode.tsx | 13 --- .../pipeline-as-text-workspace/index.spec.tsx | 1 - .../pipeline-as-text-workspace/index.tsx | 19 +---- .../components/rerank-tokens-banner.spec.tsx | 46 ----------- .../src/components/rerank-tokens-banner.tsx | 81 ------------------- .../src/components/stage.tsx | 8 -- 6 files changed, 2 insertions(+), 166 deletions(-) delete mode 100644 packages/compass-aggregations/src/components/rerank-tokens-banner.spec.tsx delete mode 100644 packages/compass-aggregations/src/components/rerank-tokens-banner.tsx diff --git a/packages/compass-aggregations/src/components/focus-mode/focus-mode.tsx b/packages/compass-aggregations/src/components/focus-mode/focus-mode.tsx index 78f2ee3f0db..7671903a870 100644 --- a/packages/compass-aggregations/src/components/focus-mode/focus-mode.tsx +++ b/packages/compass-aggregations/src/components/focus-mode/focus-mode.tsx @@ -21,9 +21,7 @@ import FocusModeModalHeader from './focus-mode-modal-header'; import ResizeHandle from '../resize-handle'; import { Resizable } from 're-resizable'; import { RerankFirstStageBanner } from '../rerank-first-stage-banner'; -import { RerankTokensBanner } from '../rerank-tokens-banner'; import { getIsRerankFirstStage } from '../../modules/pipeline-builder/builder-helpers'; -import type { StoreStage } from '../../modules/pipeline-builder/stage-editor'; const containerStyles = css({ display: 'grid', @@ -84,7 +82,6 @@ type FocusModeProps = { isModalOpen: boolean; isAutoPreviewEnabled: boolean | undefined; showRerankFirstStageBanner: boolean; - showRerankTokensBanner: boolean; onCloseModal: () => void; }; @@ -176,7 +173,6 @@ export const FocusMode: React.FunctionComponent = ({ isModalOpen, isAutoPreviewEnabled, showRerankFirstStageBanner, - showRerankTokensBanner, onCloseModal, }) => { return ( @@ -198,9 +194,6 @@ export const FocusMode: React.FunctionComponent = ({ onBeforeAssistantOpen={onCloseModal} /> )} - {showRerankTokensBanner && ( - - )} @@ -212,17 +205,11 @@ const mapState = (state: RootState) => { const { focusMode: { isEnabled, stageIndex }, autoPreview, - pipelineBuilder: { - stageEditor: { stages }, - }, } = state; - const currentStage = stages[stageIndex] as StoreStage | undefined; return { isModalOpen: isEnabled, isAutoPreviewEnabled: autoPreview, showRerankFirstStageBanner: getIsRerankFirstStage(state, stageIndex), - showRerankTokensBanner: - currentStage?.stageOperator === '$rerank' && !!autoPreview, }; }; diff --git a/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.spec.tsx b/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.spec.tsx index 442f9a6e2f7..ca53b5d6662 100644 --- a/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.spec.tsx +++ b/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.spec.tsx @@ -14,7 +14,6 @@ const renderPipelineAsTextWorkspace = ( ); diff --git a/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.tsx b/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.tsx index b6006eed06a..67ce52c4af1 100644 --- a/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.tsx +++ b/packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-as-text-workspace/index.tsx @@ -6,11 +6,9 @@ import { Resizable } from 're-resizable'; import PipelineEditor from './pipeline-editor'; import PipelinePreview from './pipeline-preview'; import ResizeHandle from '../../resize-handle'; -import { RerankTokensBanner } from '../../rerank-tokens-banner'; import type { RootState } from '../../../modules'; import { RerankFirstStageBanner } from '../../rerank-first-stage-banner'; import { getIsRerankFirstStage } from '../../../modules/pipeline-builder/builder-helpers'; -import { getStageOperator } from '../../../utils/stage'; const outerContainerStyles = css({ display: 'flex', @@ -42,14 +40,13 @@ const workspaceContainerStyles = css({ type PipelineAsTextWorkspaceProps = { isAutoPreview: boolean; showRerankFirstStageBanner: boolean; - showRerankTokensBanner: boolean; }; const containerDataTestId = 'pipeline-as-text-workspace'; export const PipelineAsTextWorkspace: React.FunctionComponent< PipelineAsTextWorkspaceProps -> = ({ isAutoPreview, showRerankFirstStageBanner, showRerankTokensBanner }) => { +> = ({ isAutoPreview, showRerankFirstStageBanner }) => { if (!isAutoPreview) { return (
@@ -76,9 +73,6 @@ export const PipelineAsTextWorkspace: React.FunctionComponent< {showRerankFirstStageBanner && ( )} - {showRerankTokensBanner && ( - - )}
{ - const { - autoPreview, - pipelineBuilder: { - textEditor: { - pipeline: { pipeline }, - }, - }, - } = state; + const { autoPreview } = state; return { isAutoPreview: !!autoPreview, showRerankFirstStageBanner: getIsRerankFirstStage(state), - showRerankTokensBanner: - pipeline.some((s) => getStageOperator(s) === '$rerank') && !!autoPreview, }; }; diff --git a/packages/compass-aggregations/src/components/rerank-tokens-banner.spec.tsx b/packages/compass-aggregations/src/components/rerank-tokens-banner.spec.tsx deleted file mode 100644 index 2bba1df1ad9..00000000000 --- a/packages/compass-aggregations/src/components/rerank-tokens-banner.spec.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import { render, screen, userEvent } from '@mongodb-js/testing-library-compass'; -import { expect } from 'chai'; -import { RerankTokensBanner } from './rerank-tokens-banner'; - -const DISMISSED_KEY = 'mongodb_compass_dismissed_rerank_tokens_banner'; - -describe('RerankTokensBanner', function () { - afterEach(function () { - localStorage.removeItem(DISMISSED_KEY); - }); - - it('does not render when enableRerank is false', function () { - render(, { - preferences: { enableRerank: false }, - }); - expect(screen.queryByTestId('rerank-tokens-banner')).to.not.exist; - }); - - it('renders when enableRerank is true', function () { - render(, { - preferences: { enableRerank: true }, - }); - expect(screen.getByTestId('rerank-tokens-banner')).to.exist; - expect(screen.getByText('$rerank consumes tokens')).to.exist; - }); - - it('dismisses when the close button is clicked', function () { - render(, { - preferences: { enableRerank: true }, - }); - expect(screen.getByTestId('rerank-tokens-banner')).to.exist; - - userEvent.click(screen.getByRole('button', { name: /close/i })); - - expect(screen.queryByTestId('rerank-tokens-banner')).to.not.exist; - }); - - it('does not render when already dismissed via localStorage', function () { - localStorage.setItem(DISMISSED_KEY, 'true'); - render(, { - preferences: { enableRerank: true }, - }); - expect(screen.queryByTestId('rerank-tokens-banner')).to.not.exist; - }); -}); diff --git a/packages/compass-aggregations/src/components/rerank-tokens-banner.tsx b/packages/compass-aggregations/src/components/rerank-tokens-banner.tsx deleted file mode 100644 index 07a28a744fa..00000000000 --- a/packages/compass-aggregations/src/components/rerank-tokens-banner.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react'; -import { - Banner, - Button, - Icon, - css, - spacing, - usePersistedState, -} from '@mongodb-js/compass-components'; -import { usePreference } from 'compass-preferences-model/provider'; -import { useConnectionInfo } from '@mongodb-js/compass-connections/provider'; -import { buildRerankTokenUsageUrl } from '@mongodb-js/atlas-service/provider'; -const bannerButtonStyles = css({ - flexShrink: 0, - whiteSpace: 'nowrap', -}); - -const bannerStyles = css({ - borderRadius: 0, - border: 'none', - '&::before': { - display: 'none', - }, -}); - -const bannerContentStyles = css({ - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - gap: spacing[200], -}); - -export const RerankTokensBanner = ({ - 'data-testid': dataTestId, -}: { - 'data-testid'?: string; -}) => { - const enableRerank = usePreference('enableRerank'); - const { atlasMetadata } = useConnectionInfo(); - const [isDismissed, setIsDismissed] = usePersistedState( - 'mongodb_compass_dismissed_rerank_tokens_banner', - false - ); - - if (!enableRerank || isDismissed) { - return null; - } - - const viewTokenUsageHref = atlasMetadata - ? buildRerankTokenUsageUrl(atlasMetadata) - : 'https://dochub.mongodb.org/core/$rerank#metrics'; - - return ( - setIsDismissed(true)} - > - $rerank consumes tokens -
-
- - Turn off the preview or disable the stage to avoid running $rerank - while editing. - - -
-
- ); -}; diff --git a/packages/compass-aggregations/src/components/stage.tsx b/packages/compass-aggregations/src/components/stage.tsx index 920a49c2bcb..41aeec7e531 100644 --- a/packages/compass-aggregations/src/components/stage.tsx +++ b/packages/compass-aggregations/src/components/stage.tsx @@ -17,7 +17,6 @@ import ResizeHandle from './resize-handle'; import StageToolbar from './stage-toolbar'; import StageEditor from './stage-editor'; import { RerankFirstStageBanner } from './rerank-first-stage-banner'; -import { RerankTokensBanner } from './rerank-tokens-banner'; import StagePreview from './stage-preview'; import { hasSyntaxError } from '../utils/stage'; import type { EditorRef } from '@mongodb-js/compass-editor'; @@ -133,7 +132,6 @@ export type StageProps = SortableProps & { hasServerError: boolean; isAutoPreviewing?: boolean | undefined; showRerankFirstStageBanner: boolean; - showRerankTokensBanner: boolean; }; function Stage({ @@ -144,7 +142,6 @@ function Stage({ hasServerError, isAutoPreviewing, showRerankFirstStageBanner, - showRerankTokensBanner, ...sortableProps }: StageProps) { const editorRef = useRef(null); @@ -191,9 +188,6 @@ function Stage({ {showRerankFirstStageBanner && ( )} - {showRerankTokensBanner && ( - - )} {isExpanded && (
{ hasServerError: !!stage.serverError, isAutoPreviewing: state.autoPreview, showRerankFirstStageBanner: getIsRerankFirstStage(state, ownProps.index), - showRerankTokensBanner: - stage.stageOperator === '$rerank' && !!state.autoPreview, }; })(Stage); From 480ea38fd8dff6d179a810990dd22cb5ad9e04ec Mon Sep 17 00:00:00 2001 From: Darshana Venkatesh Date: Mon, 22 Jun 2026 23:14:44 -0700 Subject: [PATCH 9/9] update to dochub link --- .../src/components/rerank-first-stage-banner.tsx | 9 +++++---- .../src/components/rerank-version-warning-banner.tsx | 9 +++++---- .../src/components/server-error-banner.tsx | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx b/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx index 99be611ebe9..8a68918f858 100644 --- a/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx +++ b/packages/compass-aggregations/src/components/rerank-first-stage-banner.tsx @@ -14,10 +14,6 @@ import { useAssistantActions } from '@mongodb-js/compass-assistant'; import { useConnectionInfo } from '@mongodb-js/compass-connections/provider'; import { buildAtlasSearchClustersUrl } from '@mongodb-js/atlas-service/provider'; import { STAGE_HELP_BASE_URL } from '../constants'; -const bannerButtonStyles = css({ - flexShrink: 0, - whiteSpace: 'nowrap', -}); export const useRerankInsightAction = () => { const { tellMoreAboutInsight } = useAssistantActions(); @@ -144,6 +140,11 @@ const bannerTextStyles = css({ minWidth: 0, }); +const bannerButtonStyles = css({ + flexShrink: 0, + whiteSpace: 'nowrap', +}); + export const RerankFirstStageBanner = ({ 'data-testid': dataTestId, onBeforeAssistantOpen, diff --git a/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx b/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx index 8865c0d99a5..5545a634a4e 100644 --- a/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx +++ b/packages/compass-aggregations/src/components/rerank-version-warning-banner.tsx @@ -9,10 +9,6 @@ import { import { useConnectionInfo } from '@mongodb-js/compass-connections/provider'; import { buildUpgradeClusterUrl } from '@mongodb-js/atlas-service/provider'; import { RERANK_MIN_SERVER_VERSION } from '../utils/search-stage-errors'; -const bannerButtonStyles = css({ - flexShrink: 0, - whiteSpace: 'nowrap', -}); const bannerContentStyles = css({ display: 'flex', @@ -22,6 +18,11 @@ const bannerContentStyles = css({ flexWrap: 'nowrap', }); +const bannerButtonStyles = css({ + flexShrink: 0, + whiteSpace: 'nowrap', +}); + export const RerankVersionWarningBanner = ({ 'data-testid': dataTestId, }: { diff --git a/packages/compass-aggregations/src/components/server-error-banner.tsx b/packages/compass-aggregations/src/components/server-error-banner.tsx index f625f42d43b..db4e2e2acae 100644 --- a/packages/compass-aggregations/src/components/server-error-banner.tsx +++ b/packages/compass-aggregations/src/components/server-error-banner.tsx @@ -28,7 +28,7 @@ const bannerButtonStyles = css({ }); const RERANK_DOCS_URL = - 'https://www.mongodb.com/docs/vector-search/query/aggregation-stages/rerank/#enable-or-disable-native-reranking-for-a-project'; + 'https://dochub.mongodb.org/core/$rerank#navigate-to-the-project-settings-page'; const bannerStyles = css({ textAlign: 'left',