Fruit flies
Red eyes, with a tan front and a black rear. They breed in fermenting food, empty bottles and cans, bins and drains, not in the compost of the pot.
Small dark flies drifting up from a pot are usually fungus gnats, and the adults you are swatting are not the problem: they neither bite nor damage the plant. The larvae in the wet top layer of compost are, and the first thing to change is how you water, letting the top of the compost dry out between waterings, before anything needs to be applied.
The rest of what gets called “gnats in plants”. Some are pests we have not profiled yet; some are insects doing you a favour; some are not insects at all, and no treatment will help.
Red eyes, with a tan front and a black rear. They breed in fermenting food, empty bottles and cans, bins and drains, not in the compost of the pot.
Small, delicate and fuzzy, pale brownish-grey to black, and found mostly in kitchens, bathrooms and basements near drains. The larvae live in the slime inside drains and traps, but they can also breed in water left standing in saucers under pots, so empty those too.
A slender beetle on the compost, with short wing cases and most of its abdomen bare, is a rove beetle. It hunts fungus gnat larvae rather than breeding among them.
Rove beetles →Four questions about the damage separate these better than an appearance can, and this page answers some of them for you.