AF and palpitations are very different things. AF can be v dangerous depending on the type, whereas palpitations aren’t, generally….I assume your doctor has told you it’s palpitations?
I’ve had AF, stopped after an ablation. I still get palpitations on occasion. It’s well worth looking at these videos (recommended by my GP not some random) York Cardiology
I’ve reduced caffeine but it hasn’t made any difference (btw I think 4 cups of tea gives you quite a lot of caffeine in a day). Alcohol definitely makes it worse, as does dehydration. Not tried magnesium but may do at some point (tho I believe standard magnesium supplements aren’t the right type..they are normally magnesium citrate or oxide or glycinate and it should be magnesium pitolate but it can cause GI issues).