Get rid of them asap because they can cause damage to your plants or atleast the larva can. The larva will feed on the roots of your plants. Gnats love wet dirt. What ya need to do is get yourself some sand and put about an inch or two of it ontop of the soil. You also wanna put some around the holes on the bottoms of your pots as well.
All we did was just place about 1 or 2 inches of sand on the top of the soil. The larva will die because they will have no place to go once the sand is in place. Once you kill all the flyers the rest will follow. Atleast it did with us and we had them bad.