Skip to main content

parseConversationDefaultInputArgs

workflow.parseConversationDefaultInputArgs(args) Resolves fixed parameters written conversation the default input box. It only reads --message, --images, and --files, does not automatically read WorkflowContext, and does not replace createInput of executor.

When workflow enables shared default input boxes in executor.conversation.defaultInput,Desktop, server embed, and external embedding serialize the input to these 3 sets of parameters. workflow requires this helper to be explicitly called in createInput({ args }).

Signature

workflow.parseConversationDefaultInputArgs(
args: string[],
): {
message: string;
images: WorkflowFileReference[];
files: WorkflowFileReference[];
}

parsing rules

ParameterBehavior
--message <text>Reads the last occurrence of the value and executes trim(); returns an empty string if not passed.
--images <value>Each occurrence is parsed into one or more WorkflowFileReference s and eventually merged into an array.
--files <value>Each occurrence is parsed into one or more WorkflowFileReference s and eventually merged into an array.
Missing valueThe flag is ignored.
Other parametersReserved for business code to parse, this helper does not process.

--images and --files reuse file reference protocols, supporting JSON strings, file reference objects, file reference arrays, or local path strings. The parsing logic is the same as the file input node, and the underlying layer uses parseWorkflowFileReferences().

executor Configuration

export const executor = workflow.defineExecutor<Input, OutputPayload>({
projectType: "conversation",
workflow: conversationWorkflow,
conversation: {
defaultInput: {
enabled: true,
attachments: {
images: true,
files: true,
},
},
},
createInput({ args, conversationId }) {
const defaults = workflow.parseConversationDefaultInputArgs(args);
return {
conversationId,
message: defaults.message,
images: defaults.images,
files: defaults.files,
};
},
});

with file input node

The helper only resolves the parameter to WorkflowFileReference[]. If you need to read the contents of the file, pass the reference to workflow.createFileInputNode():

const imageInputNode = workflow.createFileInputNode({
name: "images",
accept: ["image/png", "image/jpeg", "image/webp"],
multiple: true,
});

const images = await workflow.runNode(imageInputNode, input.images, context);
const imageParts = await Promise.all(images.map((file) => file.toLLMImagePart()));

Precautions

SceneDescription
Multiple --messageReturns the last value suitable for the host to overwrite the previous draft with the next input.
Multiple attachments--images / --files merges all occurrences.
Enable default input boxYou still need to explicitly call the helper in createInput.
CLI Manual debuggingYou can directly transfer --message, --images, --files to simulate the default input box.