From df27a3c821d25e2033bc749941ace1cfa09840ed Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Wed, 2 Jul 2025 15:36:02 -0700 Subject: [PATCH] check if model name is included in set values --- core/nextEdit/templating/NextEditPromptEngine.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts index cee143168..d69730606 100644 --- a/core/nextEdit/templating/NextEditPromptEngine.ts +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -49,9 +49,18 @@ const NEXT_EDIT_MODEL_TEMPLATES: Record = { function templateRendererOfModel( modelName: NextEditModelName, ): TemplateRenderer { - const template = NEXT_EDIT_MODEL_TEMPLATES[modelName]; + let template = NEXT_EDIT_MODEL_TEMPLATES[modelName]; if (!template) { - throw new Error(`Model ${modelName} is not supported for next edit.`); + // Check if modelName includes any known model name as substring. + const matchingModel = Object.keys(NEXT_EDIT_MODEL_TEMPLATES).find((key) => + modelName.includes(key), + ); + + if (matchingModel) { + template = NEXT_EDIT_MODEL_TEMPLATES[matchingModel as NextEditModelName]; + } else { + throw new Error(`Model ${modelName} is not supported for next edit.`); + } } const compiledTemplate = Handlebars.compile(template.template);