2. Let the side length of the regular octagon $A_{1} A_{2} \cdots A_{8}$ be 1. For any two points $A_{i} 、 A_{j}$, the maximum value of $\overrightarrow{A_{i} A_{j}} \cdot \overrightarrow{A_{1} A_{2}}$ is $\qquad$ .
2. $\sqrt{2}+1$.

Notice that, the four sides $A_{1} A_{2}$, $A_{3} A_{4}$, $A_{5} A_{6}$, and $A_{7} A_{8}$ of the regular octagon $A_{1} A_{2} \cdots A_{8}$ form a square with a side length of $\sqrt{2}+1$.

Also, $\overrightarrow{A_{i} A_{j}} \cdot \overrightarrow{A_{1} A_{2}}$ is the projection of $\overrightarrow{A_{i} A_{j}}$ onto one side of the square, which is clearly no more than the side length $\sqrt{2}+1$. When $\overrightarrow{A_{i} A_{j}}$ is $\overrightarrow{A_{8} A_{3}}$, the projection length is $\sqrt{2}+1$, so the maximum value is $\sqrt{2}+1$.