4. Given that $AB$ is a chord of the circle $\odot O$ with radius 1, and $AB = a < 1$. A regular $\triangle ABC$ is constructed inside $\odot O$ with $AB$ as one side. $D$ is a point on $\odot O$ different from point $A$, and $DB = AB = a$. The extension of $DC$ intersects $\odot O$ at point $E$. Then the length of $AE$ is ( ).
(A) $\frac{\sqrt{5}}{2} a$
(B) 1
(C) $\frac{\sqrt{3}}{2}$
(D) $a$
4. B.

As shown in Figure 4, connect $O E$, 
$O A$, and $O B$. Let $\angle D=\alpha$, then
$$
\begin{array}{l} 
\angle E C A=120^{\circ}-\alpha \\
= \angle E A C . \\
\text { Also } \angle A B O \\
= \frac{1}{2} \angle A B D \\
= \frac{1}{2}\left(60^{\circ}+180^{\circ}-2 \alpha\right) \\
= 120^{\circ}-\alpha,
\end{array}
$$

Thus, $\triangle A C E \cong \triangle A B O$.
Therefore, $A E=O A=1$.