This commit is contained in:
@@ -648,11 +648,12 @@ class ElephantAlphaAutonomousEngine:
|
||||
self._log.warning("Escalating to human: %s", trigger.trigger_type)
|
||||
session = get_session()
|
||||
try:
|
||||
session.execute(
|
||||
row = session.execute(
|
||||
text("""
|
||||
INSERT INTO ai_insights
|
||||
(insight_type, content, confidence, created_by, status, metadata_json)
|
||||
VALUES (:type, :content, :conf, :by, :status, :meta)
|
||||
RETURNING id
|
||||
"""),
|
||||
{
|
||||
"type": "human_review",
|
||||
@@ -669,8 +670,18 @@ class ElephantAlphaAutonomousEngine:
|
||||
"reason": "low_confidence"
|
||||
}),
|
||||
},
|
||||
)
|
||||
).fetchone()
|
||||
session.commit()
|
||||
if row:
|
||||
try:
|
||||
from services.openclaw_learning_service import enqueue_insight_embedding
|
||||
enqueue_insight_embedding(
|
||||
row[0],
|
||||
"human_review",
|
||||
f"[Elephant Alpha 升級審核] {trigger.trigger_type} 信心度僅 {decision.confidence:.2f}",
|
||||
)
|
||||
except Exception as embed_err:
|
||||
self._log.warning("Embedding enqueue failed for human_review: %s", embed_err)
|
||||
except Exception as e:
|
||||
self._log.error("DB escalation write failed: %s", e)
|
||||
session.rollback()
|
||||
|
||||
Reference in New Issue
Block a user