fix: test
This commit is contained in:
@@ -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", "")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user