Skip to content

Commit 476c141

Browse files
committed
feat(workflow): enhance custom node management and UI improvements
- Group custom nodes by type in WorkflowSidebar using Accordion component - Add "Save as Custom Node" functionality for multiple node types - Improve button styling with consistent hover effects and ghost variants - Center node position on direct object addition - Update property editor with save functionality for node types - Prevent saving of special nodes (loop, if-else, preview) as custom nodes - Enhance sidebar button styling with hover effects and text truncation - Add tooltips for execution buttons - Improve input field styling in custom node editor - Bump version to 1.69.0+3
1 parent 4052ceb commit 476c141

File tree

4 files changed

+330
-133
lines changed

4 files changed

+330
-133
lines changed

vscode/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "cody-ai",
44
"private": true,
55
"displayName": "Cody: AI Code Assistant",
6-
"version": "1.69.0+2",
6+
"version": "1.69.0+3",
77
"publisher": "sourcegraph",
88
"license": "Apache-2.0",
99
"icon": "resources/sourcegraph.png",

vscode/webviews/workflow/components/PropertyEditor.tsx

+30-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ export const PropertyEditor: React.FC<PropertyEditorProps> = ({
5858
)
5959

6060
const handleSaveCustomNode = () => {
61-
if (node.type === NodeType.CLI) {
61+
if (
62+
node.type !== NodeType.LOOP_START &&
63+
node.type !== NodeType.LOOP_END &&
64+
node.type !== NodeType.IF_ELSE &&
65+
node.type !== NodeType.PREVIEW
66+
) {
6267
onSaveCustomNode(node)
6368
}
6469
}
@@ -89,7 +94,7 @@ export const PropertyEditor: React.FC<PropertyEditorProps> = ({
8994
{node.type === NodeType.CLI && (
9095
<div className="tw-flex tw-flex-col tw-gap-2">
9196
<Button variant="secondary" onClick={handleSaveCustomNode} className="tw-w-full">
92-
<Save className="tw-mr-2" size={16} />
97+
<Save className="tw-mr-2" size={14} />
9398
Save as Custom Node
9499
</Button>
95100

@@ -123,7 +128,11 @@ export const PropertyEditor: React.FC<PropertyEditorProps> = ({
123128
</div>
124129
)}
125130
{node.type === NodeType.LLM && (
126-
<>
131+
<div className="tw-flex tw-flex-col tw-gap-2">
132+
<Button variant="secondary" onClick={handleSaveCustomNode} className="tw-w-full">
133+
<Save className="tw-mr-2" size={14} />
134+
Save as Custom Node
135+
</Button>
127136
<div>
128137
<Label htmlFor="node-prompt">Prompt</Label>
129138
<Textarea
@@ -265,10 +274,14 @@ export const PropertyEditor: React.FC<PropertyEditorProps> = ({
265274
{(node as LLMNode).data.maxTokens || 250}
266275
</span>
267276
</div>
268-
</>
277+
</div>
269278
)}
270279
{node.type === NodeType.INPUT && (
271280
<div>
281+
<Button variant="secondary" onClick={handleSaveCustomNode} className="tw-w-full">
282+
<Save className="tw-mr-2" size={14} />
283+
Save as Custom Node
284+
</Button>
272285
<Label htmlFor="node-input">Input Text</Label>
273286
<Textarea
274287
id="node-input"
@@ -282,6 +295,10 @@ export const PropertyEditor: React.FC<PropertyEditorProps> = ({
282295
)}
283296
{node.type === NodeType.SEARCH_CONTEXT && (
284297
<div className="tw-flex tw-flex-col tw-gap-2">
298+
<Button variant="secondary" onClick={handleSaveCustomNode} className="tw-w-full">
299+
<Save className="tw-mr-2" size={14} />
300+
Save as Custom Node
301+
</Button>
285302
<Label htmlFor="node-input">Context</Label>
286303
<Textarea
287304
id="node-input"
@@ -345,9 +362,13 @@ export const PropertyEditor: React.FC<PropertyEditorProps> = ({
345362
</div>
346363
</div>
347364
)}
348-
{node.type === NodeType.ACCUMULATOR && ( // ADD ACCUMULATOR NODE PROPERTY EDITOR
365+
{node.type === NodeType.ACCUMULATOR && (
349366
<div className="tw-flex tw-flex-col tw-gap-4">
350367
<div>
368+
<Button variant="secondary" onClick={handleSaveCustomNode} className="tw-w-full">
369+
<Save className="tw-mr-2" size={14} />
370+
Save as Custom Node
371+
</Button>
351372
<Label htmlFor="accumulator-variable-name">Unique Variable Name</Label>
352373
<Input
353374
id="accumulator-variable-name"
@@ -388,6 +409,10 @@ export const PropertyEditor: React.FC<PropertyEditorProps> = ({
388409
{node.type === NodeType.VARIABLE && (
389410
<div className="tw-flex tw-flex-col tw-gap-4">
390411
<div>
412+
<Button variant="secondary" onClick={handleSaveCustomNode} className="tw-w-full">
413+
<Save className="tw-mr-2" size={14} />
414+
Save as Custom Node
415+
</Button>
391416
<Label htmlFor="variable-name">Variable Name</Label>
392417
<Input
393418
id="variable-name"

0 commit comments

Comments
 (0)