6. For $\triangle A B C$ with sides $a, b, c$, if $|a-b| \leqslant|a-c|$, $|a-b| \leqslant|b-c|$, then the range of $\frac{b}{a}$ is $\qquad$ .
6. $\left(\frac{\sqrt{5}-1}{2}, \frac{\sqrt{5}+1}{2}\right)$.

Let's assume $a=1, b=q$.
If $\frac{a}{b}=\frac{1}{q} \geqslant 1$, by the problem's condition, then $c$ must be the longest side or the shortest side of $\triangle A B C$, which means
$q \leqslant 1 \leqslant c$ or $c \leqslant q \leqslant 1$.
In this case, $\frac{c}{1} \geqslant \frac{1}{q}$ or $\frac{c}{q} \leqslant \frac{q}{1}$,

i.e., $c \geqslant \frac{1}{q}$ or $c \leqslant q^{2}$.
By the triangle inequality, we have
$1+q>\frac{1}{q}$ or $q^{2}+q>1$.
Solving these, we get $1 \geqslant q>\frac{\sqrt{5}-1}{2}$.
Similarly, if $\frac{a}{b}=\frac{1}{q}<1$, then
$1<q<\frac{\sqrt{5}+1}{2}$.
Thus, $\frac{\sqrt{5}-1}{2}<q<\frac{\sqrt{5}+1}{2}$.