I'm having a little trouble with these two particles. . .

я нервничаю и думаю, что же купить.
Он нервничает и думает, что бы купить.

The sentences were translated as

I am nervous and think what to buy
He is nervous and thinks what to buy

What then is the difference between бы and же here?