Hi & welcome! I'm guessing gnats too. Gnats love peat. Since I quit allowing that in my pots, no more gnats.
Aside from changing soil, a product with Bti in it, such as those sold to thwart mosquito larvae in bird baths and ponds, when added to the water given to plants when thirsty, will also eliminate gnat larvae and break the cycle.