Changesets · Branches · Tags · Compare
| Changeset | 80e64a13e0b23a5820e14d64bd28c517d0b74d6aa5ebf8de415ce80394b0d265 |
|---|---|
| Author | Jacob Kim <jacob@continue.dev> · 2025-07-02 17:53 -07:00 |
| Committer | Jacob Kim <jacob@continue.dev> · 2025-07-02 17:53 -07:00 |
| Parents | 9da59f739c22 |
1 file changed
modified core/nextEdit/templating/NextEditPromptEngine.ts +14 −12
| @@ -51,16 +51,7 @@ | ||
| 51 | 51 | ): TemplateRenderer { |
| 52 | 52 | let template = NEXT_EDIT_MODEL_TEMPLATES[modelName]; |
| 53 | 53 | if (!template) { |
| 54 | - // Check if modelName includes any known model name as substring. | |
| 55 | - const matchingModel = Object.keys(NEXT_EDIT_MODEL_TEMPLATES).find((key) => | |
| 56 | - modelName.includes(key), | |
| 57 | - ); | |
| 58 | - | |
| 59 | - if (matchingModel) { | |
| 60 | - template = NEXT_EDIT_MODEL_TEMPLATES[matchingModel as NextEditModelName]; | |
| 61 | - } else { | |
| 62 | - throw new Error(`Model ${modelName} is not supported for next edit.`); | |
| 63 | - } | |
| 54 | + throw new Error(`Model ${modelName} is not supported for next edit.`); | |
| 64 | 55 | } |
| 65 | 56 | |
| 66 | 57 | const compiledTemplate = Handlebars.compile(template.template); |
| @@ -74,7 +65,7 @@ | ||
| 74 | 65 | helper: HelperVars, |
| 75 | 66 | userEdits: string, |
| 76 | 67 | ): UserPrompt { |
| 77 | - const modelName = helper.modelName as NextEditModelName; | |
| 68 | + let modelName = helper.modelName as NextEditModelName; | |
| 78 | 69 | |
| 79 | 70 | if (modelName === "this field is not used") { |
| 80 | 71 | return { |
| @@ -85,7 +76,18 @@ | ||
| 85 | 76 | |
| 86 | 77 | // Validate that the modelName is actually a supported model. |
| 87 | 78 | if (!Object.keys(NEXT_EDIT_MODEL_TEMPLATES).includes(modelName)) { |
| 88 | - throw new Error(`${helper.modelName} is not yet supported for next edit.`); | |
| 79 | + // Check if modelName includes any known model name as substring. | |
| 80 | + const matchingModel = Object.keys(NEXT_EDIT_MODEL_TEMPLATES).find((key) => | |
| 81 | + modelName.includes(key), | |
| 82 | + ); | |
| 83 | + | |
| 84 | + if (matchingModel) { | |
| 85 | + modelName = matchingModel as NextEditModelName; | |
| 86 | + } else { | |
| 87 | + throw new Error( | |
| 88 | + `${helper.modelName} is not yet supported for next edit.`, | |
| 89 | + ); | |
| 90 | + } | |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | 93 | const renderer = templateRendererOfModel(modelName); |