LongReward: Improving Long-context Large Language Models with AI Feedback