diff --git a/docs/gns3-copilot/llm-model-configs-api.md b/docs/gns3-copilot/llm-model-configs-api.md index 30adb03fc..3f4bb7db5 100644 --- a/docs/gns3-copilot/llm-model-configs-api.md +++ b/docs/gns3-copilot/llm-model-configs-api.md @@ -235,6 +235,7 @@ curl -X POST http://localhost:3080/v3/access/users/{user_id}/llm-model-configs \ "context_limit": 128, "context_strategy": "balanced", "api_key": "sk-xxx", + "copilot_mode": "teaching", "is_default": true }' ``` @@ -284,6 +285,7 @@ curl -X POST http://localhost:3080/v3/access/groups/{group_id}/llm-model-configs "context_limit": 200, "context_strategy": "balanced", "api_key": "sk-ant-xxx", + "copilot_mode": "lab_assistant", "is_default": true }' ``` @@ -535,7 +537,8 @@ curl -X GET http://localhost:3080/v3/access/users/{user_id}/llm-model-configs/de "temperature": 0.7, "context_limit": 128, "context_strategy": "balanced", - "api_key": "sk-xxx" + "api_key": "sk-xxx", + "copilot_mode": null }, "user_id": "uuid-user", "group_id": null, diff --git a/gns3server/agent/gns3_copilot/prompts/prompt_loader.py b/gns3server/agent/gns3_copilot/prompts/prompt_loader.py index 955eb3323..f93761c55 100644 --- a/gns3server/agent/gns3_copilot/prompts/prompt_loader.py +++ b/gns3server/agent/gns3_copilot/prompts/prompt_loader.py @@ -51,7 +51,7 @@ def load_system_prompt(llm_config: dict | None = None) -> str: - "lab_assistant": Full lab assistant mode - diagnostics and configuration enabled Args: - llm_config: LLM model configuration dictionary containing the config field + llm_config: LLM model configuration dictionary (flattened structure from get_user_llm_config_full) Returns: str: The system prompt string. @@ -60,8 +60,9 @@ def load_system_prompt(llm_config: dict | None = None) -> str: logger.info("No LLM config provided, using default TEACHING assistant prompt mode") return SYSTEM_PROMPT - config = llm_config.get("config", {}) - mode = config.get("copilot_mode", "teaching").lower() + # llm_config is a flattened dict with copilot_mode at the top level + # Example: {"provider": "...", "model": "...", "copilot_mode": "...", ...} + mode = llm_config.get("copilot_mode", "teaching").lower() if mode == "lab_assistant": logger.info("Using LAB_ASSISTANT prompt mode (diagnostics + configuration)")