日志审核提交

This commit is contained in:
zyp
2026-11-06 10:59:24 +08:00
parent 86b8a2f687
commit 04a8364ede
11 changed files with 681 additions and 28 deletions
+10 -2
View File
@@ -13,6 +13,7 @@ from app.modules.work_assistant.review_failure import review_failure
from app.modules.work_assistant.review_commentary import review_commentary
logger = logging.getLogger(__name__)
RULE_VERSION = "goal-review-v7"
class GoalReviewRequest(BaseModel):
@@ -24,7 +25,7 @@ class GoalReviewRequest(BaseModel):
sources: list[Source] = Field(max_length=100)
limitations: list[str] = Field(default_factory=list, max_length=30)
as_of: date = Field(default_factory=lambda: datetime.now(ZoneInfo("Asia/Shanghai")).date())
review_version: str = "goal-review-v5"
review_version: str = RULE_VERSION
class GoalSuggestion(BaseModel):
@@ -193,6 +194,13 @@ def review_goal(payload: GoalReviewRequest, *, invoke=None) -> dict:
requirements = review_requirements(goal, list(children.values()), payload.sources,
invoke=invoke or complete_json, timeout_seconds=max(0, 65 - (time.monotonic() - started)))
findings.extend(requirements.pop("findings"))
if model_ok and children and not payload.limitations:
for step in workflow:
if step["basis"] == "explicit" and step["coverage"] == "uncovered":
findings.append(dict(dimension="目标分工", severity="problem", origin="model",
title=f"尚未安排:{step['name']}", detail=step["reason"],
suggestion=step["suggestion"] or f"明确哪项下级工作负责{step['name']}。",
source_id=goal_source.id, quote=step["goal_quote"]))
schedule = assess_schedule(SimpleNamespace(parent=goal,siblings=list(children.values()),as_of=payload.as_of,
limitations=payload.limitations),workflow,None,goal_mode=True)
if issues:
@@ -213,5 +221,5 @@ def review_goal(payload: GoalReviewRequest, *, invoke=None) -> dict:
return dict(status=status,summary=commentary.get("assessment", "本次具体评价未完成。") if commentary else "本次分析未完成。",review_kind="goal",goal_name=goal.name,
goal_suggestions=suggestions,child_issues=issues,findings=findings,alignment=None,workflow=workflow,
schedule=schedule,limitations=limitations,model_completed=model_ok,analysis_error=analysis_error,
requirements=requirements,commentary=commentary,subject_name=goal.name,rule_version="goal-review-v5",
requirements=requirements,commentary=commentary,subject_name=goal.name,rule_version=RULE_VERSION,
sources=[s.model_dump(mode="json") for s in payload.sources])