Most gnats live on decaying organic matter and fungus. Anytime a situation develops like the leaking pipes you describe can start the problem. While the leak is repaired, there is likely lots of moist flooring, sub-flooring and sink cabinet parts that remain moist. It is likely that in your part of the country drying the wood out is going to take a lot longer. Companies that offer flood damage recovery have industrial sized dehumidifiers and powerful fans that remove much greater amounts of moisture than home units. If the leak has been chronic, some wood may need to be replaced as it may no longer be structurally sound. Sprays will not likely remedy the situation as long as a food source is around as you can't treat the moist wood. Also consider contacting your local health department for any assistance they can provide.