feat: align main agent intents with direct execution
Some checks failed
StoryForge CI / Baseline checks (push) Has been cancelled
StoryForge CI / Backend tests (push) Has been cancelled
StoryForge CI / Web tests (push) Has been cancelled

This commit is contained in:
kris
2026-04-06 13:51:39 +08:00
parent 27801107b5
commit f276d6e7fb
3 changed files with 29 additions and 7 deletions

View File

@@ -34,6 +34,7 @@ class MainAgentGovernanceTests(unittest.TestCase):
os.environ.setdefault("BOOTSTRAP_SUPERADMIN_PASSWORD", "")
cls.db_module = importlib.reload(importlib.import_module("app.database"))
cls.oneliner = importlib.reload(importlib.import_module("app.oneliner_features"))
cls.core = importlib.reload(importlib.import_module("app.core_main"))
cls.app_main = importlib.reload(importlib.import_module("app.main"))
cls.core.db.init_schema()
@@ -948,6 +949,22 @@ class MainAgentGovernanceTests(unittest.TestCase):
self.assertIn("categories", usage_payload)
self.assertIn("storage_bytes", usage_payload)
def test_high_frequency_intent_actions_prefer_direct_execute_entrypoints(self) -> None:
expected_actions = {
"create_assistant": "direct-create-assistant",
"import_homepage": "direct-import-selected-account",
"track_account": "direct-track-selected-account",
"generate_copy": "direct-generate-copy",
"ai_video": "direct-create-ai-video",
"real_cut": "direct-create-real-cut",
}
for intent_key, expected_action_key in expected_actions.items():
with self.subTest(intent_key=intent_key):
actions = self.oneliner.INTENT_ACTIONS[intent_key]
self.assertTrue(actions)
self.assertEqual(actions[0]["key"], expected_action_key)
self.assertEqual(actions[0]["kind"], "ui_action")
def test_direct_oneliner_actions_return_structured_followup_targets(self) -> None:
self._insert_completed_job(job_id="job_review_source", title="Review Source Job")
self._insert_assistant()
@@ -2230,7 +2247,7 @@ class MainAgentGovernanceTests(unittest.TestCase):
self.assertEqual(message_response.status_code, 200, message_response.text)
payload = message_response.json()
execution_card = (((payload.get("assistant_message") or {}).get("result")) or {}).get("execution_card") or {}
self.assertEqual((execution_card.get("primary_action") or {}).get("key"), "open-create-assistant")
self.assertEqual((execution_card.get("primary_action") or {}).get("key"), "direct-create-assistant")
self.assertEqual((execution_card.get("oneliner_profile_version") or {}).get("version_id"), current_profile_version["id"])
self.assertEqual((execution_card.get("oneliner_profile_version") or {}).get("version_no"), current_profile_version["version_no"])
self.assertEqual((execution_card.get("platform_agent_profile") or {}).get("platform"), "douyin")