Normalize data agent records output path
This commit is contained in:
@@ -571,16 +571,48 @@ target: Agent(tag="life_service")
|
||||
export_result = execute_tool(
|
||||
registry,
|
||||
'data_agent_export_dataset_records',
|
||||
{'records': records, 'output_path': 'output/demo/records.jsonl'},
|
||||
{'records': records, 'output_path': 'output/地图和生活边界数据/自定义名字.jsonl'},
|
||||
context,
|
||||
)
|
||||
self.assertTrue(export_result.ok, export_result.content)
|
||||
export_payload = json.loads(export_result.content)
|
||||
|
||||
expected = '.port_sessions/accounts/alice/sessions/s1/output/demo/records.jsonl'
|
||||
expected = '.port_sessions/accounts/alice/sessions/s1/output/records.jsonl'
|
||||
self.assertEqual(plan_payload['plan']['output_path'], expected)
|
||||
self.assertEqual(export_payload['output_path'], expected)
|
||||
|
||||
def test_data_agent_session_records_path_stays_stable_when_file_exists(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
root = Path(tmp_dir)
|
||||
scratchpad = root / '.port_sessions' / 'accounts' / 'alice' / 'sessions' / 's1' / 'scratchpad'
|
||||
output_root = scratchpad.parent / 'output'
|
||||
output_root.mkdir(parents=True)
|
||||
(output_root / 'records.jsonl').write_text('{}\n', encoding='utf-8')
|
||||
context = build_tool_context(AgentRuntimeConfig(cwd=root), scratchpad_directory=scratchpad)
|
||||
|
||||
plan_result = execute_tool(
|
||||
default_tool_registry(),
|
||||
'data_agent_prepare_generation_plan',
|
||||
{
|
||||
'direct_review': True,
|
||||
'dataset_label': '地图和生活边界数据',
|
||||
'target': 'Agent(tag="life_service")',
|
||||
'total_count': 1,
|
||||
'turn_mix': '1 条单轮',
|
||||
'coverage': '附近吃喝玩乐',
|
||||
'exclusions': '不要生成导航路线类 query',
|
||||
'output_path': 'output/任意子目录/任意名字.jsonl',
|
||||
},
|
||||
context,
|
||||
)
|
||||
self.assertTrue(plan_result.ok, plan_result.content)
|
||||
plan_payload = json.loads(plan_result.content)
|
||||
|
||||
self.assertEqual(
|
||||
plan_payload['plan']['output_path'],
|
||||
'.port_sessions/accounts/alice/sessions/s1/output/records.jsonl',
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user