Skip to content

Commit 13bf69f

Browse files
authored
fix(editor): Ensure proper "AI Template" URL construction in node creator (#12566)
1 parent dcd7feb commit 13bf69f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Diff for: packages/editor-ui/src/components/Node/NodeCreator/viewsData.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
141141
const chainNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_CHAINS);
142142
const agentNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_AGENTS);
143143

144-
const websiteCategoryURL = templatesStore.websiteTemplateRepositoryParameters;
145-
146-
websiteCategoryURL.append('utm_user_role', 'AdvancedAI');
144+
const websiteCategoryURLParams = templatesStore.websiteTemplateRepositoryParameters;
145+
websiteCategoryURLParams.append('utm_user_role', 'AdvancedAI');
146+
const websiteCategoryURL =
147+
templatesStore.constructTemplateRepositoryURL(websiteCategoryURLParams);
147148

148149
return {
149150
value: AI_NODE_CREATOR_VIEW,
@@ -158,7 +159,7 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
158159
icon: 'box-open',
159160
description: i18n.baseText('nodeCreator.aiPanel.linkItem.description'),
160161
name: 'ai_templates_root',
161-
url: websiteCategoryURL.toString(),
162+
url: websiteCategoryURL,
162163
tag: {
163164
type: 'info',
164165
text: i18n.baseText('nodeCreator.triggerHelperPanel.manualTriggerTag'),

Diff for: packages/editor-ui/src/stores/templates.store.ts

+5
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
167167
`${TEMPLATES_URLS.BASE_WEBSITE_URL}?${websiteTemplateRepositoryParameters.value.toString()}`,
168168
);
169169

170+
const constructTemplateRepositoryURL = (params: URLSearchParams): string => {
171+
return `${TEMPLATES_URLS.BASE_WEBSITE_URL}?${params.toString()}`;
172+
};
173+
170174
const addCategories = (_categories: ITemplatesCategory[]): void => {
171175
categories.value = _categories;
172176
};
@@ -427,6 +431,7 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
427431
isSearchFinished,
428432
hasCustomTemplatesHost,
429433
websiteTemplateRepositoryURL,
434+
constructTemplateRepositoryURL,
430435
websiteTemplateRepositoryParameters,
431436
addCategories,
432437
addCollections,

0 commit comments

Comments
 (0)