fix: Reload AGENTS dict when agent is deleted

- Add global AGENTS reload after agent deletion
- Ensures agent immediately disappears from all dropdowns/UIs
- Matches agent creation behavior (which already reloads)
- Fixes issue where deleted agents still appeared in chat/task forms
This commit is contained in:
pdyde 2026-02-21 17:42:54 +01:00
parent e2a853ffde
commit 4c03663418

5
app.py
View file

@ -3137,6 +3137,11 @@ def delete_agent(agent_name):
with open(AGENT_CONFIG_FILE, 'w', encoding='utf-8') as f: with open(AGENT_CONFIG_FILE, 'w', encoding='utf-8') as f:
json.dump(config, f, indent=2) json.dump(config, f, indent=2)
# AGENTS Dictionary neu laden
global AGENTS
AGENTS = load_agents_from_directories()
logger.info(f"[AgentDelete] Agent gelöscht: {agent_name}")
return jsonify({'success': True, 'message': f'Agent "{agent_name}" wurde gelöscht.'}) return jsonify({'success': True, 'message': f'Agent "{agent_name}" wurde gelöscht.'})
except Exception as e: except Exception as e:
return jsonify({'error': str(e)}), 500 return jsonify({'error': str(e)}), 500