From 9a12db2066abbcccd2aa2626406d308c23725af6 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 4 Apr 2025 17:58:06 -0400 Subject: [PATCH] fix: .startsWith on undefined --- src/puter-js/src/modules/AI.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/puter-js/src/modules/AI.js b/src/puter-js/src/modules/AI.js index aca442aa0..d7bae5988 100644 --- a/src/puter-js/src/modules/AI.js +++ b/src/puter-js/src/modules/AI.js @@ -274,6 +274,9 @@ class AI{ if (userParams.max_tokens) { requestParams.max_tokens = userParams.max_tokens; } + + // convert undefined to empty string so that .startsWith works + requestParams.model = requestParams.model ?? ''; // convert to the correct model name if necessary if( requestParams.model === 'claude-3-5-sonnet'){