diff --git a/packages/@n8n/nodes-langchain/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.ts b/packages/@n8n/nodes-langchain/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.ts index 816b56b59ad40..272213d5390c2 100644 --- a/packages/@n8n/nodes-langchain/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.ts +++ b/packages/@n8n/nodes-langchain/nodes/trigger/ManualChatTrigger/ManualChatTrigger.node.ts @@ -50,9 +50,7 @@ export class ManualChatTrigger implements INodeType { name: 'openChat', type: 'button', typeOptions: { - buttonConfig: { - action: 'openChat', - }, + action: 'openChat', }, default: '', }, diff --git a/packages/cli/src/controllers/dynamicNodeParameters.controller.ts b/packages/cli/src/controllers/dynamicNodeParameters.controller.ts index bfd1cf651b875..c6a46aa3d4eed 100644 --- a/packages/cli/src/controllers/dynamicNodeParameters.controller.ts +++ b/packages/cli/src/controllers/dynamicNodeParameters.controller.ts @@ -1,4 +1,4 @@ -import type { INodePropertyOptions, NodeParameterValueType } from 'n8n-workflow'; +import type { INodePropertyOptions } from 'n8n-workflow'; import { Post, RestController } from '@/decorators'; import { getBase } from '@/WorkflowExecuteAdditionalData'; @@ -92,28 +92,4 @@ export class DynamicNodeParametersController { credentials, ); } - - @Post('/action-result') - async getActionResult( - req: DynamicNodeParametersRequest.ActionResult, - ): Promise { - const { currentNodeParameters, nodeTypeAndVersion, path, credentials, handler, payload } = - req.body; - - const additionalData = await getBase(req.user.id, currentNodeParameters); - - if (handler) { - return await this.service.getActionResult( - handler, - path, - additionalData, - nodeTypeAndVersion, - currentNodeParameters, - payload, - credentials, - ); - } - - return; - } } diff --git a/packages/cli/src/requests.ts b/packages/cli/src/requests.ts index 565020447c91d..45ee15b76326e 100644 --- a/packages/cli/src/requests.ts +++ b/packages/cli/src/requests.ts @@ -419,12 +419,6 @@ export declare namespace DynamicNodeParametersRequest { type ResourceMapperFields = BaseRequest<{ methodName: string; }>; - - /** POST /dynamic-node-parameters/action-result */ - type ActionResult = BaseRequest<{ - handler: string; - payload: IDataObject | string | undefined; - }>; } // ---------------------------------- diff --git a/packages/cli/src/services/dynamicNodeParameters.service.ts b/packages/cli/src/services/dynamicNodeParameters.service.ts index f3b0f7e192ba3..1788bac6e1877 100644 --- a/packages/cli/src/services/dynamicNodeParameters.service.ts +++ b/packages/cli/src/services/dynamicNodeParameters.service.ts @@ -15,8 +15,6 @@ import type { INodeCredentials, INodeParameters, INodeTypeNameVersion, - NodeParameterValueType, - IDataObject, } from 'n8n-workflow'; import { Workflow, RoutingNode, ApplicationError } from 'n8n-workflow'; import { NodeExecuteFunctions } from 'n8n-core'; @@ -158,24 +156,6 @@ export class DynamicNodeParametersService { return method.call(thisArgs); } - /** Returns the result of the action handler */ - async getActionResult( - handler: string, - path: string, - additionalData: IWorkflowExecuteAdditionalData, - nodeTypeAndVersion: INodeTypeNameVersion, - currentNodeParameters: INodeParameters, - payload: IDataObject | string | undefined, - credentials?: INodeCredentials, - ): Promise { - const nodeType = this.getNodeType(nodeTypeAndVersion); - const method = this.getMethod('actionHandler', handler, nodeType); - const workflow = this.getWorkflow(nodeTypeAndVersion, currentNodeParameters, credentials); - const thisArgs = this.getThisArg(path, additionalData, workflow); - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return method.call(thisArgs, payload); - } - private getMethod( type: 'resourceMapping', methodName: string, @@ -195,14 +175,9 @@ export class DynamicNodeParametersService { methodName: string, nodeType: INodeType, ): (this: ILoadOptionsFunctions) => Promise; - private getMethod( - type: 'actionHandler', - methodName: string, - nodeType: INodeType, - ): (this: ILoadOptionsFunctions, payload?: string) => Promise; private getMethod( - type: 'resourceMapping' | 'listSearch' | 'loadOptions' | 'actionHandler', + type: 'resourceMapping' | 'listSearch' | 'loadOptions', methodName: string, nodeType: INodeType, ) { diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 986336a396d64..128a99866c919 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -1551,11 +1551,6 @@ export declare namespace DynamicNodeParameters { interface ResourceMapperFieldsRequest extends BaseRequest { methodName: string; } - - interface ActionResultRequest extends BaseRequest { - handler: string; - payload: IDataObject | string | undefined; - } } export interface EnvironmentVariable { diff --git a/packages/editor-ui/src/api/nodeTypes.ts b/packages/editor-ui/src/api/nodeTypes.ts index f4d516aaeff82..300b25390d121 100644 --- a/packages/editor-ui/src/api/nodeTypes.ts +++ b/packages/editor-ui/src/api/nodeTypes.ts @@ -5,7 +5,6 @@ import type { INodePropertyOptions, INodeTypeDescription, INodeTypeNameVersion, - NodeParameterValueType, ResourceMapperFields, } from 'n8n-workflow'; import axios from 'axios'; @@ -58,15 +57,3 @@ export async function getResourceMapperFields( sendData, ); } - -export async function getNodeParameterActionResult( - context: IRestApiContext, - sendData: DynamicNodeParameters.ActionResultRequest, -): Promise { - return await makeRestApiRequest( - context, - 'POST', - '/dynamic-node-parameters/action-result', - sendData, - ); -} diff --git a/packages/editor-ui/src/components/ButtonParameter/ButtonParameter.vue b/packages/editor-ui/src/components/ButtonParameter/ButtonParameter.vue deleted file mode 100644 index d7e05b0f5bf85..0000000000000 --- a/packages/editor-ui/src/components/ButtonParameter/ButtonParameter.vue +++ /dev/null @@ -1,281 +0,0 @@ - - - - - diff --git a/packages/editor-ui/src/components/ButtonParameter/utils.ts b/packages/editor-ui/src/components/ButtonParameter/utils.ts deleted file mode 100644 index 14d3ca4d78334..0000000000000 --- a/packages/editor-ui/src/components/ButtonParameter/utils.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { Schema } from '@/Interface'; -import type { INodeExecutionData } from 'n8n-workflow'; -import { useWorkflowsStore } from '@/stores/workflows.store'; -import { useNDVStore } from '@/stores/ndv.store'; -import { useDataSchema } from '@/composables/useDataSchema'; -import { executionDataToJson } from '@/utils/nodeTypesUtils'; - -export function getParentNodes() { - const activeNode = useNDVStore().activeNode; - const { getCurrentWorkflow, getNodeByName } = useWorkflowsStore(); - const workflow = getCurrentWorkflow(); - - if (!activeNode || !workflow) return []; - - return workflow - .getParentNodesByDepth(activeNode?.name) - .filter(({ name }, i, nodes) => { - return name !== activeNode.name && nodes.findIndex((node) => node.name === name) === i; - }) - .map((n) => getNodeByName(n.name)) - .filter((n) => n !== null); -} - -export function getSchemas() { - const parentNodes = getParentNodes(); - const parentNodesNames = parentNodes.map((node) => node?.name); - const { getSchemaForExecutionData, getInputDataWithPinned } = useDataSchema(); - const parentNodesSchemas: Array<{ nodeName: string; schema: Schema }> = parentNodes - .map((node) => { - const inputData: INodeExecutionData[] = getInputDataWithPinned(node); - - return { - nodeName: node?.name || '', - schema: getSchemaForExecutionData(executionDataToJson(inputData), true), - }; - }) - .filter((node) => node.schema?.value.length > 0); - - const inputSchema = parentNodesSchemas.shift(); - - return { - parentNodesNames, - inputSchema, - parentNodesSchemas, - }; -} diff --git a/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue b/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue index f4ba1febf2471..d59a13e98ee60 100644 --- a/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue +++ b/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue @@ -60,12 +60,13 @@ import jsParser from 'prettier/plugins/babel'; import * as estree from 'prettier/plugins/estree'; import { type Ref, computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'; -import { CODE_NODE_TYPE } from '@/constants'; +import { ASK_AI_EXPERIMENT, CODE_NODE_TYPE } from '@/constants'; import { codeNodeEditorEventBus } from '@/event-bus'; import { useRootStore } from '@/stores/root.store'; import { usePostHog } from '@/stores/posthog.store'; import { useMessage } from '@/composables/useMessage'; +import { useSettingsStore } from '@/stores/settings.store'; import AskAI from './AskAI/AskAI.vue'; import { readOnlyEditorExtensions, writableEditorExtensions } from './baseExtensions'; import { useCompleter } from './completer'; @@ -113,6 +114,7 @@ const { autocompletionExtension } = useCompleter(() => props.mode, editor); const { createLinter } = useLinter(() => props.mode, editor); const rootStore = useRootStore(); +const settingsStore = useSettingsStore(); const posthog = usePostHog(); const i18n = useI18n(); const telemetry = useTelemetry(); @@ -189,7 +191,13 @@ onBeforeUnmount(() => { }); const aiEnabled = computed(() => { - return posthog.isAiEnabled() && props.language === 'javaScript'; + const isAiExperimentEnabled = [ASK_AI_EXPERIMENT.gpt3, ASK_AI_EXPERIMENT.gpt4].includes( + (posthog.getVariant(ASK_AI_EXPERIMENT.name) ?? '') as string, + ); + + return ( + isAiExperimentEnabled && settingsStore.settings.ai.enabled && props.language === 'javaScript' + ); }); const placeholder = computed(() => { diff --git a/packages/editor-ui/src/components/JsEditor/JsEditor.vue b/packages/editor-ui/src/components/JsEditor/JsEditor.vue index 5a5f2cb411878..40692ab32392c 100644 --- a/packages/editor-ui/src/components/JsEditor/JsEditor.vue +++ b/packages/editor-ui/src/components/JsEditor/JsEditor.vue @@ -1,5 +1,5 @@