The switching is mechanical and is internal to the power connector. The power connector is soldered directly to the circuit board. The battery connectors are also wired directly to the circuit board.
If the radio works with the external supply, then the problem is almost surely with the power connector.
Get some contact cleaner, and squirt some into the connector, then work the power connector in and out a few times.
If this doesn’t help, you will have to live with it as replacing the connector is a difficult and tedious process that would cost almost as much as a new radio if you paid a tech to do it.
Taking one of these radios apart is a tricky proposition, and not for a newbie to attempt.
Power connector spring loaded?