What is the function of the diode in the image?
The circled diode provides a -0.7Vdc negative rail or reference.  Note that the anode of the diode is connected to circuit ground (mostly hidden by your red circle - but visible at high magnification).

This negative rail allows the (+) input of the 2nd op-amp to operate near or below ground.

Note that I would connect pin 4 of the op-amp to the cathode of the circled diode - this will improve operation when the (+) input of the 2nd op-amp is near zero Vdc.