接口 FlowAiHandler


public interface FlowAiHandler
流程 AI 智能体处理器接口
从以下版本开始:
1.0
  • 方法详细资料

    • handle

      default boolean handle(FlowContext flowLongContext, Execution execution, NodeModel nodeModel)
    • processAiResponse

      boolean processAiResponse(FlowContext flowLongContext, Execution execution, NodeModel nodeModel, AiResponse aiResponse)
      处理 AI 相应对象逻辑
      参数:
      flowLongContext - FlowContext
      execution - Execution
      nodeModel - NodeModel
      aiResponse - AiResponse
      返回:
      true 处理成功 false 处理失败
    • mergeAiVariables

      default void mergeAiVariables(Execution execution, AiResponse aiResponse, AiConfig aiConfig)
      合并 AI 提取的变量到执行参数
    • execute

      AiResponse execute(FlowContext flowLongContext, Execution execution, NodeModel nodeModel)
      执行 AI 处理并返回结构化响应
      参数:
      flowLongContext - FlowContext
      execution - Execution
      nodeModel - NodeModel
      返回:
      AiResponse AI 结构化响应
    • decideRoute

      default String decideRoute(FlowContext flowLongContext, Execution execution, NodeModel nodeModel, Map<String,Object> args)
      AI 智能路由决策:直接返回应该走的分支 NodeKey
      参数:
      flowLongContext - FlowContext
      execution - Execution
      nodeModel - NodeModel
      args - 路由参数内容
      返回:
      目标分支的 NodeKey,返回 null 表示 AI 无法决策,需走普通条件判断
    • decideInclusiveRoutes

      default List<String> decideInclusiveRoutes(FlowContext flowLongContext, Execution execution, NodeModel nodeModel, Map<String,Object> args)
      AI 智能包容分支决策:返回应该同时执行的多个分支 NodeKey 列表

      包容分支与条件分支不同,可以同时执行多个分支

      参数:
      flowLongContext - FlowContext
      execution - Execution
      nodeModel - NodeModel
      args - 路由参数内容
      返回:
      目标分支的 NodeKey 列表,返回 null 或空列表表示 AI 无法决策,需走普通条件判断
    • onAsyncComplete

      default boolean onAsyncComplete(FlowContext flowLongContext, String asyncToken, AiResponse aiResponse)
      异步回调处理:当 AI 异步处理完成后调用
      参数:
      flowLongContext - FlowContext
      asyncToken - 异步处理凭证
      aiResponse - AI 响应结果
      返回:
      true 恢复流程成功 false 失败