mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-04 17:15:18 +03:00
## Summary Add a complete fault injection system for GNS3 Copilot, migrate all skills from local Python files to an external Git repository with hot reload support, and restructure Copilot API under /copilot/. ## Key Changes ### Fault Injection - New troubleshooting_injection mode with InjectionSkillsTool - 368 fault scenarios across 39 protocol categories - Context-based filtering (LLM must pass topology protocols) ### External Skills Repository - SkillsManager: Git clone/pull, version tracking, smart updates - SkillsLoader: YAML skills + Markdown prompts from external repo - Hot reload via POST /copilot/reload/skills - Configurable via gns3_server.conf ### Architecture - API unified under /copilot/ prefix - SkillsManager moved from Controller to agent module - Lazy initialization with startup background preload - Per-command Git timeout, smart update checks - Forbidden commands hot-reloadable from external repo - 32 INFO logs downgraded to DEBUG
87 lines
2.4 KiB
Python
87 lines
2.4 KiB
Python
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
#
|
|
# GNS3-Copilot - AI-powered Network Lab Assistant for GNS3
|
|
#
|
|
# This file is part of GNS3-Copilot project.
|
|
#
|
|
# GNS3-Copilot is free software: you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by the
|
|
# Free Software Foundation, either version 3 of the License, or (at your
|
|
# option) any later version.
|
|
#
|
|
# GNS3-Copilot is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with GNS3-Copilot. If not, see <https://www.gnu.org/licenses/>.
|
|
#
|
|
# Copyright (C) 2025 Yue Guobin
|
|
# Author: Yue Guobin
|
|
#
|
|
# Project Home: https://github.com/yueguobin/gns3-copilot
|
|
#
|
|
|
|
"""
|
|
Skills Configuration
|
|
|
|
This module contains configuration for the external skills repository.
|
|
"""
|
|
|
|
from gns3server.config import Config
|
|
|
|
# Default skills repository configuration
|
|
SKILLS_CONFIG = {
|
|
# Git repository URL for skills
|
|
"repo_url": "https://github.com/yueguobin/GNS3-Skills.git",
|
|
|
|
# Git branch to use
|
|
"branch": "main",
|
|
|
|
# Automatically pull updates on reload
|
|
"auto_update": True,
|
|
|
|
# Enable external skills loading
|
|
# If False, use the built-in hardcoded skills
|
|
"enabled": True,
|
|
}
|
|
|
|
|
|
def get_skills_config() -> dict:
|
|
"""
|
|
Get the skills configuration.
|
|
|
|
Priority:
|
|
1. GNS3 server config (gns3_server.conf → [Server] → skills_*)
|
|
2. Hardcoded defaults
|
|
|
|
Returns:
|
|
Dictionary containing skills configuration
|
|
"""
|
|
config = SKILLS_CONFIG.copy()
|
|
try:
|
|
server = Config.instance().settings.Server
|
|
if server.skills_repo_url:
|
|
config["repo_url"] = server.skills_repo_url
|
|
if server.skills_repo_branch:
|
|
config["branch"] = server.skills_repo_branch
|
|
config["auto_update"] = server.skills_auto_update
|
|
except Exception:
|
|
pass
|
|
return config
|
|
|
|
|
|
def update_skills_config(**kwargs):
|
|
"""
|
|
Update skills configuration.
|
|
|
|
Args:
|
|
**kwargs: Configuration key-value pairs to update
|
|
"""
|
|
for key, value in kwargs.items():
|
|
if key in SKILLS_CONFIG:
|
|
SKILLS_CONFIG[key] = value
|
|
else:
|
|
raise ValueError(f"Unknown configuration key: {key}")
|