ЮИ - Упростить карточки автопрогонов до названия даты id режима и типа
This commit is contained in:
@@ -41,7 +41,7 @@ def sanitize_question(value: Any) -> str:
|
||||
def ensure_agent_title(title: str) -> str:
|
||||
normalized = title.strip()
|
||||
if not normalized:
|
||||
raise RuntimeError("Agent semantic run title must not be empty")
|
||||
raise RuntimeError("Agent semantic run title must not be empty")
|
||||
return normalized if normalized.upper().startswith("AGENT") else f"AGENT | {normalized}"
|
||||
|
||||
|
||||
@@ -66,6 +66,24 @@ def normalize_questions(raw_questions: list[Any]) -> list[str]:
|
||||
return result
|
||||
|
||||
|
||||
def extract_semantic_tags(spec: dict[str, Any]) -> list[str]:
|
||||
steps = spec.get("steps")
|
||||
if not isinstance(steps, list):
|
||||
return []
|
||||
tags: set[str] = set()
|
||||
for step in steps:
|
||||
if not isinstance(step, dict):
|
||||
continue
|
||||
raw_tags = step.get("semantic_tags")
|
||||
if not isinstance(raw_tags, list):
|
||||
continue
|
||||
for raw_tag in raw_tags:
|
||||
tag = str(raw_tag or "").strip()
|
||||
if tag:
|
||||
tags.add(tag)
|
||||
return sorted(tags)
|
||||
|
||||
|
||||
def extract_questions_from_spec(spec: dict[str, Any]) -> list[str]:
|
||||
if isinstance(spec.get("questions"), list):
|
||||
return normalize_questions(list(spec["questions"]))
|
||||
@@ -183,6 +201,8 @@ def build_history_record(
|
||||
"agent_focus": metadata.get("agent_focus"),
|
||||
"architecture_phase": metadata.get("architecture_phase"),
|
||||
"source_spec_file": metadata.get("source_spec_file"),
|
||||
"scenario_id": metadata.get("scenario_id"),
|
||||
"semantic_tags": metadata.get("semantic_tags"),
|
||||
}
|
||||
return {
|
||||
"generation_id": generation_id,
|
||||
@@ -199,6 +219,7 @@ def build_history_record(
|
||||
|
||||
|
||||
def build_metadata(args: argparse.Namespace, spec: dict[str, Any], spec_path: Path | None) -> dict[str, Any]:
|
||||
semantic_tags = extract_semantic_tags(spec)
|
||||
return {
|
||||
"assistant_prompt_version": args.assistant_prompt_version,
|
||||
"decomposition_prompt_version": args.decomposition_prompt_version,
|
||||
@@ -206,6 +227,8 @@ def build_metadata(args: argparse.Namespace, spec: dict[str, Any], spec_path: Pa
|
||||
"agent_focus": args.agent_focus or spec.get("description") or spec.get("title"),
|
||||
"architecture_phase": args.architecture_phase,
|
||||
"source_spec_file": str(spec_path.resolve()) if spec_path else None,
|
||||
"scenario_id": str(spec.get("scenario_id") or "").strip() or None,
|
||||
"semantic_tags": semantic_tags,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user