@@ -292,55 +292,55 @@ IP 和 Port 配置完成后,点击确认,调试插件会自动连接到目
292292
2932931 . 假设你已经有编排代码如下,其中,graph 的输入定义为 ` any ` ,` node_1 ` 的输入定义为 ` *NodeInfo ` ;
294294
295- ``` go
296- type NodeInfo struct {
297- Message string
298- }
295+ ``` go
296+ type NodeInfo struct {
297+ Message string
298+ }
299299
300- func RegisterGraphOfInterfaceType (ctx context .Context ) {
301- // Define a graph that input parameter is any.
302- g := compose.NewGraph [any, string ]()
300+ func RegisterGraphOfInterfaceType (ctx context .Context ) {
301+ // Define a graph that input parameter is any.
302+ g := compose.NewGraph [any, string ]()
303303
304- _ = g.AddLambdaNode (" node_1" , compose.InvokableLambda (func (ctx context.Context , input *NodeInfo) (output string , err error ) {
305- if input == nil {
306- return " " , nil
307- }
308- return input.Message + " process by node_1," , nil
309- }))
304+ _ = g.AddLambdaNode (" node_1" , compose.InvokableLambda (func (ctx context.Context , input *NodeInfo) (output string , err error ) {
305+ if input == nil {
306+ return " " , nil
307+ }
308+ return input.Message + " process by node_1," , nil
309+ }))
310310
311- _ = g.AddLambdaNode (" node_2" , compose.InvokableLambda (func (ctx context.Context , input string ) (output string , err error ) {
312- return input + " process by node_2," , nil
313- }))
311+ _ = g.AddLambdaNode (" node_2" , compose.InvokableLambda (func (ctx context.Context , input string ) (output string , err error ) {
312+ return input + " process by node_2," , nil
313+ }))
314314
315- _ = g.AddLambdaNode (" node_3" , compose.InvokableLambda (func (ctx context.Context , input string ) (output string , err error ) {
316- return input + " process by node_3," , nil
317- }))
315+ _ = g.AddLambdaNode (" node_3" , compose.InvokableLambda (func (ctx context.Context , input string ) (output string , err error ) {
316+ return input + " process by node_3," , nil
317+ }))
318318
319- _ = g.AddEdge (compose._START_ , " node_1" )
319+ _ = g.AddEdge (compose._START_ , " node_1" )
320320
321- _ = g.AddEdge (" node_1" , " node_2" )
321+ _ = g.AddEdge (" node_1" , " node_2" )
322322
323- _ = g.AddEdge (" node_2" , " node_3" )
323+ _ = g.AddEdge (" node_2" , " node_3" )
324324
325- _ = g.AddEdge (" node_3" , compose._END_ )
325+ _ = g.AddEdge (" node_3" , compose._END_ )
326326
327- r , err := g.Compile (ctx)
328- if err != nil {
329- logs.Errorf (" compile graph failed, err=%v " , err)
330- return
331- }
332- }
333- ```
327+ r , err := g.Compile (ctx)
328+ if err != nil {
329+ logs.Errorf (" compile graph failed, err=%v " , err)
330+ return
331+ }
332+ }
333+ ```
334334
335- 2 . 调试前,通过 ` AppendType ` 方法在 ` Init() ` 时注册自定义的 ` *NodeInfo ` 类型:
335+ 1 . 调试前,通过 ` AppendType ` 方法在 ` Init() ` 时注册自定义的 ` *NodeInfo ` 类型:
336336
337- ``` go
338- err := devops.Init (ctx, devops.AppendType (&graph.NodeInfo {}))
339- ```
337+ ``` go
338+ err := devops.Init (ctx, devops.AppendType (&graph.NodeInfo {}))
339+ ```
340340
341- 3 . 调试过程中,在 Test Run 的 Json 输入框中,对于 interface 类型的字段,默认会呈现为 ` {} ` 。可以通过在 ` {} ` 中键入一个空格,来查看所有内置的以及自定义注册的数据类型,并选择该 interface 的具体实现类型。
341+ 1 . 调试过程中,在 Test Run 的 Json 输入框中,对于 interface 类型的字段,默认会呈现为 ` {} ` 。可以通过在 ` {} ` 中键入一个空格,来查看所有内置的以及自定义注册的数据类型,并选择该 interface 的具体实现类型。
342342 <a href =" /img/eino/eino_debug_run_code.png " target =" _blank " ><img src =" /img/eino/eino_debug_run_code.png " /></a >
343- 4 . 在 ` _value ` 字段中补全调试节点输入。
343+ 2 . 在 ` _value ` 字段中补全调试节点输入。
344344 <a href =" /img/eino/eino_debug_run_code_3.png " target =" _blank " ><img src =" /img/eino/eino_debug_run_code_3.png " /></a >
345- 5 . 点击确认,查看调试结果。
345+ 3 . 点击确认,查看调试结果。
346346 <a href =" /img/eino/eino_debug_panel_2.png " target =" _blank " ><img src =" /img/eino/eino_debug_panel_2.png " /></a >
0 commit comments