Memory: active_temporary/permanent Zustand korrekt behandeln
This commit is contained in:
parent
b2dd69dd1e
commit
a588a555ef
1 changed files with 16 additions and 0 deletions
|
|
@ -433,6 +433,22 @@ async def handle_message(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
|
|||
)
|
||||
sent = True
|
||||
|
||||
elif suggest["type"] in ("active_temporary", "active_permanent", "active_other"):
|
||||
from datetime import datetime as _dt
|
||||
active_items = memory_client.get_active_memory()
|
||||
matched = _find_matching_item(text, active_items)
|
||||
if matched:
|
||||
mtype = matched.get("memory_type", "")
|
||||
exp = matched.get("expires_at")
|
||||
if mtype == "temporary" and exp:
|
||||
status_msg = f"\n\n🕒 Schon temporär gespeichert bis {_dt.fromtimestamp(exp).strftime('%d.%m.%Y')}."
|
||||
elif mtype == "permanent":
|
||||
status_msg = "\n\n📌 Schon dauerhaft gespeichert."
|
||||
else:
|
||||
status_msg = "\n\n✅ Bereits gespeichert."
|
||||
await update.message.reply_text(answer[:3900] + status_msg, reply_markup=KEYBOARD)
|
||||
sent = True
|
||||
|
||||
elif suggest["type"] == "new_candidate":
|
||||
candidates_after = memory_client.get_candidates()
|
||||
new_candidates = [c for c in candidates_after if c["id"] not in candidates_before]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue