I suddenly got curious about something. Before modern psychology and neuroscience became widespread, there were no therapists, and no one knew what depression, ADHD, ASD, schizophrenia, or bipolar disorder—or other brain function and neurodevelopmental issues—were. So how did people back then actually notice these very real forms of suffering and abnormality?
When someone had a severe emotional breakdown, hallucinations, or extreme swings between mania and depression, how did the person and their family tell whether it was a "character flaw, laziness, or possession" versus "a real illness"? And how were children who were born with attention deficits or social difficulties treated by their families and society in an era with no diagnostic criteria at all?
Without any understanding of "the brain being ill," what methods did older generations or people in ancient times actually use to cope with, process, and soothe these "illnesses of the mind"? Are there friends here who know history, medical history, or have heard older relatives talk about similar experiences who'd like to chat about it?
The core of your question isn't really "how did people in the past view mental illness," but rather "when there are no diagnostic labels, what is suffering identified by." My assessment is that most of the time it comes down to functional impairment—whether someone can work, whether they can take care of themselves, whether they might harm others—rather than inner experience. This also explains why a lot of mild suffering has long been treated as a personality issue. That said, for this framework to hold up, it would be best to add some specifics about differences across time periods and regions; otherwise it's easy to lump several thousand years together as if they were all the same thing.