Fix router gRPC mode launch error caused by async loading (#15368)

This commit is contained in:
fzyzcjy
2025-12-22 09:39:01 -08:00
committed by GitHub
parent 2142881b7e
commit 6984837d82
@@ -33,9 +33,11 @@ static HARMONY_ENCODING: OnceLock<HarmonyEncoding> = OnceLock::new();
/// Uses HarmonyGptOss encoding which supports the gpt-oss model family. /// Uses HarmonyGptOss encoding which supports the gpt-oss model family.
pub(super) fn get_harmony_encoding() -> &'static HarmonyEncoding { pub(super) fn get_harmony_encoding() -> &'static HarmonyEncoding {
HARMONY_ENCODING.get_or_init(|| { HARMONY_ENCODING.get_or_init(|| {
tokio::task::block_in_place(|| {
openai_harmony::load_harmony_encoding(HarmonyEncodingName::HarmonyGptOss) openai_harmony::load_harmony_encoding(HarmonyEncodingName::HarmonyGptOss)
.expect("Failed to load Harmony encoding") .expect("Failed to load Harmony encoding")
}) })
})
} }
/// Built-in tools that are added to the system message /// Built-in tools that are added to the system message