@@ -48,7 +48,9 @@ type flowContext struct {
4848// DefineFlow creates a Flow that runs fn, and registers it as an action. fn takes an input of type In and returns an output of type Out.
4949func DefineFlow [In , Out any ](r api.Registry , name string , fn Func [In , Out ]) * Flow [In , Out , struct {}] {
5050 return (* Flow [In , Out , struct {}])(DefineAction (r , name , api .ActionTypeFlow , nil , nil , func (ctx context.Context , input In ) (Out , error ) {
51- fc := & flowContext {}
51+ fc := & flowContext {
52+ flowName : name ,
53+ }
5254 ctx = flowContextKey .NewContext (ctx , fc )
5355 return fn (ctx , input )
5456 }))
@@ -65,7 +67,9 @@ func DefineFlow[In, Out any](r api.Registry, name string, fn Func[In, Out]) *Flo
6567// Otherwise, it should ignore the callback and just return a result.
6668func DefineStreamingFlow [In , Out , Stream any ](r api.Registry , name string , fn StreamingFunc [In , Out , Stream ]) * Flow [In , Out , Stream ] {
6769 return (* Flow [In , Out , Stream ])(DefineStreamingAction (r , name , api .ActionTypeFlow , nil , nil , func (ctx context.Context , input In , cb func (context.Context , Stream ) error ) (Out , error ) {
68- fc := & flowContext {}
70+ fc := & flowContext {
71+ flowName : name ,
72+ }
6973 ctx = flowContextKey .NewContext (ctx , fc )
7074 return fn (ctx , input , cb )
7175 }))
0 commit comments