In the first drawing the resulting D-H would results in the last line of you r D-H table to contain both $\theta_4$ and $d_1$ as parameters, provided you choose the frame in a proper way.
The second drawing solves your issue, at the coast of adding and extra frame, but makes it clearer from a parameters points of view. Although as noted @aniket-sharma the frame you draw are not direct which can lead to confusion/errors.
In general the D-H parametrization of an manipulator is not unique ! Because textbooks are listing to sets of rules, omitting to present the others.
In general an open question while doing a D-H parametrization is the choice of orientation and location of both the first (base) and last (end-effector) frame.
For clarity they can be chose in a way that is not minimizing the total number of frames. Think for example as a manipulator mounted on a mobile base, for clarity some people consider as base frame a frame aligned with the one of the mobile center of mass, and then fix the first frame based on D-H convention.
As for the location of the frame, for a rotational joint the origin should be located on the axis of rotation and for a prismatic joint on the direction of translation. For design where those two lines do not intersect in the 3D space or when they coinciding the location of the origin is a matter of convenience (and can be optimized for readability/simplicity or for computational efficiency).
The latter being the one at hand here, where you can have a compact form as first proposed or an easier to understand as the second proposed.
+1
for excellent penmanship! $\endgroup$