Exact solution of generalized Tavis - Cummings models in quantum optics