mirror of
https://github.com/n8n-io/n8n.git
synced 2026-07-28 03:24:59 +02:00
fix(core): Preserve node aliases when generating AI tool variants (backport to release-candidate/2.31.x) (#34194)
Co-authored-by: Alexander Gekov <40495748+alexander-gekov@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
ea140677bb
commit
b01032cfe9
|
|
@ -213,6 +213,31 @@ describe('ai-tools', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should preserve codex alias so tool variants stay searchable by alias', () => {
|
||||
fullNodeWrapper.description.codex = {
|
||||
categories: ['Existing'],
|
||||
subcategories: {
|
||||
Existing: ['Category'],
|
||||
},
|
||||
alias: ['scrape', 'crawl'],
|
||||
};
|
||||
const result = convertNodeToAiTool(fullNodeWrapper);
|
||||
expect(result.description.codex).toEqual({
|
||||
categories: ['AI'],
|
||||
subcategories: {
|
||||
AI: ['Tools'],
|
||||
Tools: ['Other Tools'],
|
||||
},
|
||||
resources: {},
|
||||
alias: ['scrape', 'crawl'],
|
||||
});
|
||||
});
|
||||
|
||||
it('should not add an alias key when the source node has none', () => {
|
||||
const result = convertNodeToAiTool(fullNodeWrapper);
|
||||
expect(result.description.codex).not.toHaveProperty('alias');
|
||||
});
|
||||
|
||||
it('should handle nodes with very long names', () => {
|
||||
fullNodeWrapper.description.name = 'veryLongNodeNameThatExceedsNormalLimits'.repeat(10);
|
||||
fullNodeWrapper.description.displayName =
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ export function setToolCodex(
|
|||
): void {
|
||||
const resources = description.codex?.resources ?? {};
|
||||
const existingToolsSubcategory = description.codex?.subcategories?.Tools;
|
||||
// Keep the original node's search aliases so tool variants stay discoverable
|
||||
const alias = description.codex?.alias;
|
||||
|
||||
description.codex = {
|
||||
categories: ['AI'],
|
||||
|
|
@ -49,5 +51,6 @@ export function setToolCodex(
|
|||
preserveExisting && existingToolsSubcategory ? existingToolsSubcategory : [toolSubcategory],
|
||||
},
|
||||
resources,
|
||||
...(alias && { alias }),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user