You have to kill the larvae to stop further damage to your roots as the larvae eat your root hairs and you also have to kill the gnats to stop them reproducing.
I suffered with a gnat problem earlier in my grow, it wasn't a serious issue though but you will be surprised how much larvae can be in...