Control: Isolate infected plant(s) and cover any tables or carpet, etc. that may receive any over-spray if using soap or oil sprays.
Your first step is to cut back on the watering so the soil dries out several inches down. This will decrease the survival of any eggs and will make the soil less attractive to the egg laying females so they may pack up and leave. Keep rotted leaves and debris cleaned up to also discourage their presence.
You can purchase gnat sticks and place them around the edge of your pot. They are yellow and will attract adult gnats and be captured. This will reduce the new eggs problem.
You can re-pot your plant by taking it outside, gently removing as much of the dirt as possible and re-potting in fresh medium. Do not reuse the old dirt near your plants.
You can sprinkle Diatomaceous Earth on the soil and grubs that come in contact will be history.
You can use an insecticidal soap spray or insecticidal oil spray to control the adult stage but these are short-term, must make contact (tricky – they’re fast), have to be applied every few days and may have minimal effect. You can purchase these products or whip up a batch or homemade insecticidal soap or homemade insecticidal oil.
Use a systemic insecticide if necessary. The roots absorb the insecticide and the insect will feed on it along with the sap. Always read instructions on purchased products before use and be certain it is appropriate for the plant and the insect you have.