| | |
| | | <main class="relative flex h-full w-full flex-1"> |
| | | <Sidebar @dragstart="handleOnDragStart" /> |
| | | <div class="relative h-full flex-1 overflow-hidden" v-if="flowJson"> |
| | | <MainCanvas :flowJson="flowJson"/> |
| | | <MainCanvas :flowJson="flowJson" :agentNames="agentNames" /> |
| | | </div> |
| | | </main> |
| | | </div> |
| | |
| | | import { computed, onMounted, ref } from 'vue'; |
| | | import Header from './components/Header.vue'; |
| | | import Sidebar from './components/Sidebar.vue'; |
| | | import { get_workflow_agent_list, get_workflow_json_flow } from '/@/api/workflow'; |
| | | import { get_agent_names, get_workflow_agent_list, get_workflow_json_flow } from '/@/api/workflow'; |
| | | import MainCanvas from '/@/components/vue-flow/MainCanvas.vue'; |
| | | import router from '/@/router'; |
| | | |
| | |
| | | const res = await get_workflow_json_flow({ |
| | | agent_id: id, |
| | | }); |
| | | flowJson.value = res.json_ok ? res.json_flow : {}; |
| | | flowJson.value = res.json_ok ? res.json_flow ?? {} : {}; |
| | | }; |
| | | |
| | | |
| | | const getFlowAgent =async()=>{ |
| | | const getFlowAgent = async () => { |
| | | const res = await get_workflow_agent_list(); |
| | | const flowAgentList = res.values??[] |
| | | const currentFlowAgent = flowAgentList.find((item:any)=>item.id===queryId.value) |
| | | const flowAgentList = res.values ?? []; |
| | | const currentFlowAgent = flowAgentList.find((item: any) => item.id === queryId.value); |
| | | flowAgent.value = currentFlowAgent; |
| | | } |
| | | }; |
| | | |
| | | const agentNames = ref([]); |
| | | const getAgentNames = async () => { |
| | | const res = await get_agent_names(); |
| | | agentNames.value = res.agents ?? []; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | if (!queryId.value) return; |
| | | handleGetJSON(queryId.value); |
| | | getFlowAgent(); |
| | | getAgentNames(); |
| | | }); |
| | | </script> |