Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

fix(component): api endpoint outputs not persisting order

Ahmed Essam956d9995d37d
diff --git a/packages/app/src/builder-ui/components/APIEndpoint.class.ts b/packages/app/src/builder-ui/components/APIEndpoint.class.ts
index d87a9d91..24d12ee9 100644
--- a/packages/app/src/builder-ui/components/APIEndpoint.class.ts
+++ b/packages/app/src/builder-ui/components/APIEndpoint.class.ts
@@ -508,16 +508,19 @@ export class APIEndpoint extends Component {
}
public async addInput(parent: any, name: any, inputProperties: any = {}): Promise<any> {
- if (this.isOnAdvancedMode) {
+ const isRenderingAgent = this.workspace.locked; // if the agent is being rendered, the lock will be true
+ if (
+ this.isOnAdvancedMode ||
+ this.properties.defaultOutputs.includes(name) ||
+ isRenderingAgent
+ ) {
const result = await super.addInput(parent, name, inputProperties);
this.updateFormPreviewButton();
return result;
}
- if (this.properties.defaultOutputs.includes(name)) return super.addInput(parent, name);
const inputDiv: any = await super.addInput(parent, name, inputProperties);
const outputParent = parent.parentElement.querySelector('.output-container');
- const inputProps = this.properties.inputProps?.find((c) => c.name === name);
// Get the default value from input properties or existing attributes
const defaultValue =
@@ -572,8 +575,8 @@ export class APIEndpoint extends Component {
}
public async addOutput(parent: any, name: any, outputProperties: any = {}): Promise<any> {
- if (this.isOnAdvancedMode) return super.addOutput(parent, name, outputProperties);
- if (this.properties.defaultOutputs.includes(name))
+ const isRenderingAgent = this.workspace.locked; // if the agent is being rendered, the lock will be true
+ if (this.isOnAdvancedMode || this.properties.defaultOutputs.includes(name) || isRenderingAgent)
return super.addOutput(parent, name, outputProperties);
return null;