Modified regular representations of affine and Virasoro algebras, VOA structure and semi-infinite cohomology