change model name to case insensitive when selecting tab autocomplete template (#809)

If the model name has capitalization, the model template is not applied correctly.
So, change model name to case insensitive when selecting tab autocomplete template.
This commit is contained in:
Benedict Lee 2024-02-02 13:48:05 +09:00 • committed by GitHub
parent 66ab66f802
commit 0bb35b5cef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,23 +45,24 @@ The last line is incomplete, and you should provide the rest of that line. If th
};
export function getTemplateForModel(model: string): AutocompleteTemplate {
const lowerCaseModel = model.toLowerCase()
if (
model.includes("starcoder") ||
model.includes("star-coder") ||
model.includes("stable")
lowerCaseModel.includes("starcoder") ||
lowerCaseModel.includes("star-coder") ||
lowerCaseModel.includes("stable")
) {
return stableCodeFimTemplate;
}
if (model.includes("codellama")) {
if (lowerCaseModel.includes("codellama")) {
return codeLlamaFimTemplate;
}
if (model.includes("deepseek")) {
if (lowerCaseModel.includes("deepseek")) {
return deepseekFimTemplate;
}
if (model.includes("gpt")) {
if (lowerCaseModel.includes("gpt")) {
return gptAutocompleteTemplate;
}