validate tabautocomplete model(s) in config
This commit is contained in:
parent
b6e6826676
commit
0a5dc2bed2
3 changed files with 33 additions and 4 deletions
|
|
@ -129,7 +129,7 @@ function formatExternalSnippet(
|
|||
}
|
||||
|
||||
let shownGptClaudeWarning = false;
|
||||
const nonAutocompleteModels = [
|
||||
export const nonAutocompleteModels = [
|
||||
// "gpt",
|
||||
// "claude",
|
||||
"mistral",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { SerializedContinueConfig } from "../";
|
||||
import { ModelDescription, SerializedContinueConfig } from "../";
|
||||
import { nonAutocompleteModels } from "../autocomplete/completionProvider";
|
||||
import { Telemetry } from "../util/posthog";
|
||||
|
||||
export interface ConfigValidationError {
|
||||
|
|
@ -14,7 +15,7 @@ export interface ConfigValidationError {
|
|||
export function validateConfig(config: SerializedContinueConfig) {
|
||||
const errors: ConfigValidationError[] = [];
|
||||
|
||||
// Validate models
|
||||
// Validate chat models
|
||||
if (!Array.isArray(config.models) || config.models.length === 0) {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
|
|
@ -34,9 +35,37 @@ export function validateConfig(config: SerializedContinueConfig) {
|
|||
message: `Model at index ${index} has an invalid 'provider'.`,
|
||||
});
|
||||
}
|
||||
if (typeof model.provider !== "string") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: `Model at index ${index} has an invalid 'provider'.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Validate tab autocomplete model(s)
|
||||
if (config.tabAutocompleteModel) {
|
||||
function checkTabAutocompleteModel(modelDescription: ModelDescription, index?: number) {
|
||||
if (
|
||||
nonAutocompleteModels.some((m) => modelDescription.model.includes(m)) &&
|
||||
!modelDescription.model.toLowerCase().includes("deepseek") &&
|
||||
!modelDescription.model.toLowerCase().includes("codestral")
|
||||
) {
|
||||
errors.push({
|
||||
fatal: false,
|
||||
message: `${modelDescription.model} is not trained for tab-autocomplete, and will result in low-quality suggestions. See the docs to learn more about why: https://docs.continue.dev/features/tab-autocomplete#i-want-better-completions-should-i-use-gpt-4`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(config.tabAutocompleteModel)) {
|
||||
config.tabAutocompleteModel.forEach(checkTabAutocompleteModel);
|
||||
} else {
|
||||
checkTabAutocompleteModel(config.tabAutocompleteModel);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate slashCommands
|
||||
if (config.slashCommands) {
|
||||
if (!Array.isArray(config.slashCommands)) {
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ fn global_ignore_path() -> PathBuf {
|
|||
let mut path = get_my_home().unwrap().unwrap();
|
||||
path.push(".continue");
|
||||
path.push("index");
|
||||
path.push(".globalcontinueignore");
|
||||
path.push(".continueignore");
|
||||
path
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue