Allow persisting the expected output in the code (#46)

By allowing specifying the UI outputs in the code, any time user runs `kh export ...`, that outputs in the code will be included in the UI YAML file. Otherwise, any time the user runs `kh export ...`, the output section in the UI YAML file will be reset to the default output.
This commit is contained in:
Nguyen Trung Duc (john) 2023-10-13 10:26:48 +07:00 committed by GitHub
parent 6e7905cbc0
commit da6b35f520

View File

@ -146,11 +146,14 @@ def export_pipeline_to_config(
}, },
} }
else: else:
outputs = [{"step": ".", "getter": "_get_output", "component": "text"}]
if hasattr(pipeline, "_promptui_outputs"):
outputs = pipeline._promptui_outputs
config_obj = { config_obj = {
"ui-type": ui_type, "ui-type": ui_type,
"params": handle_node(pipeline_def), "params": handle_node(pipeline_def),
"inputs": handle_input(pipeline), "inputs": handle_input(pipeline),
"outputs": [{"step": ".", "getter": "_get_output", "component": "text"}], "outputs": outputs,
"logs": { "logs": {
"full_pipeline": { "full_pipeline": {
"input": { "input": {