Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,24 @@ describe('useAssistantActions', function () {
},
});

expect(Object.keys(result.current)).to.have.length.greaterThan(0);
expect(result.current.interpretExplainPlan).to.be.a('function');
expect(result.current.interpretConnectionError).to.be.a('function');
expect(result.current.tellMoreAboutInsight).to.be.undefined;
});

it('returns actions when both AI features and assistant flag AND enablePerformanceInsightsEntrypoints are enabled', function () {
const { result } = renderHook(() => useAssistantActions(), {
wrapper: createWrapper(createMockChat({ messages: [] })),
preferences: {
enableAIAssistant: true,
enablePerformanceInsightsEntrypoints: true,
enableGenAIFeatures: true,
enableGenAIFeaturesAtlasOrg: true,
cloudFeatureRolloutAccess: { GEN_AI_COMPASS: true },
},
});

expect(Object.keys(result.current)).to.have.length.greaterThan(0);
expect(result.current.interpretExplainPlan).to.be.a('function');
expect(result.current.interpretConnectionError).to.be.a('function');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export function useAssistantActions(): AssistantActionsType {
const actions = useContext(AssistantActionsContext);
const isAIFeatureEnabled = useIsAIFeatureEnabled();
const isAssistantFlagEnabled = usePreference('enableAIAssistant');
const isPerformanceInsightEntrypointsEnabled = usePreference(
'enablePerformanceInsightsEntrypoints'
);

if (!isAIFeatureEnabled || !isAssistantFlagEnabled) {
return {
getIsAssistantEnabled: () => false,
Expand All @@ -106,7 +110,9 @@ export function useAssistantActions(): AssistantActionsType {
return {
interpretExplainPlan,
interpretConnectionError,
tellMoreAboutInsight,
tellMoreAboutInsight: isPerformanceInsightEntrypointsEnabled
? tellMoreAboutInsight
: undefined,
getIsAssistantEnabled: () => true,
};
}
Expand Down
11 changes: 11 additions & 0 deletions packages/compass-preferences-model/src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type FeatureFlags = {
enableSearchActivationProgramP1: boolean;
enableUnauthenticatedGenAI: boolean;
enableAIAssistant: boolean;
enablePerformanceInsightsEntrypoints: boolean;
};

export const featureFlags: Required<{
Expand Down Expand Up @@ -178,4 +179,14 @@ export const featureFlags: Required<{
short: 'Enable AI Assistant',
},
},

/*
* Feature flag for AI Assistant's performance insight entrypoints.
*/
enablePerformanceInsightsEntrypoints: {
stage: 'development',
description: {
short: 'Enable the performance insights AI Assistant entrypoints',
},
},
};
Loading