Memory: Debug-Logging fuer Duplikat-Flow
This commit is contained in:
parent
22404bdccc
commit
0bff827102
2 changed files with 6 additions and 0 deletions
|
|
@ -294,6 +294,9 @@ def _tool_memory_read(scope=""):
|
|||
return "\n".join(lines)
|
||||
|
||||
|
||||
import logging as _logging
|
||||
_log = _logging.getLogger("context")
|
||||
|
||||
last_suggest_result = {"type": None, "candidate_id": None}
|
||||
|
||||
|
||||
|
|
@ -302,6 +305,7 @@ def _tool_memory_suggest(scope, kind, content, memory_type="temporary", expires_
|
|||
from datetime import datetime
|
||||
global last_suggest_result
|
||||
last_suggest_result = {"type": None, "candidate_id": None}
|
||||
_log.info("memory_suggest aufgerufen: scope=%s kind=%s type=%s content=%s", scope, kind, memory_type, content[:80])
|
||||
|
||||
if memory_type not in ("temporary", "permanent"):
|
||||
memory_type = "temporary"
|
||||
|
|
@ -335,6 +339,7 @@ def _tool_memory_suggest(scope, kind, content, memory_type="temporary", expires_
|
|||
|
||||
if ex_status == "candidate":
|
||||
last_suggest_result = {"type": "existing_candidate", "candidate_id": ex_id}
|
||||
_log.info("Duplikat: bestehender Kandidat ID=%s", ex_id)
|
||||
return "Noch nicht bestaetigt — zeige Auswahl erneut."
|
||||
elif ex_status == "active":
|
||||
if ex_type == "temporary" and ex_exp:
|
||||
|
|
|
|||
|
|
@ -393,6 +393,7 @@ async def handle_message(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
|
|||
memory_client.log_message(session_id, "assistant", answer)
|
||||
|
||||
suggest = context.last_suggest_result
|
||||
log.info("suggest_result: type=%s candidate_id=%s", suggest.get("type"), suggest.get("candidate_id"))
|
||||
|
||||
if suggest["type"] == "existing_candidate" and suggest["candidate_id"]:
|
||||
candidates = memory_client.get_candidates()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue