Skip to content

Commit

Permalink
fix(editor): Ensure proper "AI Template" URL construction in node cre…
Browse files Browse the repository at this point in the history
…ator (#12566)
  • Loading branch information
jeanpaul authored Jan 13, 2025
1 parent dcd7feb commit 13bf69f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
const chainNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_CHAINS);
const agentNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_AGENTS);

const websiteCategoryURL = templatesStore.websiteTemplateRepositoryParameters;

websiteCategoryURL.append('utm_user_role', 'AdvancedAI');
const websiteCategoryURLParams = templatesStore.websiteTemplateRepositoryParameters;
websiteCategoryURLParams.append('utm_user_role', 'AdvancedAI');
const websiteCategoryURL =
templatesStore.constructTemplateRepositoryURL(websiteCategoryURLParams);

return {
value: AI_NODE_CREATOR_VIEW,
Expand All @@ -158,7 +159,7 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
icon: 'box-open',
description: i18n.baseText('nodeCreator.aiPanel.linkItem.description'),
name: 'ai_templates_root',
url: websiteCategoryURL.toString(),
url: websiteCategoryURL,
tag: {
type: 'info',
text: i18n.baseText('nodeCreator.triggerHelperPanel.manualTriggerTag'),
Expand Down
5 changes: 5 additions & 0 deletions packages/editor-ui/src/stores/templates.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
`${TEMPLATES_URLS.BASE_WEBSITE_URL}?${websiteTemplateRepositoryParameters.value.toString()}`,
);

const constructTemplateRepositoryURL = (params: URLSearchParams): string => {
return `${TEMPLATES_URLS.BASE_WEBSITE_URL}?${params.toString()}`;
};

const addCategories = (_categories: ITemplatesCategory[]): void => {
categories.value = _categories;
};
Expand Down Expand Up @@ -427,6 +431,7 @@ export const useTemplatesStore = defineStore(STORES.TEMPLATES, () => {
isSearchFinished,
hasCustomTemplatesHost,
websiteTemplateRepositoryURL,
constructTemplateRepositoryURL,
websiteTemplateRepositoryParameters,
addCategories,
addCollections,
Expand Down

0 comments on commit 13bf69f

Please sign in to comment.