Hey there, welcome to
TH
It's good you're trying to help your girlfriend, but its really important you watch out after yourself as well.
Something you could do maybe is make some rules, depending on whats draging you down.
Like, you said she's stuggeling with school and you are trying to help her but she only sees everything negatively. So maybe you could install a rule that says while you are studying together she isn't allowed to say negative things. She can say them after and before but not while studying or something.
It's important you give yourself a break from time to time. It's a good thing to be there for her, but sometimes we need a break from people, even if we love them. You could maybe take one day or two a week or something where after school you don't text her and instead spent some time on yourself, maybe meeting with friends, doing fun stuff and just taking a rest from the negativ things.
Also you can always say stopp. It's good to listen but if it gets to much for you, you have every right to just say stopp, we are not gonna continue talking about this, let's change the topic.
Apart from that, has she someone else, she can talk to beside you? Because I think it would be good for her to confide in someone else too, maybe an adult, teacher or something so you aren't the only person she can rant to.
I hope any of this can help you some.
Take care