update defaults, credit @okxiaoliang4 for package.json enum changes

This commit is contained in:
Andrew 2024-10-02 23:23:07 -07:00
parent 8937b52e72
commit db560744fb
4 changed files with 132 additions and 12 deletions

View file

@ -21,8 +21,9 @@
"default": "anthropic",
"description": "Choose an API provider",
"enum": [
"anthropic",
"openai",
"anthropic",
"azure",
"greptile",
"ollama"
]
@ -37,14 +38,17 @@
"default": "claude-3-5-sonnet-20240620",
"description": "Anthropic Model to use.",
"enum": [
"claude-3-5-sonnet-20240620"
"claude-3-5-sonnet-20240620",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307"
]
},
"void.anthropic.maxTokens": {
"type": "string",
"default": "1024",
"description": "Anthropic max number of tokens to output.",
"enum":[
"enum": [
"1024",
"2048",
"4096",
@ -56,6 +60,30 @@
"default": "",
"description": "OpenAI API Key."
},
"void.openAI.model": {
"type": "string",
"default": "gpt-4o",
"description": "OpenAI model.",
"enum": [
"o1-preview",
"o1-mini",
"gpt-4o",
"gpt-4o-2024-05-13",
"gpt-4o-2024-08-06",
"gpt-4o-mini",
"gpt-4o-mini-2024-07-18",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-turbo-preview",
"gpt-4-0125-preview",
"gpt-4-1106-preview",
"gpt-4",
"gpt-4-0613",
"gpt-3.5-turbo-0125",
"gpt-3.5-turbo",
"gpt-3.5-turbo-1106"
]
},
"void.greptile.apiKey": {
"type": "string",
"default": "",
@ -68,13 +96,101 @@
},
"void.ollama.endpoint": {
"type": "string",
"default": "",
"description": "Ollama Endpoint. Start Ollama by running `OLLAMA_ORIGINS=\"vscode-webview://*\" ollama serve`"
"default": "http://127.0.0.1:11434",
"description": "The Ollama endpoint. By default, use http://127.0.0.1:11434, and start Ollama by running `OLLAMA_ORIGINS=\"vscode-webview://*\" ollama serve`"
},
"void.ollama.model": {
"type": "string",
"default": "",
"description": "Ollama model to use."
"default": "llama3.1",
"description": "Ollama model to use.",
"enum": [
"codegemma",
"codegemma:2b",
"codegemma:7b",
"codellama",
"codellama:7b",
"codellama:13b",
"codellama:34b",
"codellama:70b",
"codellama:code",
"codellama:python",
"command-r",
"command-r:35b",
"command-r-plus",
"command-r-plus:104b",
"deepseek-coder-v2",
"deepseek-coder-v2:16b",
"deepseek-coder-v2:236b",
"falcon2",
"falcon2:11b",
"firefunction-v2",
"firefunction-v2:70b",
"gemma",
"gemma:2b",
"gemma:7b",
"gemma2",
"gemma2:2b",
"gemma2:9b",
"gemma2:27b",
"llama2",
"llama2:7b",
"llama2:13b",
"llama2:70b",
"llama3",
"llama3:8b",
"llama3:70b",
"llama3-chatqa",
"llama3-chatqa:8b",
"llama3-chatqa:70b",
"llama3-gradient",
"llama3-gradient:8b",
"llama3-gradient:70b",
"llama3.1",
"llama3.1:8b",
"llama3.1:70b",
"llama3.1:405b",
"llava",
"llava:7b",
"llava:13b",
"llava:34b",
"llava-llama3",
"llava-llama3:8b",
"llava-phi3",
"llava-phi3:3.8b",
"mistral",
"mistral:7b",
"mistral-large",
"mistral-large:123b",
"mistral-nemo",
"mistral-nemo:12b",
"mixtral",
"mixtral:8x7b",
"mixtral:8x22b",
"moondream",
"moondream:1.8b",
"openhermes",
"openhermes:v2.5",
"phi3",
"phi3:3.8b",
"phi3:14b",
"phi3.5",
"phi3.5:3.8b",
"qwen",
"qwen:7b",
"qwen:14b",
"qwen:32b",
"qwen:72b",
"qwen:110b",
"qwen2",
"qwen2:0.5b",
"qwen2:1.5b",
"qwen2:7b",
"qwen2:72b",
"smollm",
"smollm:135m",
"smollm:360m",
"smollm:1.7b"
]
}
}
},

View file

@ -31,7 +31,7 @@ export class SidebarWebviewProvider implements vscode.WebviewViewProvider {
this._res = temp_res
vscode.workspace.onDidChangeConfiguration(event => {
if (event.affectsConfiguration('void.ollamaSettings.endpoint')) {
if (event.affectsConfiguration('void.ollama.endpoint')) {
if (this._webviewView) {
this.updateWebviewHTML(this._webviewView.webview);
}
@ -41,7 +41,7 @@ export class SidebarWebviewProvider implements vscode.WebviewViewProvider {
private updateWebviewHTML(webview: vscode.Webview) {
const allowed_urls = ['https://api.anthropic.com', 'https://api.openai.com', 'https://api.greptile.com'];
const ollamaEndpoint: string | undefined = vscode.workspace.getConfiguration('void').get('ollamaSettings.endpoint');
const ollamaEndpoint: string | undefined = vscode.workspace.getConfiguration('void').get('ollama.endpoint');
if (ollamaEndpoint)
allowed_urls.push(ollamaEndpoint);

View file

@ -12,7 +12,8 @@ export type ApiConfig = {
maxTokens: string
},
openai: {
apikey: string
apikey: string,
model: string,
},
greptile: {
apikey: string,
@ -117,7 +118,7 @@ const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinal
const openai = new OpenAI({ apiKey: apiConfig.openai.apikey, dangerouslyAllowBrowser: true });
openai.chat.completions.create({
model: 'gpt-4o-2024-08-06',
model: apiConfig.openai.model,
messages: messages,
stream: true,
})

View file

@ -18,7 +18,10 @@ const getApiConfig = () => {
model: vscode.workspace.getConfiguration('void').get('anthropic.model') ?? '',
maxTokens: vscode.workspace.getConfiguration('void').get('anthropic.maxTokens') ?? '',
},
openai: { apikey: vscode.workspace.getConfiguration('void').get('openAI.apiKey') ?? '' },
openai: {
apikey: vscode.workspace.getConfiguration('void').get('openAI.apiKey') ?? '',
model: vscode.workspace.getConfiguration('void').get('anthropic.model') ?? '',
},
greptile: {
apikey: vscode.workspace.getConfiguration('void').get('greptile.apiKey') ?? '',
githubPAT: vscode.workspace.getConfiguration('void').get('greptile.githubPAT') ?? '',