https://www.planetnatural.com/pest-problem-solver/houseplant-pests/fungus-gnat-control/
down't over water, and use Bti (such as Gnatrol, as u/Golfnbrew noted). Bacillus thuringiensis var. israelensis (Bti), a highly selective biological pesticide that kills damaging larvae, yet is safe for fish, wildlife, humans, and non-target species. They contain no harmful residues, unlike other insecticide options on the market.