At this point, Emperor Daizong still had to face Yan, now ruled by Shi Chaoyi—the son and successor to Shi Siming, who had killed and succeeded An Qingxu and recaptured Luoyang from Tang in 759. Late in 762, he sent the eunuch Liu Qingtan () to Huige to request aid from its Dengli Khan Yaoluoge Yidijian (a younger brother of the Huige prince that he had previously become sworn brother to), who had also received an alliance proposal from Shi Chaoyi. Yaoluoge Yidijian thus initially rejected Emperor Daizong's proposal and advanced south to aid Shi Chaoyi, but after further persuasion by Pugu Huai'en, whose daughter he had married, he agreed with the Tang proposal. In winter 762, the joint Tang and Huige forces recaptured Luoyang, forcing Shi Chaoyi to flee. (Shi Chaoyi would eventually commit suicide in spring 763, ending Yan.)