串接 AI 洞察向量化與漏通知入口
All checks were successful
CD Pipeline / deploy (push) Successful in 1m13s

This commit is contained in:
OoO
2026-04-29 23:05:46 +08:00
parent f0e044aa48
commit 0c2e9bbced
10 changed files with 166 additions and 8 deletions

View File

@@ -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()