update
This commit is contained in:
@@ -251,11 +251,23 @@ def sales_followup_review(payload: SalesRequest) -> dict:
|
||||
def management_performance_review(payload: PerformanceRequest) -> dict:
|
||||
token = background_review.set(True)
|
||||
try:
|
||||
return review_jobs.run(payload.model_dump(), PERFORMANCE_RULE + ':' + routing_revision(),
|
||||
lambda checkpoint, save: review_performance(payload))
|
||||
# v5 Java allocates a new request_id after each failed slice. Keep its
|
||||
# checkpoint tied to the immutable business snapshot, not that UUID.
|
||||
key_payload = payload.model_dump(exclude={'request_id'}) if payload.review_protocol == 1 else payload.model_dump()
|
||||
result = review_jobs.run(key_payload, PERFORMANCE_RULE + ':' + routing_revision(),
|
||||
lambda checkpoint, save: review_performance(payload, checkpoint=checkpoint, save=save),
|
||||
continuous=True)
|
||||
return {**result, 'analysis_version': 'management-performance-v5' if payload.review_protocol == 1 else PERFORMANCE_RULE}
|
||||
except JobDeferred as exc:
|
||||
raise HTTPException(503, "绩效检查分批处理中,将从已保存进度继续",
|
||||
headers={"X-Review-State": "review_continuation"}) from exc
|
||||
except ModelUnavailable as exc:
|
||||
reason = exc.reason if exc.reason in {'review_suspended', 'review_in_progress', 'review_backoff',
|
||||
'circuit_open', 'queue_full', 'queue_timeout'} else 'model_timeout' if 'timeout' in exc.reason else 'model_unavailable'
|
||||
'circuit_open', 'queue_full', 'queue_timeout', 'review_continuation', 'performance_context_limit'} else (
|
||||
'performance_context_limit' if exc.reason in {'model_context_full', 'context_capacity'} else
|
||||
'model_request_rejected' if exc.reason in {'direct_http_400', 'direct_http_413', 'direct_http_422',
|
||||
'gateway_http_400', 'gateway_http_413', 'gateway_http_422'} else
|
||||
'model_timeout' if 'timeout' in exc.reason else 'model_unavailable')
|
||||
logger.warning("management_performance_failed reason=%s", reason)
|
||||
raise HTTPException(503, "绩效智能检查暂未完成,请稍后重试", headers={"X-Review-State": reason}) from exc
|
||||
except ValueError as exc:
|
||||
@@ -307,7 +319,8 @@ def project_document_review(payload: ProjectDocument) -> dict:
|
||||
@router.get("/review-capabilities")
|
||||
def review_capabilities() -> dict:
|
||||
from app.modules.work_assistant.personnel_talent import PANEL_REVISION, QUALITY_REVISION
|
||||
return {"bid_writing_rule": BID_RULE, "project_risk_rule": PROJECT_RISK_RULE, "document_rule": DOCUMENT_RULE, "performance_rule": PERFORMANCE_RULE, "sales_rule": SALES_RULE, "dispatch_version": 1,
|
||||
return {"bid_writing_rule": BID_RULE, "project_risk_rule": PROJECT_RISK_RULE, "document_rule": DOCUMENT_RULE,
|
||||
"performance_rule": "management-performance-v5", "performance_rule_v6": PERFORMANCE_RULE, "sales_rule": SALES_RULE, "dispatch_version": 1,
|
||||
"personnel_rule": PERSONNEL_POLICY, "personnel_job_protocol": PERSONNEL_JOB_PROTOCOL,
|
||||
"personnel_annual_assessment": ANNUAL_ASSESSMENT_VERSION,
|
||||
"personnel_talent_revision": PANEL_REVISION, "personnel_history_protocol": 2,
|
||||
|
||||
Reference in New Issue
Block a user