fix: preserve exploration demonstration source and recording scope
This commit is contained in:
1 parent
f4cb55c030
commit
973ccae679
22 files changed
+624
-55
No files matched your search
@@ -800,6 +800,10 @@ async def test_exploration_review_sees_conversation_and_can_read_earlier_message
|
||||
):
|
||||
await run_final_check(ctx, goal="探索设置", plan_text="", ledger=[], check_items=[])
|
||||
assert conversation in review.call_args.args[1]
|
||||
assert any(
|
||||
"不能用手机上的成功证明电脑步骤完成" in str(message.content)
|
||||
for message in review.call_args.args[1]
|
||||
)
|
||||
assert history in review.call_args.args[2]
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
from artemis.agents.planner.planner import PlannerNode
|
||||
from artemis.context import DevicePlatform, ArtemisContext
|
||||
@@ -97,6 +98,36 @@ async def test_planner_initial_plan(mock_context):
|
||||
assert "Goal: Test Goal" in human_msg_content[0]["text"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("target", ["mixed", "computer"])
|
||||
async def test_planner_knows_computer_plugins_with_mobile_primary_screen(mock_context, target):
|
||||
state = DummyState(initial_goal="按人工示范浏览首页")
|
||||
mock_context.execution_target = target
|
||||
mock_context.plugins = SimpleNamespace(prompt=lambda: "电脑插件:cua-driver,可按需加载")
|
||||
controller = Mock()
|
||||
controller.take_screenshot = AsyncMock(return_value=_valid_screen_base64())
|
||||
controller.get_screen_data = AsyncMock(
|
||||
return_value=SimpleNamespace(observation_text="电脑窗口状态")
|
||||
)
|
||||
llm = Mock()
|
||||
|
||||
async def stream(*_args, **_kwargs):
|
||||
yield SimpleNamespace(content="- [ ] 浏览首页", tool_calls=[])
|
||||
|
||||
llm.astream.side_effect = stream
|
||||
llm.bind_tools.return_value = llm
|
||||
with (
|
||||
patch("artemis.agents.planner.planner.get_llm", return_value=llm),
|
||||
patch("artemis.agents.planner.planner.UnifiedMobileController", return_value=controller),
|
||||
):
|
||||
await PlannerNode(mock_context)(state)
|
||||
content = llm.astream.call_args.args[0][1].content
|
||||
text = "\n".join(part["text"] for part in content if part["type"] == "text")
|
||||
assert text.count("电脑插件:cua-driver") == 1
|
||||
assert f"当前主设备截图({'电脑' if target == 'computer' else '安卓'})" in text
|
||||
assert "不决定其他步骤的执行平台" in text
|
||||
|
||||
|
||||
def test_validate_plan_format_single_sourced_status_alphabet():
|
||||
"""Regression: the Planner's format gate is single-sourced from
|
||||
plan_grammar — a legal in-progress '[/]' line must never be rejected."""
|
||||
|
||||
Reference in new issue
Block a user