|
|
@@ -194,6 +194,10 @@ const handleApiResult = (response: any, successMessage?: string, errorMessage?:
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
+ if (response?.code === 0 && response?.error) {
|
|
|
+ ElMessage.error(response.error)
|
|
|
+ return false
|
|
|
+ }
|
|
|
if (errorMessage) {
|
|
|
ElMessage.error(errorMessage)
|
|
|
}
|
|
|
@@ -454,6 +458,7 @@ const handleRunSelectedNode = async () => {
|
|
|
appAgentId: workflow.value.id,
|
|
|
start_node_id: nodeID.value,
|
|
|
is_debugger: true,
|
|
|
+ responseType: 'ws',
|
|
|
params: {}
|
|
|
})
|
|
|
const agentRunnerKey = response?.result
|
|
|
@@ -461,7 +466,7 @@ const handleRunSelectedNode = async () => {
|
|
|
runnerStore.startRunner(agentRunnerKey)
|
|
|
}
|
|
|
runVisible.value = false
|
|
|
- handleApiResult(response, '已提交节点测试', '节点测试失败')
|
|
|
+ // handleApiResult(response, '已提交节点测试', '节点测试失败')
|
|
|
} catch (error) {
|
|
|
console.error('postDoTestNodeRunner error', error)
|
|
|
ElMessage.error('节点测试失败')
|
|
|
@@ -479,13 +484,14 @@ const handleRunNode = async (id: string) => {
|
|
|
appAgentId: workflow.value.id,
|
|
|
start_node_id: id,
|
|
|
is_debugger: true,
|
|
|
+ responseType: 'ws',
|
|
|
params: {}
|
|
|
})
|
|
|
const agentRunnerKey = response?.result
|
|
|
if (agentRunnerKey) {
|
|
|
runnerStore.startRunner(agentRunnerKey)
|
|
|
}
|
|
|
- handleApiResult(response, '已提交运行节点', '运行节点失败')
|
|
|
+ // handleApiResult(response, '已提交运行节点', '运行节点失败')
|
|
|
} catch (error) {
|
|
|
console.error('postDoTestNodeRunner error', error)
|
|
|
ElMessage.error('运行节点失败')
|
|
|
@@ -638,7 +644,7 @@ const onCreateConnection = async (connection: Connection) => {
|
|
|
if (!workflow.value?.edges.some((edge) => edge.source === source && edge.target === target)) {
|
|
|
const response = await agent.postAgentDoNewEdge(params)
|
|
|
|
|
|
- if (handleApiResult(response, '节点已添加', '新增节点失败')) {
|
|
|
+ if (handleApiResult(response, '连线已创建', '连线创建失败')) {
|
|
|
await loadAgentWorkflow(workflow.value.id)
|
|
|
}
|
|
|
}
|
|
|
@@ -750,10 +756,16 @@ const handleUpdateNodeProps = (id: string, attrs: Record<string, unknown>) => {
|
|
|
const handleDeleteNode = async (id: string) => {
|
|
|
const index = workflow.value.nodes.findIndex((node) => node.id === id)
|
|
|
if (index != -1) {
|
|
|
- await agent.postAgentDoDeleteAgentNode({
|
|
|
- id: id
|
|
|
+ ElMessageBox.confirm('确定要删除吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ await agent.postAgentDoDeleteAgentNode({
|
|
|
+ id: id
|
|
|
+ })
|
|
|
+ await loadAgentWorkflow(workflow.value.id)
|
|
|
})
|
|
|
- await loadAgentWorkflow(workflow.value.id)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -762,10 +774,16 @@ const handleDeleteNode = async (id: string) => {
|
|
|
*/
|
|
|
const handleDeleteEdge = async (connection: Connection) => {
|
|
|
if (connection.id) {
|
|
|
- await agent.postAgentDoDeleteEdge({
|
|
|
- id: connection.id
|
|
|
+ ElMessageBox.confirm('确定要删除吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ await agent.postAgentDoDeleteEdge({
|
|
|
+ id: connection.id
|
|
|
+ })
|
|
|
+ await loadAgentWorkflow(workflow.value.id)
|
|
|
})
|
|
|
- await loadAgentWorkflow(workflow.value.id)
|
|
|
}
|
|
|
}
|
|
|
|