|
|
@@ -12,6 +12,7 @@ from content_agent.dashboard_service import DashboardService
|
|
|
from content_agent.errors import ErrorCode, error_response, sanitize_error_detail
|
|
|
from content_agent.run_service import RunService
|
|
|
from content_agent.schemas import (
|
|
|
+ ConfigFileResponse,
|
|
|
ContentItemsResponse,
|
|
|
DashboardResponse,
|
|
|
JsonFileResponse,
|
|
|
@@ -117,6 +118,42 @@ def get_run(run_id: str) -> RunSummaryResponse:
|
|
|
return RunSummaryResponse(**service.get_summary(run_id))
|
|
|
|
|
|
|
|
|
+_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",
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+def _config_file_response(key: str) -> ConfigFileResponse:
|
|
|
+ from pathlib import Path
|
|
|
+
|
|
|
+ from content_agent.integrations import config_store
|
|
|
+
|
|
|
+ path = Path(_CONFIG_FILES[key])
|
|
|
+ if not path.exists():
|
|
|
+ raise HTTPException(status_code=404, detail=error_response(
|
|
|
+ ErrorCode.RUN_NOT_FOUND, f"config file missing: {key}", {"source_file": str(path)}
|
|
|
+ ))
|
|
|
+ data, _ = config_store.load_json(path)
|
|
|
+ return ConfigFileResponse(source_file=str(path), data=data)
|
|
|
+
|
|
|
+
|
|
|
+@app.get("/config/rule-packs", response_model=ConfigFileResponse)
|
|
|
+def get_config_rule_packs() -> ConfigFileResponse:
|
|
|
+ return _config_file_response("rule-packs")
|
|
|
+
|
|
|
+
|
|
|
+@app.get("/config/walk-strategy", response_model=ConfigFileResponse)
|
|
|
+def get_config_walk_strategy() -> ConfigFileResponse:
|
|
|
+ return _config_file_response("walk-strategy")
|
|
|
+
|
|
|
+
|
|
|
+@app.get("/config/query-prompts", response_model=ConfigFileResponse)
|
|
|
+def get_config_query_prompts() -> ConfigFileResponse:
|
|
|
+ return _config_file_response("query-prompts")
|
|
|
+
|
|
|
+
|
|
|
@app.get("/runs/{run_id}/dashboard", response_model=DashboardResponse)
|
|
|
def get_run_dashboard(run_id: str) -> DashboardResponse:
|
|
|
_ensure_web_run_exists(run_id)
|