diff --git a/astrbot/core/astr_main_agent.py b/astrbot/core/astr_main_agent.py index 0f51a29c0..f18b49a43 100644 --- a/astrbot/core/astr_main_agent.py +++ b/astrbot/core/astr_main_agent.py @@ -846,6 +846,8 @@ def _apply_sandbox_tools( ) -> None: if req.func_tool is None: req.func_tool = ToolSet() + if req.system_prompt is None: + req.system_prompt = "" booter = config.sandbox_cfg.get("booter", "shipyard_neo") if booter == "shipyard": ep = config.sandbox_cfg.get("shipyard_endpoint", "") diff --git a/astrbot/core/computer/computer_client.py b/astrbot/core/computer/computer_client.py index 1853abf75..aa10d125e 100644 --- a/astrbot/core/computer/computer_client.py +++ b/astrbot/core/computer/computer_client.py @@ -1,4 +1,5 @@ import json +import os import shutil import uuid from pathlib import Path @@ -41,8 +42,6 @@ def _discover_bay_credentials(endpoint: str) -> str: Returns: API key string, or empty string if not found. """ - import os - candidates: list[Path] = [] # 1. BAY_DATA_DIR env var diff --git a/tests/unit/test_astr_main_agent.py b/tests/unit/test_astr_main_agent.py index 3ce974f41..e0682ae06 100644 --- a/tests/unit/test_astr_main_agent.py +++ b/tests/unit/test_astr_main_agent.py @@ -516,30 +516,6 @@ class TestEnsurePersonaAndSkills: assert "Persona Instructions" not in req.system_prompt - @pytest.mark.asyncio - async def test_ensure_skills(self, mock_event, mock_context): - """Test applying skills to request.""" - module = ama - mock_skill = MagicMock() - mock_skill.name = "test_skill" - mock_skill.to_prompt.return_value = "Skill description" - mock_context.persona_manager.personas_v3 = [] - mock_context.persona_manager.resolve_selected_persona = AsyncMock( - return_value=(None, None, None, False) - ) - - with patch("astrbot.core.astr_main_agent.SkillManager") as mock_skill_mgr_cls: - mock_skill_mgr = MagicMock() - mock_skill_mgr.list_skills.return_value = [mock_skill] - mock_skill_mgr_cls.return_value = mock_skill_mgr - - req = ProviderRequest() - req.conversation = MagicMock(persona_id=None) - - await module._ensure_persona_and_skills(req, {}, mock_context, mock_event) - - assert "test_skill" in req.system_prompt - @pytest.mark.asyncio async def test_ensure_tools_from_persona(self, mock_event, mock_context): """Test applying tools from persona."""