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

@@ -4,6 +4,11 @@
## 2026-04-06
### 主 Agent 高注意图动作统一切到直执行入口
- `create_assistant / import_homepage / track_account / generate_copy / ai_video / real_cut` 这批高频意图动作现在统一注册成 `direct-*`,不再回退到旧的 `open-*` 表单入口。
- 这样主 Agent 结果卡、动作注册表和工作台高频按钮现在共用同一套直执行链,后续回跳与结果落点也更一致。
### 依赖健康卡开始显示服务部署位置
- `collector``/v2/integrations/health` 现在会统一带出 `deployment_scope / deployment_label`,明确说明依赖当前跑在 `服务器 / NAS / Windows / NAS 隧道 / 未启用` 哪一侧。

View File

@@ -204,14 +204,14 @@ class AgentRunRetryRequest(BaseModel):
INTENT_ACTIONS: dict[str, list[dict[str, Any]]] = {
"create_project": [{"key": "goto-intake", "label": "去我的项目", "kind": "navigate"}],
"create_assistant": [{"key": "open-create-assistant", "label": "创建 Agent", "kind": "ui_action"}],
"import_homepage": [{"key": "open-import-homepage", "label": "导入主页", "kind": "ui_action"}],
"track_account": [{"key": "open-track-selected-account", "label": "跟踪当前账号", "kind": "ui_action"}],
"create_assistant": [{"key": "direct-create-assistant", "label": "创建 Agent", "kind": "ui_action"}],
"import_homepage": [{"key": "direct-import-selected-account", "label": "导入主页", "kind": "ui_action"}],
"track_account": [{"key": "direct-track-selected-account", "label": "跟踪当前账号", "kind": "ui_action"}],
"analyze_account": [{"key": "analyze-selected-account", "label": "分析当前账号", "kind": "ui_action"}],
"analyze_top_videos": [{"key": "analyze-top-videos", "label": "分析高分作品", "kind": "ui_action"}],
"generate_copy": [{"key": "open-generate-copy", "label": "生成文案", "kind": "ui_action"}],
"ai_video": [{"key": "open-ai-video", "label": "做 AI 视频", "kind": "ui_action"}],
"real_cut": [{"key": "open-real-cut", "label": "做实拍剪辑", "kind": "ui_action"}],
"generate_copy": [{"key": "direct-generate-copy", "label": "生成文案", "kind": "ui_action"}],
"ai_video": [{"key": "direct-create-ai-video", "label": "做 AI 视频", "kind": "ui_action"}],
"real_cut": [{"key": "direct-create-real-cut", "label": "做实拍剪辑", "kind": "ui_action"}],
"review": [{"key": "goto-review", "label": "去发布与复盘", "kind": "navigate"}],
"live_recorder": [{"key": "open-live-recorder", "label": "打开录制控制", "kind": "ui_action"}],
"storage_status": [{"key": "goto-production", "label": "查看生产与存储", "kind": "navigate"}],

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")