From 06826d4c868b323276bef2196350b8099ba2f677 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Sun, 15 Feb 2026 13:24:54 -0300 Subject: [PATCH] fix(api): resolve TypeError in chat/completions ensureInitialized initTranslators() is a no-op stub (translators self-register via static imports). Wrapping the call with Promise.resolve() ensures .then() works even when the function returns undefined instead of a Promise. --- src/app/api/v1/chat/completions/route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/v1/chat/completions/route.js b/src/app/api/v1/chat/completions/route.js index 2c223984c3..5072bd69b5 100644 --- a/src/app/api/v1/chat/completions/route.js +++ b/src/app/api/v1/chat/completions/route.js @@ -9,7 +9,7 @@ let initPromise = null; */ function ensureInitialized() { if (!initPromise) { - initPromise = initTranslators().then(() => { + initPromise = Promise.resolve(initTranslators()).then(() => { console.log("[SSE] Translators initialized"); }); }