让免费层限流的报告跟真实限流一致,并给少一块结果的静默失败留下函数名和错误类型。

Co-Authored-By: Grok (agent loop)
This commit is contained in:
jesse-ux
2026-10-15 23:12:56 +08:00
co-authored by Grok (agent loop)
parent e4ff62c738
commit a7162db271
38 changed files with 706 additions and 129 deletions
+41
View File
@@ -0,0 +1,41 @@
"""One functional benefic/malefic snapshot for the engine, API, and MCP.
This module is not ``functional_benefics.py``. That file is part of the
rectification freeze and must stay byte-for-byte unchanged.
"""
from __future__ import annotations
from typing import Any
def functional_layer_for_ascendant(ascendant: Any) -> dict[str, Any]:
"""Return the functional layer for an ascendant payload.
A dict uses its ``sign``. Anything else is a missing sign and follows
the normal ``derive_functional_benefic_malefic`` blocked result.
Import or calculation failures return the engine's blocked shape.
The exception text stays inside ``effect_on_confidence`` because that
field already did; callers must not write this dict to a log.
"""
try:
try:
from functional_benefics import derive_functional_benefic_malefic
except ModuleNotFoundError:
from scripts.functional_benefics import derive_functional_benefic_malefic
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
return derive_functional_benefic_malefic(sign)
except Exception as exc:
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
return {
"status": "blocked",
"ascendant": sign,
"functional_benefics": [],
"functional_malefics": [],
"functional_neutrals": [],
"yogakarakas": [],
"owned_houses": {},
"effect_on_confidence": f"未完成功能性吉凶星判定,需降低高严谨结论置信度: {exc}",
"source": "strict_functional_benefic_malefic_v2",
}