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_WORKFLOW_TOOL_LANGCHAIN_NODE_TYPE,
HUMAN_IN_THE_LOOP_CATEGORY,
TEMPLATE_CATEGORY_AI,
} from '@/constants';
import { useI18n } from '@n8n/i18n';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
@@ -176,8 +177,10 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
const websiteCategoryURLParams = templatesStore.websiteTemplateRepositoryParameters;
websiteCategoryURLParams.append('utm_user_role', 'AdvancedAI');
const websiteCategoryURL =
templatesStore.constructTemplateRepositoryURL(websiteCategoryURLParams);
const aiTemplatesURL = templatesStore.constructTemplateRepositoryURL(
websiteCategoryURLParams,
TEMPLATE_CATEGORY_AI,
);
const askAiEnabled = useSettingsStore().isAskAiEnabled;
const aiTransformNode = nodeTypesStore.getNodeType(AI_TRANSFORM_NODE_TYPE);
@@ -196,7 +199,7 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
icon: 'box-open',
description: i18n.baseText('nodeCreator.aiPanel.linkItem.description'),
name: 'ai_templates_root',
url: websiteCategoryURL,
url: aiTemplatesURL,
tag: {
type: 'info',
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_HTTP_NODE_VERSION = 4.1;
// template categories
export const TEMPLATE_CATEGORY_AI = 'categories/ai';
export const EXECUTABLE_TRIGGER_NODE_TYPES = [
START_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()}`,
);
const constructTemplateRepositoryURL = (params: URLSearchParams): string => {
return `${TEMPLATES_URLS.BASE_WEBSITE_URL}?${params.toString()}`;
const constructTemplateRepositoryURL = (params: URLSearchParams, category?: string): string => {
const baseUrl = category
? `${TEMPLATES_URLS.BASE_WEBSITE_URL}${category}`
: TEMPLATES_URLS.BASE_WEBSITE_URL;
return `${baseUrl}?${params.toString()}`;
};
const addCategories = (_categories: ITemplatesCategory[]): void => {