I did indoor grow once and still have set up the whole thing but there has been water damage so needs work. Gnats where a huge problem and someone recommended adding fans. I didn't add fans but I did take the ac ducts and constructed more ducts that came from the ceiling to the floor so the air would blow upwards. The ac I have is one that uses water to cool the air through some "filters" called "Paja" in my native tongue.
I'll show it later when I get home.
But the air flow kept those gnats at bay. Due note that I kept this running 24/7 which in turn not only kept the gnats away but also added humidity. I aim to reduce the velocity but that requires tweaking the AC machine a bit.
With the lamps I had it added heat and this there was some sort of equilibrium with the two. I would love to have something to regulate the humidity but not enough funds for that. All in due time.
Another thing you can do to get rid of them is add some repellent. Sunflowers if your outside works great or mint. Other than that, there is something you can spray that can be with all natural ingredients too that I forget. Basically take a cloth and spray that and wipe the leaves with it.
Hope that info helps.
They are annoying I know lol