INNER CODE UNIT · Python

record_decision

browser-use/bux · agent/agency_db.py:191

def record_decision(
    db: sqlite3.Connection,
    chat_id: int,
    message_id: int,
    decision: str,
) -> int | None:
    """Idempotent: locate the row by (chat_id, message_id), set the decision +
    derive a status from the label. Returns the suggestion id, or None if
    no row matched (out-of-band button or message not stored)."""
    row = find_by_message(db, chat_id, message_id)
    if row is None:
        return None
    low = decision.lower()
    if any(w in low for w in ("yes", "do it", "ship", "send", "merge", "approve")):
        status = "accepted"
    elif any(w in low for w in ("more", "regen", "redo", "rethink")):
        status = "regenerated"
    elif any(w in low for w in ("different", "differently", "edit", "refine")):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…