Make endpoint url for Ollama configurable (#355)

This commit is contained in:
senovr
2024-07-02 20:59:55 +03:00
committed by GitHub
parent fef25a2d06
commit 18f52772b3
5 changed files with 89 additions and 4 deletions
+10 -1
View File
@@ -27,7 +27,8 @@ export enum CONFIG_KEYS {
OCO_AI_PROVIDER = 'OCO_AI_PROVIDER',
OCO_GITPUSH = 'OCO_GITPUSH',
OCO_ONE_LINE_COMMIT = 'OCO_ONE_LINE_COMMIT',
OCO_AZURE_ENDPOINT = 'OCO_AZURE_ENDPOINT'
OCO_AZURE_ENDPOINT = 'OCO_AZURE_ENDPOINT',
OCO_OLLAMA_API_URL = 'OCO_API_URL',
}
export enum CONFIG_MODES {
@@ -270,6 +271,14 @@ export const configValidators = {
return value;
},
[CONFIG_KEYS.OCO_OLLAMA_API_URL](value: any) { // add simple api validator
validateConfig(
CONFIG_KEYS.OCO_API_URL,
typeof value === 'string' && value.startsWith('http'),
`${value} is not a valid URL`
);
return value;
},
};
export type ConfigType = {