honestly it sounds like something is wrong, keto flu shouldn't last that long unless you are going in and out of ketosis by eating too many carbs regularly.
consider heading to an urgent care or an emergency room for a1c and urine test for ketones to evaluate for diabetes/ diabetic ketoacidosis. I once had a patient end up in the ICU for a few days by doing the keto diet when he had type 2 diabetes. certainly not, but can happen.
sounds like you're doing ok with electrolytes.
it might be good to check a metabolic panel. that will show your sodium and potassium levels, kidney function, etc. If you want to check magnesium levels, that isn't part of the normal metabolic panel, so you'll have to ask for that separately.
if you get checked out and there are no problems with Labs etc, I would reconsider the keto diet. typically when people are having success with it, they feel great, they don't feel hungry, their thinking is clear. this is certainly not the case for you. Even if you're losing weight, you're very likely to gain it all back when you stop.