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.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
move tempaltes api calls to ee
Ahmed Essamfc7fefc54fc6
diff --git a/packages/app/src/builder-ui/pages/builder/agent-settings.ts b/packages/app/src/builder-ui/pages/builder/agent-settings.tsindex 22d758c5..0b918765 100644--- a/packages/app/src/builder-ui/pages/builder/agent-settings.ts+++ b/packages/app/src/builder-ui/pages/builder/agent-settings.ts@@ -1,4 +1,5 @@import { PRIMARY_BUTTON_STYLE } from '@src/react/shared/constants/style';+import { plugins, PluginTarget, PluginType } from '@src/react/shared/plugins/Plugins';import { errorToast, successToast } from '@src/shared/components/toast';import { EMBODIMENT_DESCRIPTIONS, SMYTHOS_DOCS_URL } from '../../../shared/constants/general';import { EmbodimentRPCManager } from '../../../shared/services/embodiment_rpc_manager';@@ -605,28 +606,22 @@ async function loadAgentDomainsList() {}async function loadAgentTemplatesList() {- const result = await fetch('/api/enterprise/page/builder/agent-templates', {- method: 'GET',- headers: { 'Content-Type': 'application/json' },- })- .then((response) => {- if (response.ok) {- return response.json();- } else {- //throw new Error('Something went wrong');- return { error: 'Failed to load templates' };- }- })- .catch((error) => {- console.log(error);- });-- if (!result.data) {- console.log('Error reading agents templates');- return {};- }- const templates = result.data;- return templates;+ const pluginMenuItems = plugins.getPluginsByTarget(+ PluginTarget.BuilderLoadAgentTemplates,+ PluginType.Function,+ ) as {+ function: () => Promise<any>;+ }[];++ const templatesPromises = pluginMenuItems.map((item) => item.function());+ // a teamplate plugin will output = {"key": "value{any}""}+ const templateOutputs = await Promise.all(templatesPromises);+ const mergedTemplates = templateOutputs.reduce((acc, curr) => {+ return { ...acc, ...curr };+ }, {});++ console.log('mergedTemplates', mergedTemplates);+ return mergedTemplates;}function updateWorkspaceEmbodiments(agent) {diff --git a/packages/app/src/builder-ui/workspace/Workspace.class.ts b/packages/app/src/builder-ui/workspace/Workspace.class.tsindex 5dbc25c0..ce2e42c6 100644--- a/packages/app/src/builder-ui/workspace/Workspace.class.ts+++ b/packages/app/src/builder-ui/workspace/Workspace.class.ts@@ -2216,10 +2216,6 @@ export class Workspace extends EventEmitter {}}- public async saveTemplate() {- return workspaceHelper.saveTemplate.call(this);- }-public async exportTemplate() {return workspaceHelper.exportTemplate.call(this);}diff --git a/packages/app/src/builder-ui/workspace/Workspace.helper.ts b/packages/app/src/builder-ui/workspace/Workspace.helper.tsindex c9606f54..900d125d 100644--- a/packages/app/src/builder-ui/workspace/Workspace.helper.ts+++ b/packages/app/src/builder-ui/workspace/Workspace.helper.ts@@ -45,44 +45,6 @@ export function getTemplateInfo() {return templateInfo;}-// Save a template from the agent-export async function saveTemplate() {- if (this.locked) return false;-- // When the agent is not loaded, we can't save- if (!this.agent.id) return false;-- console.log('Template saving...');-- try {- const data = await this.export();-- // we don't want to save the debugSessionEnabled flag in template file- delete data.debugSessionEnabled;-- if (!data?.templateInfo) {- const templateInfo = this.getTemplateInfo();- data.templateInfo = templateInfo;- }- const templateId = data?.templateInfo?.id;-- await fetch('/api/enterprise/page/builder/agent-templates', {- method: 'PUT',- headers: {- 'Content-Type': 'application/json',- },- body: JSON.stringify(data),- });-- // Save the templateInfo to the agent- await this.saveAgent(this.agent?.name, this.agent?.domain, data);-- return templateId;- } catch (error) {- throw error;- }-}-// Export the template only, so we don't need to save the agentexport async function exportTemplate() {if (this.locked) return false;diff --git a/packages/app/src/react/shared/plugins/Plugins.ts b/packages/app/src/react/shared/plugins/Plugins.tsindex 1ecf52b9..978bd302 100644--- a/packages/app/src/react/shared/plugins/Plugins.ts+++ b/packages/app/src/react/shared/plugins/Plugins.ts@@ -1,5 +1,6 @@export enum PluginTarget {BuilderLoadScript = 'builder/LoadScript',+ BuilderLoadAgentTemplates = 'builder/LoadAgentTemplates',TopMenuItem = 'topMenuItem',Onboarding = 'onboarding',SidebarMenuItems = 'sidebarMenuItems',