增加删除节点和智能体的端点
This commit is contained in:
parent
8278c50c1e
commit
fb93143a17
@ -418,3 +418,49 @@ def get_my_local_agent_list(filters=None, order_by=None, limit_start=None, limit
|
|||||||
result.append(agent_data)
|
result.append(agent_data)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@dashboard_whitelist()
|
||||||
|
def delete_local_node(name):
|
||||||
|
"""删除本地节点"""
|
||||||
|
|
||||||
|
team = get_current_team()
|
||||||
|
if not team:
|
||||||
|
return {"success": False, "message": "未找到当前团队信息"}
|
||||||
|
|
||||||
|
if not jingrow.db.exists("Local Node", name):
|
||||||
|
return {"success": False, "message": "节点不存在"}
|
||||||
|
|
||||||
|
node = jingrow.get_pg("Local Node", name)
|
||||||
|
|
||||||
|
# 验证权限:只能删除自己团队的节点
|
||||||
|
if node.team != team:
|
||||||
|
return {"success": False, "message": "您没有权限操作此节点"}
|
||||||
|
|
||||||
|
# 使用 ignore_permissions=True 因为我们已经手动验证了团队权限
|
||||||
|
node.delete(ignore_permissions=True)
|
||||||
|
|
||||||
|
return {"success": True, "message": "节点删除成功"}
|
||||||
|
|
||||||
|
|
||||||
|
@dashboard_whitelist()
|
||||||
|
def delete_local_agent(name):
|
||||||
|
"""删除本地Agent"""
|
||||||
|
|
||||||
|
team = get_current_team()
|
||||||
|
if not team:
|
||||||
|
return {"success": False, "message": "未找到当前团队信息"}
|
||||||
|
|
||||||
|
if not jingrow.db.exists("Local Agent", name):
|
||||||
|
return {"success": False, "message": "Agent不存在"}
|
||||||
|
|
||||||
|
agent = jingrow.get_pg("Local Agent", name)
|
||||||
|
|
||||||
|
# 验证权限:只能删除自己团队的Agent
|
||||||
|
if agent.team != team:
|
||||||
|
return {"success": False, "message": "您没有权限操作此Agent"}
|
||||||
|
|
||||||
|
# 使用 ignore_permissions=True 因为我们已经手动验证了团队权限
|
||||||
|
agent.delete(ignore_permissions=True)
|
||||||
|
|
||||||
|
return {"success": True, "message": "Agent删除成功"}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user