mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 20:29:08 +00:00
chore: Remove AI assistant experiment's feature flag. (no-chanelog) (#14430)
This commit is contained in:
@@ -1,13 +1,5 @@
|
|||||||
import { overrideFeatureFlag } from '../../composables/featureFlags';
|
|
||||||
import { BasePage } from '../base';
|
import { BasePage } from '../base';
|
||||||
|
|
||||||
const AI_ASSISTANT_FEATURE = {
|
|
||||||
name: 'aiAssistant',
|
|
||||||
experimentName: '021_ai_debug_helper',
|
|
||||||
enabledFor: 'variant',
|
|
||||||
disabledFor: 'control',
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use functional composables from @composables instead.
|
* @deprecated Use functional composables from @composables instead.
|
||||||
* If a composable doesn't exist for your use case, please create a new one in:
|
* If a composable doesn't exist for your use case, please create a new one in:
|
||||||
@@ -49,12 +41,10 @@ export class AIAssistant extends BasePage {
|
|||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
enableAssistant: () => {
|
enableAssistant: () => {
|
||||||
overrideFeatureFlag(AI_ASSISTANT_FEATURE.experimentName, AI_ASSISTANT_FEATURE.enabledFor);
|
cy.enableFeature('aiAssistant');
|
||||||
cy.enableFeature(AI_ASSISTANT_FEATURE.name);
|
|
||||||
},
|
},
|
||||||
disableAssistant: () => {
|
disableAssistant: () => {
|
||||||
overrideFeatureFlag(AI_ASSISTANT_FEATURE.experimentName, AI_ASSISTANT_FEATURE.disabledFor);
|
cy.disableFeature('aiAssistant');
|
||||||
cy.disableFeature(AI_ASSISTANT_FEATURE.name);
|
|
||||||
},
|
},
|
||||||
sendMessage: (message: string) => {
|
sendMessage: (message: string) => {
|
||||||
this.getters.chatInput().type(message).type('{enter}');
|
this.getters.chatInput().type(message).type('{enter}');
|
||||||
|
|||||||
@@ -729,12 +729,6 @@ export const CANVAS_AUTO_ADD_MANUAL_TRIGGER_EXPERIMENT = {
|
|||||||
variant: 'variant',
|
variant: 'variant',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AI_ASSISTANT_EXPERIMENT = {
|
|
||||||
name: '021_ai_debug_helper',
|
|
||||||
control: 'control',
|
|
||||||
variant: 'variant',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const CREDENTIAL_DOCS_EXPERIMENT = {
|
export const CREDENTIAL_DOCS_EXPERIMENT = {
|
||||||
name: '024_credential_docs',
|
name: '024_credential_docs',
|
||||||
control: 'control',
|
control: 'control',
|
||||||
@@ -761,7 +755,6 @@ export const SCHEMA_PREVIEW_EXPERIMENT = {
|
|||||||
|
|
||||||
export const EXPERIMENTS_TO_TRACK = [
|
export const EXPERIMENTS_TO_TRACK = [
|
||||||
CANVAS_AUTO_ADD_MANUAL_TRIGGER_EXPERIMENT.name,
|
CANVAS_AUTO_ADD_MANUAL_TRIGGER_EXPERIMENT.name,
|
||||||
AI_ASSISTANT_EXPERIMENT.name,
|
|
||||||
CREDENTIAL_DOCS_EXPERIMENT.name,
|
CREDENTIAL_DOCS_EXPERIMENT.name,
|
||||||
EASY_AI_WORKFLOW_EXPERIMENT.name,
|
EASY_AI_WORKFLOW_EXPERIMENT.name,
|
||||||
AI_CREDITS_EXPERIMENT.name,
|
AI_CREDITS_EXPERIMENT.name,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { useSettingsStore } from '@/stores/settings.store';
|
|||||||
import { defaultSettings } from '../__tests__/defaults';
|
import { defaultSettings } from '../__tests__/defaults';
|
||||||
import { merge } from 'lodash-es';
|
import { merge } from 'lodash-es';
|
||||||
import { DEFAULT_POSTHOG_SETTINGS } from './posthog.test';
|
import { DEFAULT_POSTHOG_SETTINGS } from './posthog.test';
|
||||||
import { AI_ASSISTANT_EXPERIMENT, VIEWS } from '@/constants';
|
import { VIEWS } from '@/constants';
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import * as chatAPI from '@/api/ai';
|
import * as chatAPI from '@/api/ai';
|
||||||
import * as telemetryModule from '@/composables/useTelemetry';
|
import * as telemetryModule from '@/composables/useTelemetry';
|
||||||
@@ -55,12 +55,6 @@ vi.mock('vue-router', () => ({
|
|||||||
RouterLink: vi.fn(),
|
RouterLink: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockPostHogVariant = (variant: 'variant' | 'control') => {
|
|
||||||
posthogStore.overrides = {
|
|
||||||
[AI_ASSISTANT_EXPERIMENT.name]: variant,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('AI Assistant store', () => {
|
describe('AI Assistant store', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
@@ -281,20 +275,9 @@ describe('AI Assistant store', () => {
|
|||||||
expect(assistantStore.currentSessionId).toBeUndefined();
|
expect(assistantStore.currentSessionId).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not show assistant for control experiment group', () => {
|
|
||||||
const assistantStore = useAssistantStore();
|
|
||||||
|
|
||||||
mockPostHogVariant('control');
|
|
||||||
setAssistantEnabled(true);
|
|
||||||
expect(assistantStore.isAssistantEnabled).toBe(false);
|
|
||||||
expect(assistantStore.canShowAssistant).toBe(false);
|
|
||||||
expect(assistantStore.canShowAssistantButtonsOnCanvas).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not show assistant if disabled in settings', () => {
|
it('should not show assistant if disabled in settings', () => {
|
||||||
const assistantStore = useAssistantStore();
|
const assistantStore = useAssistantStore();
|
||||||
|
|
||||||
mockPostHogVariant('variant');
|
|
||||||
setAssistantEnabled(false);
|
setAssistantEnabled(false);
|
||||||
expect(assistantStore.isAssistantEnabled).toBe(false);
|
expect(assistantStore.isAssistantEnabled).toBe(false);
|
||||||
expect(assistantStore.canShowAssistant).toBe(false);
|
expect(assistantStore.canShowAssistant).toBe(false);
|
||||||
@@ -305,7 +288,6 @@ describe('AI Assistant store', () => {
|
|||||||
const assistantStore = useAssistantStore();
|
const assistantStore = useAssistantStore();
|
||||||
|
|
||||||
setAssistantEnabled(true);
|
setAssistantEnabled(true);
|
||||||
mockPostHogVariant('variant');
|
|
||||||
expect(assistantStore.isAssistantEnabled).toBe(true);
|
expect(assistantStore.isAssistantEnabled).toBe(true);
|
||||||
expect(assistantStore.canShowAssistant).toBe(true);
|
expect(assistantStore.canShowAssistant).toBe(true);
|
||||||
expect(assistantStore.canShowAssistantButtonsOnCanvas).toBe(true);
|
expect(assistantStore.canShowAssistantButtonsOnCanvas).toBe(true);
|
||||||
@@ -316,7 +298,6 @@ describe('AI Assistant store', () => {
|
|||||||
const assistantStore = useAssistantStore();
|
const assistantStore = useAssistantStore();
|
||||||
|
|
||||||
setAssistantEnabled(true);
|
setAssistantEnabled(true);
|
||||||
mockPostHogVariant('variant');
|
|
||||||
expect(assistantStore.isAssistantEnabled).toBe(true);
|
expect(assistantStore.isAssistantEnabled).toBe(true);
|
||||||
expect(assistantStore.canShowAssistant).toBe(false);
|
expect(assistantStore.canShowAssistant).toBe(false);
|
||||||
expect(assistantStore.canShowAssistantButtonsOnCanvas).toBe(false);
|
expect(assistantStore.canShowAssistantButtonsOnCanvas).toBe(false);
|
||||||
@@ -328,7 +309,6 @@ describe('AI Assistant store', () => {
|
|||||||
const assistantStore = useAssistantStore();
|
const assistantStore = useAssistantStore();
|
||||||
|
|
||||||
setAssistantEnabled(true);
|
setAssistantEnabled(true);
|
||||||
mockPostHogVariant('variant');
|
|
||||||
expect(assistantStore.isAssistantEnabled).toBe(true);
|
expect(assistantStore.isAssistantEnabled).toBe(true);
|
||||||
expect(assistantStore.canShowAssistant).toBe(true);
|
expect(assistantStore.canShowAssistant).toBe(true);
|
||||||
expect(assistantStore.canShowAssistantButtonsOnCanvas).toBe(false);
|
expect(assistantStore.canShowAssistantButtonsOnCanvas).toBe(false);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
VIEWS,
|
VIEWS,
|
||||||
EDITABLE_CANVAS_VIEWS,
|
EDITABLE_CANVAS_VIEWS,
|
||||||
STORES,
|
STORES,
|
||||||
AI_ASSISTANT_EXPERIMENT,
|
|
||||||
PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
||||||
CREDENTIAL_EDIT_MODAL_KEY,
|
CREDENTIAL_EDIT_MODAL_KEY,
|
||||||
} from '@/constants';
|
} from '@/constants';
|
||||||
@@ -23,7 +22,6 @@ import { deepCopy } from 'n8n-workflow';
|
|||||||
import { ndvEventBus, codeNodeEditorEventBus } from '@/event-bus';
|
import { ndvEventBus, codeNodeEditorEventBus } from '@/event-bus';
|
||||||
import { useNDVStore } from './ndv.store';
|
import { useNDVStore } from './ndv.store';
|
||||||
import type { IUpdateInformation } from '@/Interface';
|
import type { IUpdateInformation } from '@/Interface';
|
||||||
import { usePostHog } from './posthog.store';
|
|
||||||
import { useI18n } from '@/composables/useI18n';
|
import { useI18n } from '@/composables/useI18n';
|
||||||
import { useTelemetry } from '@/composables/useTelemetry';
|
import { useTelemetry } from '@/composables/useTelemetry';
|
||||||
import { useToast } from '@/composables/useToast';
|
import { useToast } from '@/composables/useToast';
|
||||||
@@ -60,7 +58,6 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => {
|
|||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const streaming = ref<boolean>();
|
const streaming = ref<boolean>();
|
||||||
const ndvStore = useNDVStore();
|
const ndvStore = useNDVStore();
|
||||||
const { getVariant } = usePostHog();
|
|
||||||
const locale = useI18n();
|
const locale = useI18n();
|
||||||
const telemetry = useTelemetry();
|
const telemetry = useTelemetry();
|
||||||
const assistantHelpers = useAIAssistantHelpers();
|
const assistantHelpers = useAIAssistantHelpers();
|
||||||
@@ -89,10 +86,6 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => {
|
|||||||
const workflowDataStale = ref<boolean>(true);
|
const workflowDataStale = ref<boolean>(true);
|
||||||
const workflowExecutionDataStale = ref<boolean>(true);
|
const workflowExecutionDataStale = ref<boolean>(true);
|
||||||
|
|
||||||
const isExperimentEnabled = computed(
|
|
||||||
() => getVariant(AI_ASSISTANT_EXPERIMENT.name) === AI_ASSISTANT_EXPERIMENT.variant,
|
|
||||||
);
|
|
||||||
|
|
||||||
const assistantMessages = computed(() =>
|
const assistantMessages = computed(() =>
|
||||||
chatMessages.value.filter((msg) => msg.role === 'assistant'),
|
chatMessages.value.filter((msg) => msg.role === 'assistant'),
|
||||||
);
|
);
|
||||||
@@ -110,9 +103,7 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => {
|
|||||||
|
|
||||||
const isAssistantOpen = computed(() => canShowAssistant.value && chatWindowOpen.value);
|
const isAssistantOpen = computed(() => canShowAssistant.value && chatWindowOpen.value);
|
||||||
|
|
||||||
const isAssistantEnabled = computed(
|
const isAssistantEnabled = computed(() => settings.isAiAssistantEnabled);
|
||||||
() => isExperimentEnabled.value && settings.isAiAssistantEnabled,
|
|
||||||
);
|
|
||||||
|
|
||||||
const canShowAssistant = computed(
|
const canShowAssistant = computed(
|
||||||
() => isAssistantEnabled.value && ENABLED_VIEWS.includes(route.name as VIEWS),
|
() => isAssistantEnabled.value && ENABLED_VIEWS.includes(route.name as VIEWS),
|
||||||
|
|||||||
Reference in New Issue
Block a user