消除一些语法错误提示
This commit is contained in:
parent
7081409471
commit
bc413e5f0a
@ -95,17 +95,13 @@ const handleSave = async () => {
|
||||
// 保存到智能体
|
||||
const prettyJson = JSON.stringify(flowData, null, 2)
|
||||
await agentStore.updateAgent(agentId.value, { agent_flow: prettyJson })
|
||||
message.success('智能体流程保存成功')
|
||||
message.success('流程保存成功')
|
||||
} else {
|
||||
// 作为独立流程保存
|
||||
emit('save', flowData)
|
||||
message.success('流程保存成功')
|
||||
}
|
||||
|
||||
// 清理flow builder状态
|
||||
flowBuilderStore.deactivateFlowBuilder()
|
||||
|
||||
router.back()
|
||||
} catch (error: any) {
|
||||
message.error('保存失败: ' + (error.message || '保存过程中发生错误'))
|
||||
}
|
||||
|
||||
@ -147,12 +147,12 @@ export const updateAgentApi = async (name: string, data: Partial<AIAgent>): Prom
|
||||
throw new Error(errorMsg)
|
||||
}
|
||||
|
||||
// 返回更新后的数据
|
||||
if (!message?.success || !message?.data) {
|
||||
// 检查更新是否成功
|
||||
if (!message?.success) {
|
||||
throw new Error(message?.message || '更新失败')
|
||||
}
|
||||
|
||||
return message.data
|
||||
return message
|
||||
} catch (error: any) {
|
||||
console.error("Error in updateAgentApi:", error)
|
||||
throw new Error(error.response?.data?.message || error.message || '更新AI Agent失败')
|
||||
|
||||
@ -78,17 +78,17 @@ export const useAgentStore = defineStore('agent', () => {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
const updatedAgent = await updateAgentApi(name, data)
|
||||
// 更新当前agent
|
||||
await updateAgentApi(name, data)
|
||||
// 更新成功后,手动更新本地状态
|
||||
if (currentAgent.value && currentAgent.value.name === name) {
|
||||
currentAgent.value = { ...currentAgent.value, ...updatedAgent }
|
||||
currentAgent.value = { ...currentAgent.value, ...data }
|
||||
}
|
||||
// 更新列表中的agent
|
||||
const index = agents.value.findIndex(agent => agent.name === name)
|
||||
if (index !== -1) {
|
||||
agents.value[index] = { ...agents.value[index], ...updatedAgent }
|
||||
agents.value[index] = { ...agents.value[index], ...data }
|
||||
}
|
||||
return updatedAgent
|
||||
return { success: true }
|
||||
} catch (err: any) {
|
||||
error.value = err.message || '更新AI Agent失败'
|
||||
console.error('更新AI Agent失败:', err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user