chore(knowledge): 沉淀决策日志统一加 [knowledge] 前缀,跳过提到 WARNING 级

便于 docker logs 一条 grep 抓全部捕获决策(跳过/回退/失败):
  docker logs deerflow-vite-gateway 2>&1 | grep "\[knowledge\]"

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
AdministratorandClaude Opus 4.8 committed 2026-06-08 22:55:44 +08:00
1 parent 76320ca5a3
commit d9fc7c9fdf
2 files changed
+7 -7

No files matched your search

@@ -265,11 +265,11 @@ async def extract_thread_llm_multi(
raw = response.content if isinstance(response.content, str) else str(response.content)
data = _parse_json(raw)
except Exception:
logger.exception("Knowledge LLM extraction failed for thread %s; using rule-based fallback", thread_id)
logger.exception("[knowledge] thread %s — LLM extraction call failed; using rule-based fallback", thread_id)
return []
if not data:
logger.warning("Knowledge LLM extraction for thread %s returned no parsable JSON; using rule-based fallback", thread_id)
logger.warning("[knowledge] thread %s — LLM returned no parsable JSON; using rule-based fallback", thread_id)
return []
note_dicts = _notes_from_data(data)
@@ -279,10 +279,10 @@ async def extract_thread_llm_multi(
# The model deliberately judged this conversation worthless (greeting,
# meta chatter, no findings). Skip ingestion entirely — do NOT fall
# back to the rule-based verbatim dump.
logger.info("Knowledge LLM judged thread %s not worth ingesting: %s", thread_id, reason)
logger.warning("[knowledge] thread %s SKIPPED — model judged not worth ingesting: %s", thread_id, reason)
raise LLMRejectedIngest(reason or "no knowledge value")
logger.warning(
"Knowledge LLM extraction for thread %s produced no notes (should_ingest=%s, reason=%r); using rule-based fallback",
"[knowledge] thread %s — LLM produced no notes (should_ingest=%s, reason=%r); using rule-based fallback",
thread_id,
data.get("should_ingest"),
reason,
@@ -296,9 +296,9 @@ class KnowledgeService:
effective_status = status
if llm_fallback:
logger.warning(
"Knowledge capture for thread %s fell back to rule-based extraction "
"(LLM distillation produced nothing usable); landing as draft. "
"Check extraction model '%s' / earlier logs for the cause.",
"[knowledge] thread %s — capture fell back to rule-based extraction "
"(LLM distillation produced nothing usable); landing as DRAFT. "
"Check extraction model '%s' / earlier [knowledge] logs for the cause.",
thread_id,
self.config.extract_model_name or "models[0]",
)