def add_or_update_context_msg(
        self,
        session_id: str,
        context_messages: list,
        created_at: int = None,
        updated_at: int = None,
        metadata: dict = {},
        **kwargs,
    ) -> None:
        """Update context messages for a session.

        :param str session_id: Unique session ID.
        :param List context_messages: List of context messages.
        :param int created_at: Timestamp when the context messages were created.
        :param int updated_at: Timestamp when the context messages were last updated.
        :param dict metadata: Additional metadata for the context messages.
        """
        created_at = created_at or int(time.time())
        updated_at = updated_at or int(time.time())

        self.cursor.execute(
            """
        INSERT OR REPLACE INTO context_messages (context_data, session_id, created_at, updated_at, metadata)
        VALUES (?, ?, ?, ?, ?)
        """,
            (
                json.dumps(context_messages),
                session_id,
                created_at,
                updated_at,
                json.dumps(metadata),
            ),
        )
        self.conn.commit()
Update context messages for a session.

        :param str session_id: Unique session ID.
        :param List context_messages: List of context messages.
        :param int created_at: Timestamp when the context messages were created.
        :param int updated_at: Timestamp when the context messages were last updated.
        :param dict metadata: Additional metadata for the context messages.
        
backend/director/db/sqlite/db.py