feat(editor): Easy AI workflow improvements (#12400)

This commit is contained in:
Milorad FIlipović
2024-12-31 14:38:32 +01:00
committed by GitHub
parent f56ad8cf49
commit 8dc691dc62
5 changed files with 93 additions and 24 deletions

View File

@@ -7,7 +7,7 @@ import { useWorkflowsStore } from '@/stores/workflows.store';
import { onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import type { IWorkflowDataCreate } from '@/Interface';
import { EASY_AI_WORKFLOW_JSON, SAMPLE_SUBWORKFLOW_WORKFLOW } from '@/constants.workflows';
import { SAMPLE_SUBWORKFLOW_WORKFLOW } from '@/constants.workflows';
const loadingService = useLoadingService();
const templateStore = useTemplatesStore();
@@ -21,11 +21,6 @@ const openWorkflowTemplate = async (templateId: string) => {
await openSampleSubworkflow();
return;
}
if (templateId === EASY_AI_WORKFLOW_JSON.meta.templateId) {
await openEasyAIWorkflow();
return;
}
try {
loadingService.startLoading();
const template = await templateStore.getFixedWorkflowTemplate(templateId);
@@ -63,21 +58,6 @@ const openWorkflowTemplate = async (templateId: string) => {
}
};
const openEasyAIWorkflow = async () => {
try {
loadingService.startLoading();
const newWorkflow = await workflowsStore.createNewWorkflow(EASY_AI_WORKFLOW_JSON);
await router.replace({
name: VIEWS.WORKFLOW,
params: { name: newWorkflow.id },
});
loadingService.stopLoading();
} catch (e) {
await router.replace({ name: VIEWS.NEW_WORKFLOW });
loadingService.stopLoading();
}
};
const openSampleSubworkflow = async () => {
try {
loadingService.startLoading();