Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(editor): Easy $fromAI Button for AI Tools #12587

Open
wants to merge 91 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
49ee4d0
Add wip work
CharlieKolb Dec 23, 2024
32a1104
wip commit
CharlieKolb Dec 27, 2024
bd0ad0a
wip commit
CharlieKolb Jan 2, 2025
51511e7
wip many button locations
CharlieKolb Jan 10, 2025
54ffa0f
wip commit
CharlieKolb Jan 10, 2025
72e8370
Working override button
CharlieKolb Jan 13, 2025
02a4028
minor touch ups
CharlieKolb Jan 13, 2025
5e5e139
self review
CharlieKolb Jan 13, 2025
c82a295
Merge remote-tracking branch 'origin/master' into ADO-3034
CharlieKolb Jan 13, 2025
1be8e3c
comments
CharlieKolb Jan 13, 2025
437a15f
Add and integrate components
CharlieKolb Jan 14, 2025
8c41e5f
bug fixes
CharlieKolb Jan 14, 2025
904915f
Extract override class
CharlieKolb Jan 15, 2025
fe81eab
clean uo
CharlieKolb Jan 15, 2025
c99fc6c
Finish design component
CharlieKolb Jan 15, 2025
75fa403
clean up tests
CharlieKolb Jan 15, 2025
4ff0e60
add component
CharlieKolb Jan 15, 2025
89b6c41
fix build
CharlieKolb Jan 15, 2025
743baeb
self review
CharlieKolb Jan 15, 2025
5f116b2
add test to assert sort order
CharlieKolb Jan 15, 2025
2510480
Merge design-system changes
CharlieKolb Jan 16, 2025
7ba8dd8
update snapshot
CharlieKolb Jan 16, 2025
cf4adc4
Product review
CharlieKolb Jan 16, 2025
2dd0660
Add disabled prop and touch up css
CharlieKolb Jan 16, 2025
cd39ab9
pr feedback
CharlieKolb Jan 16, 2025
30884ff
make disabled optional
CharlieKolb Jan 16, 2025
96bff1d
add disabled test case
CharlieKolb Jan 16, 2025
8e3f465
Clean up 1
CharlieKolb Jan 16, 2025
53c45a9
self review
CharlieKolb Jan 16, 2025
59d38fa
review 3
CharlieKolb Jan 16, 2025
87e6ffd
fix light mode
CharlieKolb Jan 16, 2025
c1d7900
more review
CharlieKolb Jan 17, 2025
359b308
PR Feedback
CharlieKolb Jan 17, 2025
d303900
Update name and tests
CharlieKolb Jan 17, 2025
8cac135
Merge remote-tracking branch 'origin/ADO-3035' into ADO-3034
CharlieKolb Jan 17, 2025
a0b7c2f
Move files and update dependencies
CharlieKolb Jan 17, 2025
9734e68
parameterInputFull cleanup
CharlieKolb Jan 17, 2025
85d5707
update lock file from catalog version
CharlieKolb Jan 17, 2025
46c845c
fix import
CharlieKolb Jan 17, 2025
b62e8b8
Add in progress work
CharlieKolb Jan 17, 2025
9091b60
Merge remote-tracking branch 'origin/master' into ADO-3112
CharlieKolb Jan 17, 2025
afba8d4
self review
CharlieKolb Jan 17, 2025
50c8ffa
update marker tag
CharlieKolb Jan 17, 2025
a2f4356
Remove extra padding
CharlieKolb Jan 17, 2025
ebf8e67
Merge remote-tracking branch 'origin/master' into ADO-3112
CharlieKolb Jan 27, 2025
a6e7226
Add another test
CharlieKolb Jan 27, 2025
44391c5
Rename file
CharlieKolb Jan 27, 2025
12dfc1e
Merge branch 'ADO-3112' into ADO-3034
CharlieKolb Jan 27, 2025
64ba5af
product feedback
CharlieKolb Jan 27, 2025
5fd29ac
telemetry and close button hover/active color
CharlieKolb Jan 27, 2025
4fbcb70
posthog telemetry
CharlieKolb Jan 27, 2025
40d4f95
tests and minor changes
CharlieKolb Jan 27, 2025
07a3285
more cleanup
CharlieKolb Jan 27, 2025
7cf74b6
refactor into override components
CharlieKolb Jan 28, 2025
25fde16
Finish resourceLocator override
CharlieKolb Jan 29, 2025
c255381
Merge remote-tracking branch 'origin/master' into ADO-3034
CharlieKolb Jan 30, 2025
12d8257
clean up
CharlieKolb Jan 30, 2025
97a883f
disable things if readonly
CharlieKolb Jan 30, 2025
c811613
auto-select text when disabling override
CharlieKolb Jan 31, 2025
47eabaa
minor cleanup
CharlieKolb Jan 31, 2025
f3a9ded
self review 1
CharlieKolb Jan 31, 2025
ad61b3e
bold model + review
CharlieKolb Jan 31, 2025
50de2e5
correct text color
CharlieKolb Jan 31, 2025
b6f368b
fix tests
CharlieKolb Jan 31, 2025
e9a958d
Merge branch 'master' into ADO-3034
CharlieKolb Feb 3, 2025
f198356
fix lint
CharlieKolb Feb 3, 2025
290385c
fix snapshots and test for disabled list
CharlieKolb Feb 3, 2025
65f34e4
Add ai telemetry
CharlieKolb Feb 3, 2025
889c900
fix two tests
CharlieKolb Feb 3, 2025
7dfd208
use padding instead of margin
CharlieKolb Feb 4, 2025
7a6eaa9
drop whitespace from marker
CharlieKolb Feb 4, 2025
22470ef
PR Feedback
CharlieKolb Feb 4, 2025
dfd3975
use proper() function
CharlieKolb Feb 4, 2025
97d16c9
fix test
CharlieKolb Feb 4, 2025
23f25fd
add telemetry tests
CharlieKolb Feb 4, 2025
6c3e47e
fix codex mock
CharlieKolb Feb 4, 2025
4220ce0
fix lint
CharlieKolb Feb 4, 2025
fa13022
move out persistent options
CharlieKolb Feb 4, 2025
b3d869e
update snapshots
CharlieKolb Feb 4, 2025
5d70ed9
Add parameterInputFull tests
CharlieKolb Feb 4, 2025
164a3b1
PR Feedback
CharlieKolb Feb 4, 2025
ad10221
update missing snapshot
CharlieKolb Feb 4, 2025
e817f1e
fix name and readd failing test
CharlieKolb Feb 4, 2025
0ae22b3
refactor override class
CharlieKolb Feb 4, 2025
883d016
fix types
CharlieKolb Feb 4, 2025
ee7f39a
move more code and change backslash/quote escaping
CharlieKolb Feb 4, 2025
9f3a031
remove comment
CharlieKolb Feb 4, 2025
e370984
Merge remote-tracking branch 'origin/master' into ADO-3034
CharlieKolb Feb 4, 2025
8080c42
fix e2e tests
CharlieKolb Feb 4, 2025
6172eb1
fix another e2e test
CharlieKolb Feb 4, 2025
972928c
fix more e2e tests
CharlieKolb Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/composables/ndv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export function populateMapperFields(fields: ReadonlyArray<[string, string]>) {
getParameterInputByName(name).type(value);

// Click on a parent to dismiss the pop up which hides the field below.
getParameterInputByName(name).parent().parent().parent().click('topLeft');
getParameterInputByName(name).parent().parent().parent().parent().click('topLeft');
}
}

Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/16-form-trigger-node.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ describe('n8n Form Trigger', () => {
getVisibleSelect().contains('Dropdown').click();
cy.contains('button', 'Add Field Option').click();
cy.contains('label', 'Field Options')
.parent()
.parent()
.nextAll()
.find('[data-test-id="parameter-input-field"]')
.eq(0)
.type('Option 1');
cy.contains('label', 'Field Options')
.parent()
.parent()
.nextAll()
.find('[data-test-id="parameter-input-field"]')
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/48-subworkflow-inputs.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ describe('Sub-workflow creation and typed usage', () => {
clickExecuteNode();

const expected = [
['-1', 'A String', '0:11:true2:3', 'aKey:-1', '[empty object]', 'false'],
['-1', 'Another String', '[empty array]', 'aDifferentKey:-1', '[empty array]', 'false'],
['-1', 'A String', '0:11:true2:3', 'aKey:-1', '[empty object]', 'true'],
['-1', 'Another String', '[empty array]', 'aDifferentKey:-1', '[empty array]', 'true'],
];
assertOutputTableContent(expected);

Expand All @@ -110,8 +110,8 @@ describe('Sub-workflow creation and typed usage', () => {
clickExecuteNode();

const expected2 = [
['-1', '5', '0:11:true2:3', 'aKey:-1', '[empty object]', 'false'],
['-1', '5', '[empty array]', 'aDifferentKey:-1', '[empty array]', 'false'],
['-1', '5', '0:11:true2:3', 'aKey:-1', '[empty object]', 'true'],
['-1', '5', '[empty array]', 'aDifferentKey:-1', '[empty array]', 'true'],
];

assertOutputTableContent(expected2);
Expand Down Expand Up @@ -167,8 +167,8 @@ describe('Sub-workflow creation and typed usage', () => {
);

assertOutputTableContent([
['[null]', '[null]', '[null]', '[null]', '[null]', 'false'],
['[null]', '[null]', '[null]', '[null]', '[null]', 'false'],
['[null]', '[null]', '[null]', '[null]', '[null]', 'true'],
['[null]', '[null]', '[null]', '[null]', '[null]', 'true'],
]);

clickExecuteNode();
Expand Down
26 changes: 13 additions & 13 deletions packages/cli/src/__tests__/load-nodes-and-credentials.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('LoadNodesAndCredentials', () => {
};
fullNodeWrapper.description.properties = [existingProp];
const result = instance.convertNodeToAiTool(fullNodeWrapper);
expect(result.description.properties).toHaveLength(3); // Existing prop + toolDescription + notice
expect(result.description.properties).toHaveLength(2); // Existing prop + toolDescription
expect(result.description.properties).toContainEqual(existingProp);
});

Expand All @@ -121,9 +121,9 @@ describe('LoadNodesAndCredentials', () => {
};
fullNodeWrapper.description.properties = [resourceProp];
const result = instance.convertNodeToAiTool(fullNodeWrapper);
expect(result.description.properties[1].name).toBe('descriptionType');
expect(result.description.properties[2].name).toBe('toolDescription');
expect(result.description.properties[3]).toEqual(resourceProp);
expect(result.description.properties[0].name).toBe('descriptionType');
expect(result.description.properties[1].name).toBe('toolDescription');
expect(result.description.properties[2]).toEqual(resourceProp);
});

it('should handle nodes with operation property', () => {
Expand All @@ -136,9 +136,9 @@ describe('LoadNodesAndCredentials', () => {
};
fullNodeWrapper.description.properties = [operationProp];
const result = instance.convertNodeToAiTool(fullNodeWrapper);
expect(result.description.properties[1].name).toBe('descriptionType');
expect(result.description.properties[2].name).toBe('toolDescription');
expect(result.description.properties[3]).toEqual(operationProp);
expect(result.description.properties[0].name).toBe('descriptionType');
expect(result.description.properties[1].name).toBe('toolDescription');
expect(result.description.properties[2]).toEqual(operationProp);
});

it('should handle nodes with both resource and operation properties', () => {
Expand All @@ -158,17 +158,17 @@ describe('LoadNodesAndCredentials', () => {
};
fullNodeWrapper.description.properties = [resourceProp, operationProp];
const result = instance.convertNodeToAiTool(fullNodeWrapper);
expect(result.description.properties[1].name).toBe('descriptionType');
expect(result.description.properties[2].name).toBe('toolDescription');
expect(result.description.properties[3]).toEqual(resourceProp);
expect(result.description.properties[4]).toEqual(operationProp);
expect(result.description.properties[0].name).toBe('descriptionType');
expect(result.description.properties[1].name).toBe('toolDescription');
expect(result.description.properties[2]).toEqual(resourceProp);
expect(result.description.properties[3]).toEqual(operationProp);
});

it('should handle nodes with empty properties', () => {
fullNodeWrapper.description.properties = [];
const result = instance.convertNodeToAiTool(fullNodeWrapper);
expect(result.description.properties).toHaveLength(2);
expect(result.description.properties[1].name).toBe('toolDescription');
expect(result.description.properties).toHaveLength(1);
expect(result.description.properties[0].name).toBe('toolDescription');
});

it('should handle nodes with existing codex property', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/events/relays/telemetry.event-relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ export class TelemetryEventRelay extends EventRelay {
sharing_role: userRole,
credential_type: null,
is_managed: false,
...TelemetryHelpers.resolveAIMetrics(workflow.nodes, this.nodeTypes),
};

if (!manualExecEventProperties.node_graph_string) {
Expand Down
10 changes: 0 additions & 10 deletions packages/cli/src/load-nodes-and-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,14 +484,6 @@ export class LoadNodesAndCredentials {
placeholder: `e.g. ${item.description.description}`,
};

const noticeProp: INodeProperties = {
displayName:
"Use the expression {{ $fromAI('placeholder_name') }} for any data to be filled by the model",
name: 'notice',
type: 'notice',
default: '',
};

item.description.properties.unshift(descProp);

// If node has resource or operation we can determine pre-populate tool description based on it
Expand All @@ -505,8 +497,6 @@ export class LoadNodesAndCredentials {
},
};
}

item.description.properties.unshift(noticeProp);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,39 @@ exports[`components > N8nCheckbox > should render with both child and label 1`]
class="container"
data-test-id="input-label"
>
<label
class="n8n-input-label inputLabel heading medium"
<div
class="labelRow"
>
<div
class="main-content"
<label
class="n8n-input-label inputLabel heading medium"
>
<div
class="title"
class="main-content"
>
<span
class="n8n-text size-medium regular"
<div
class="title"
>

Checkbox
<!--v-if-->

</span>
<span
class="n8n-text size-medium regular"
>

Checkbox
<!--v-if-->

</span>
</div>
<!--v-if-->
</div>
<!--v-if-->
</div>
<div
class="trailing-content"
>
<!--v-if-->
<!--v-if-->
<!--v-if-->
</div>
</label>
<div
class="trailing-content"
>
<!--v-if-->
<!--v-if-->
<!--v-if-->
</div>
</label>
<!--v-if-->
</div>


</div>
Expand Down Expand Up @@ -131,34 +136,39 @@ exports[`components > N8nCheckbox > should render with label 1`] = `
class="container"
data-test-id="input-label"
>
<label
class="n8n-input-label inputLabel heading medium"
<div
class="labelRow"
>
<div
class="main-content"
<label
class="n8n-input-label inputLabel heading medium"
>
<div
class="title"
class="main-content"
>
<span
class="n8n-text size-medium regular"
<div
class="title"
>

Checkbox
<!--v-if-->

</span>
<span
class="n8n-text size-medium regular"
>

Checkbox
<!--v-if-->

</span>
</div>
<!--v-if-->
</div>
<!--v-if-->
</div>
<div
class="trailing-content"
>
<!--v-if-->
<!--v-if-->
<!--v-if-->
</div>
</label>
<div
class="trailing-content"
>
<!--v-if-->
<!--v-if-->
<!--v-if-->
</div>
</label>
<!--v-if-->
</div>


</div>
Expand Down
Loading
Loading