fix(editor): Correct ai template url (#17908)

This commit is contained in:
Nikhil Kuriakose
2025-08-05 11:23:07 +02:00
committed by GitHub
parent 2d3e13930f
commit bdc3a9172d
3 changed files with 14 additions and 5 deletions

View File

@@ -57,6 +57,7 @@ import {
AI_CODE_TOOL_LANGCHAIN_NODE_TYPE, AI_CODE_TOOL_LANGCHAIN_NODE_TYPE,
AI_WORKFLOW_TOOL_LANGCHAIN_NODE_TYPE, AI_WORKFLOW_TOOL_LANGCHAIN_NODE_TYPE,
HUMAN_IN_THE_LOOP_CATEGORY, HUMAN_IN_THE_LOOP_CATEGORY,
TEMPLATE_CATEGORY_AI,
} from '@/constants'; } from '@/constants';
import { useI18n } from '@n8n/i18n'; import { useI18n } from '@n8n/i18n';
import { useNodeTypesStore } from '@/stores/nodeTypes.store'; import { useNodeTypesStore } from '@/stores/nodeTypes.store';
@@ -176,8 +177,10 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
const websiteCategoryURLParams = templatesStore.websiteTemplateRepositoryParameters; const websiteCategoryURLParams = templatesStore.websiteTemplateRepositoryParameters;
websiteCategoryURLParams.append('utm_user_role', 'AdvancedAI'); websiteCategoryURLParams.append('utm_user_role', 'AdvancedAI');
const websiteCategoryURL = const aiTemplatesURL = templatesStore.constructTemplateRepositoryURL(
templatesStore.constructTemplateRepositoryURL(websiteCategoryURLParams); websiteCategoryURLParams,
TEMPLATE_CATEGORY_AI,
);
const askAiEnabled = useSettingsStore().isAskAiEnabled; const askAiEnabled = useSettingsStore().isAskAiEnabled;
const aiTransformNode = nodeTypesStore.getNodeType(AI_TRANSFORM_NODE_TYPE); const aiTransformNode = nodeTypesStore.getNodeType(AI_TRANSFORM_NODE_TYPE);
@@ -196,7 +199,7 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
icon: 'box-open', icon: 'box-open',
description: i18n.baseText('nodeCreator.aiPanel.linkItem.description'), description: i18n.baseText('nodeCreator.aiPanel.linkItem.description'),
name: 'ai_templates_root', name: 'ai_templates_root',
url: websiteCategoryURL, url: aiTemplatesURL,
tag: { tag: {
type: 'info', type: 'info',
text: i18n.baseText('nodeCreator.triggerHelperPanel.manualTriggerTag'), text: i18n.baseText('nodeCreator.triggerHelperPanel.manualTriggerTag'),

View File

@@ -223,6 +223,9 @@ export const RESPOND_TO_WEBHOOK_NODE_TYPE = 'n8n-nodes-base.respondToWebhook';
export const CREDENTIAL_ONLY_NODE_PREFIX = 'n8n-creds-base'; export const CREDENTIAL_ONLY_NODE_PREFIX = 'n8n-creds-base';
export const CREDENTIAL_ONLY_HTTP_NODE_VERSION = 4.1; export const CREDENTIAL_ONLY_HTTP_NODE_VERSION = 4.1;
// template categories
export const TEMPLATE_CATEGORY_AI = 'categories/ai';
export const EXECUTABLE_TRIGGER_NODE_TYPES = [ export const EXECUTABLE_TRIGGER_NODE_TYPES = [
START_NODE_TYPE, START_NODE_TYPE,
MANUAL_TRIGGER_NODE_TYPE, MANUAL_TRIGGER_NODE_TYPE,

View File

@@ -195,8 +195,11 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
`${TEMPLATES_URLS.BASE_WEBSITE_URL}${getTemplatePathByRole(userRole.value)}?${websiteTemplateRepositoryParameters.value.toString()}`, `${TEMPLATES_URLS.BASE_WEBSITE_URL}${getTemplatePathByRole(userRole.value)}?${websiteTemplateRepositoryParameters.value.toString()}`,
); );
const constructTemplateRepositoryURL = (params: URLSearchParams): string => { const constructTemplateRepositoryURL = (params: URLSearchParams, category?: string): string => {
return `${TEMPLATES_URLS.BASE_WEBSITE_URL}?${params.toString()}`; const baseUrl = category
? `${TEMPLATES_URLS.BASE_WEBSITE_URL}${category}`
: TEMPLATES_URLS.BASE_WEBSITE_URL;
return `${baseUrl}?${params.toString()}`;
}; };
const addCategories = (_categories: ITemplatesCategory[]): void => { const addCategories = (_categories: ITemplatesCategory[]): void => {