The action of the Virasoro algebra in the two-dimensional Potts and loop models at generic Q