串接 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

@@ -0,0 +1,25 @@
def test_enqueue_insight_embedding_builds_queue_payload(monkeypatch):
import services.openclaw_learning_service as learning
calls = []
monkeypatch.setattr(
learning,
"_enqueue_embedding",
lambda table, target_id, text: calls.append((table, target_id, text)) or True,
)
assert learning.enqueue_insight_embedding(42, "agent_action", "hello", "2026-04-29") is True
assert calls == [("ai_insights", 42, "agent_action (2026-04-29): hello")]
def test_enqueue_insight_embedding_rejects_missing_content(monkeypatch):
import services.openclaw_learning_service as learning
monkeypatch.setattr(
learning,
"_enqueue_embedding",
lambda *args, **kwargs: (_ for _ in ()).throw(AssertionError("should not enqueue")),
)
assert learning.enqueue_insight_embedding(42, "agent_action", "") is False
assert learning.enqueue_insight_embedding(None, "agent_action", "hello") is False