How do you know when to give up - on a sick kitty

When we asked our vet the question of how do you know when, she told us that the time will come that you realize you’re doing it more for you than you are them. I thought that was a strange answer until I came to that realization with our dog Rags. I have a dog now that’s 14, but still wide open other than being deaf. I know her time may come in the next few years, and it will kill me to have to make that decision again. Best of luck to you, it’s tough!!