Package org.machanism.machai.gw.tools
Class ActFunctionTools
java.lang.Object
org.machanism.machai.gw.tools.ActFunctionTools
- All Implemented Interfaces:
FunctionTools
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTools(Genai provider) getActDetails(com.fasterxml.jackson.databind.JsonNode props, File workingDir) getActList(com.fasterxml.jackson.databind.JsonNode params, File workingDir) Lists all available Act TOML files in the specified directory or built-in directory.moveToEpisode(com.fasterxml.jackson.databind.JsonNode props, File workingDir) Moves to the next episode, or to the episode specified by 'id' if provided.performAct(com.fasterxml.jackson.databind.JsonNode props, File workingDir) Performs an act operation based on the provided properties and working directory.repeateEpisode(com.fasterxml.jackson.databind.JsonNode props, File workingDir) Repeats the current episode by throwing a RepeatEpisodeException.voidsetConfigurator(Configurator configurator)
-
Constructor Details
-
ActFunctionTools
public ActFunctionTools()
-
-
Method Details
-
applyTools
- Specified by:
applyToolsin interfaceFunctionTools
-
getActList
public Object getActList(com.fasterxml.jackson.databind.JsonNode params, File workingDir) throws IOException Lists all available Act TOML files in the specified directory or built-in directory.- Throws:
IOException
-
getBaseActList
- Throws:
IOException
-
getActDetails
public Object getActDetails(com.fasterxml.jackson.databind.JsonNode props, File workingDir) throws IOException - Throws:
IOException
-
moveToEpisode
Moves to the next episode, or to the episode specified by 'id' if provided.- Parameters:
params- The first argument is expected to be a JsonNode containing an optional 'id' property. The second argument is a File representing the project directory.- Returns:
- Never returns normally; always throws MoveToEpisodeException.
-
repeateEpisode
Repeats the current episode by throwing a RepeatEpisodeException.- Parameters:
props- The first argument is expected to be a JsonNode (can be empty or contain context).workingDir- The project directory.- Returns:
- Never returns normally; always throws RepeatEpisodeException.
-
performAct
public Object performAct(com.fasterxml.jackson.databind.JsonNode props, File workingDir) throws IOException Performs an act operation based on the provided properties and working directory.This method configures act execution using the supplied JSON properties and a working directory. It logs the operation, parses environment properties, sets up the act processor, and scans documents in the specified directory. The act name and other configuration parameters are extracted from the
propsJSON node.Properties in
props:- actName (required): The name of the act to perform.
- properties (optional): A string containing environment-style key-value pairs (e.g.,
"KEY1=VALUE1;KEY2=VALUE2").- model (
GWConstants.MODEL_PROP_NAME): The model to use for act processing. If not specified, defaults tonull. - scanDir (
GWConstants.SCAN_DIR_PROP_NAME): The directory to scan for documents. If not specified, defaults to the providedworkingDirpath. - actsLocation (
GWConstants.ACTS_LOCATION_PROP_NAME): The location of act definitions. If not specified, defaults tonull.
- model (
Example:
JsonNode props = ...; // JSON with "actName" and optional "properties" File workingDir = new File("/path/to/dir"); Object result = performAct(props, workingDir);- Parameters:
props- JSON node containing act configuration, including "actName" and optional "properties" stringworkingDir- the directory in which to perform the act operation- Returns:
- a result object indicating the outcome of the act operation (typically "success")
- Throws:
IOException- if an I/O error occurs during document scanning or act processing
-
setConfigurator
- Specified by:
setConfiguratorin interfaceFunctionTools
-