chat logic finished