Exact solution of the multi-component generalized six-vertex model