Repository navigation
Expand file tree
/
Copy pathhelpContent.js
More file actions
235 lines (220 loc) · 6.73 KB
/
Copy pathhelpContent.js
File metadata and controls
235 lines (220 loc) · 6.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
export const helpContent = {
// Start Node Help
startNode: {
title: "help.startNode.title",
description: "help.startNode.description",
examples: [
"help.startNode.examples.0",
"help.startNode.examples.1"
],
learnMoreUrl: "/tutorial#2-create-nodes"
},
// Workflow Node Types
workflowNode: {
agent: {
title: "help.workflowNode.agent.title",
description: "help.workflowNode.agent.description",
examples: [
"help.workflowNode.agent.examples.0",
"help.workflowNode.agent.examples.1",
"help.workflowNode.agent.examples.2"
],
learnMoreUrl: "/tutorial#agent-node"
},
human: {
title: "help.workflowNode.human.title",
description: "help.workflowNode.human.description",
examples: [
"help.workflowNode.human.examples.0",
"help.workflowNode.human.examples.1",
"help.workflowNode.human.examples.2"
],
learnMoreUrl: "/tutorial#human-node"
},
python: {
title: "help.workflowNode.python.title",
description: "help.workflowNode.python.description",
examples: [
"help.workflowNode.python.examples.0",
"help.workflowNode.python.examples.1",
"help.workflowNode.python.examples.2"
],
learnMoreUrl: "/tutorial#python-node"
},
passthrough: {
title: "help.workflowNode.passthrough.title",
description: "help.workflowNode.passthrough.description",
examples: [
"help.workflowNode.passthrough.examples.0",
"help.workflowNode.passthrough.examples.1",
"help.workflowNode.passthrough.examples.2"
],
learnMoreUrl: "/tutorial#passthrough-node"
},
literal: {
title: "help.workflowNode.literal.title",
description: "help.workflowNode.literal.description",
examples: [
"help.workflowNode.literal.examples.0",
"help.workflowNode.literal.examples.1",
"help.workflowNode.literal.examples.2"
],
learnMoreUrl: "/tutorial#literal-node"
},
loop_counter: {
title: "help.workflowNode.loop_counter.title",
description: "help.workflowNode.loop_counter.description",
examples: [
"help.workflowNode.loop_counter.examples.0",
"help.workflowNode.loop_counter.examples.1",
"help.workflowNode.loop_counter.examples.2"
],
learnMoreUrl: "/tutorial#loop-counter-node"
},
subgraph: {
title: "help.workflowNode.subgraph.title",
description: "help.workflowNode.subgraph.description",
examples: [
"help.workflowNode.subgraph.examples.0",
"help.workflowNode.subgraph.examples.1",
"help.workflowNode.subgraph.examples.2"
],
learnMoreUrl: "/tutorial#subgraph-node"
},
unknown: {
title: "help.workflowNode.unknown.title",
description: "help.workflowNode.unknown.description",
learnMoreUrl: "/tutorial#2-create-nodes"
}
},
// Workflow Edge Help
edge: {
basic: {
title: "help.edge.basic.title",
description: "help.edge.basic.description",
examples: [
"help.edge.basic.examples.0",
"help.edge.basic.examples.1"
],
learnMoreUrl: "/tutorial#what-is-an-edge"
},
trigger: {
enabled: {
description: "help.edge.trigger.enabled.description",
},
disabled: {
description: "help.edge.trigger.disabled.description",
}
},
condition: {
hasCondition: {
description: "help.edge.condition.hasCondition.description",
learnMoreUrl: "/tutorial#edge-condition"
}
}
},
// Context Menu Actions
contextMenu: {
createNode: {
description: "help.contextMenu.createNode.description",
},
copyNode: {
description: "help.contextMenu.copyNode.description",
},
deleteNode: {
description: "help.contextMenu.deleteNode.description",
},
deleteEdge: {
description: "help.contextMenu.deleteEdge.description",
},
createNodeButton: {
description: "help.contextMenu.createNodeButton.description",
},
configureGraph: {
description: "help.contextMenu.configureGraph.description",
},
launch: {
description: "help.contextMenu.launch.description",
},
createEdge: {
description: "help.contextMenu.createEdge.description",
},
manageVariables: {
description: "help.contextMenu.manageVariables.description",
},
manageMemories: {
description: "help.contextMenu.manageMemories.description",
},
renameWorkflow: {
description: "help.contextMenu.renameWorkflow.description",
},
copyWorkflow: {
description: "help.contextMenu.copyWorkflow.description",
}
}
}
/**
* Get help content by key path
* @param {string} key - Dot-separated path to content (e.g., 'workflowNode.agent')
* @returns {Object|null} Help content object or null if not found
*/
export function getHelpContent(key) {
const keys = key.split('.')
let content = helpContent
for (const k of keys) {
if (content && typeof content === 'object' && k in content) {
content = content[k]
} else {
// Return null for missing content instead of fallback
return null
}
}
// Ensure we return an object with at least a description
if (typeof content === 'string') {
return { description: content }
}
return content || null
}
/**
* Get node-specific help content based on node type
* @param {string} nodeType - The type of node (agent, human, python, etc.)
* @returns {Object|null} Help content for that node type, or null for unknown types
*/
export function getNodeHelp(nodeType) {
if (!nodeType) {
return null
}
const type = nodeType.toLowerCase()
const content = getHelpContent(`workflowNode.${type}`)
// Return null for unknown types (when content lookup fails)
// This prevents showing tooltips for custom/user-defined node types
return content
}
/**
* Get edge help content based on edge properties
* @param {Object} edgeData - The edge data object
* @returns {Object} Combined help content for the edge
*/
export function getEdgeHelp(edgeData) {
const base = { ...helpContent.edge.basic }
base.descriptions = [base.description] // Change to array to support multiple parts
// Add trigger information
const trigger = edgeData?.trigger !== undefined ? edgeData.trigger : true
if (!trigger) {
base.descriptions.push(helpContent.edge.trigger.disabled.description)
}
// Add condition information
if (edgeData?.condition) {
base.descriptions.push(helpContent.edge.condition.hasCondition.description)
if (!base.learnMoreUrl) {
base.learnMoreUrl = helpContent.edge.condition.hasCondition.learnMoreUrl
}
}
return base
}
export default {
helpContent,
getHelpContent,
getNodeHelp,
getEdgeHelp
}