فهرست منبع

feat(web-v3): /config/walk-policy 只读端点(edge_permissions+edge_budgets 暴露给前端)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sam Lee 1 روز پیش
والد
کامیت
36f40156e8
2فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 7 0
      content_agent/api.py
  2. 5 0
      tests/test_api.py

+ 7 - 0
content_agent/api.py

@@ -122,6 +122,7 @@ _CONFIG_FILES = {
     "rule-packs": "product_documents/规则包/douyin_rule_packs.v1.json",
     "walk-strategy": "product_documents/抖音游走策略/douyin_walk_strategy.v1.json",
     "query-prompts": "product_documents/配置/query_prompts.v1.json",
+    "walk-policy": "tech_documents/数据接口与来源/walk_policy.json",
 }
 
 
@@ -154,6 +155,12 @@ def get_config_query_prompts() -> ConfigFileResponse:
     return _config_file_response("query-prompts")
 
 
+@app.get("/config/walk-policy", response_model=ConfigFileResponse)
+def get_config_walk_policy() -> ConfigFileResponse:
+    # 返回原始 JSON 不解包 {value,provenance,tbd}:展示层保留拍板留痕,解包由前端做。
+    return _config_file_response("walk-policy")
+
+
 @app.get("/runs/{run_id}/dashboard", response_model=DashboardResponse)
 def get_run_dashboard(run_id: str) -> DashboardResponse:
     _ensure_web_run_exists(run_id)

+ 5 - 0
tests/test_api.py

@@ -246,6 +246,11 @@ def test_api_config_readonly_endpoints():
     prompts = client.get("/config/query-prompts").json()
     assert "douyin/V1" in prompts["data"]["profiles"]
 
+    policy = client.get("/config/walk-policy").json()
+    assert policy["source_file"].endswith("walk_policy.json")
+    assert "edge_permissions" in policy["data"]
+    assert "edge_budgets" in policy["data"]
+
 
 def test_api_dashboard_rule_summary_effect_status_not_none(tmp_path, monkeypatch):
     monkeypatch.setattr(