From 7550b96389435c8fe2c3c5bfaed46fc33358fe6a Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 2 Oct 2024 00:00:04 -0700 Subject: [PATCH] update settings --- extensions/void/package.json | 41 +++++++++++++------- extensions/void/src/common/sendLLMMessage.ts | 1 + extensions/void/src/extension.ts | 16 ++++---- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/extensions/void/package.json b/extensions/void/package.json index fd233e42..2f76383d 100644 --- a/extensions/void/package.json +++ b/extensions/void/package.json @@ -27,43 +27,54 @@ "ollama" ] }, - "void.anthropicApiKey": { + "void.anthropic.apiKey": { "type": "string", "default": "", "description": "Anthropic API Key" }, - "void.anthropicModel": { + "void.anthropic.model": { "type": "string", "default": "claude-3-5-sonnet-20240620", - "description": "Anthropic Model to use", + "description": "Anthropic Model to use.", "enum": [ "claude-3-5-sonnet-20240620" ] }, - "void.openAIApiKey": { + "void.anthropic.maxTokens": { "type": "string", - "default": "", - "description": "OpenAI API Key" + "default": "1024", + "description": "Anthropic max number of tokens to output.", + "enum":[ + "1024", + "2048", + "4096", + "8192" + ] }, - "void.greptileApiKey": { + "void.openAI.apiKey": { "type": "string", "default": "", - "description": "Greptile API Key" + "description": "OpenAI API Key." }, - "void.githubPAT": { + "void.greptile.apiKey": { "type": "string", "default": "", - "description": "Greptile - Github PAT (gives Greptile access to your repo)" + "description": "Greptile API Key." }, - "void.ollamaSettings.endpoint": { + "void.greptile.githubPAT": { "type": "string", "default": "", - "description": "Ollama Endpoint - Local API server can be started with `OLLAMA_ORIGINS=\"vscode-webview://*\" ollama serve`" + "description": "Github PAT given to Greptile to access your repository." }, - "void.ollamaSettings.model": { + "void.ollama.endpoint": { "type": "string", "default": "", - "description": "Ollama model to use" + "description": "Ollama Endpoint. Start Ollama by running `OLLAMA_ORIGINS=\"vscode-webview://*\" ollama serve`" + }, + "void.ollama.model": { + "type": "string", + "default": "", + "description": "Ollama model to use." } } }, @@ -172,4 +183,4 @@ "ollama": "^0.5.9", "openai": "^4.57.0" } -} +} \ No newline at end of file diff --git a/extensions/void/src/common/sendLLMMessage.ts b/extensions/void/src/common/sendLLMMessage.ts index 1d9a9a78..cda41845 100644 --- a/extensions/void/src/common/sendLLMMessage.ts +++ b/extensions/void/src/common/sendLLMMessage.ts @@ -4,6 +4,7 @@ import { Ollama } from 'ollama/browser' import { getVSCodeAPI } from '../sidebar/getVscodeApi'; +// always compare these against package.json to make sure every setting in this type can actually be provided by the user export type ApiConfig = { anthropic: { apikey: string, diff --git a/extensions/void/src/extension.ts b/extensions/void/src/extension.ts index a06881d4..3e584035 100644 --- a/extensions/void/src/extension.ts +++ b/extensions/void/src/extension.ts @@ -14,14 +14,14 @@ const readFileContentOfUri = async (uri: vscode.Uri) => { const getApiConfig = () => { const apiConfig: ApiConfig = { anthropic: { - apikey: vscode.workspace.getConfiguration('void').get('anthropicApiKey') ?? '', - model: vscode.workspace.getConfiguration('void').get('anthropicModel') ?? '', - maxTokens: vscode.workspace.getConfiguration('void').get('anthropicMaxToken') ?? '', + apikey: vscode.workspace.getConfiguration('void').get('anthropic.apiKey') ?? '', + model: vscode.workspace.getConfiguration('void').get('anthropic.model') ?? '', + maxTokens: vscode.workspace.getConfiguration('void').get('anthropic.maxTokens') ?? '', }, - openai: { apikey: vscode.workspace.getConfiguration('void').get('openAIApiKey') ?? '' }, + openai: { apikey: vscode.workspace.getConfiguration('void').get('openAI.apiKey') ?? '' }, greptile: { - apikey: vscode.workspace.getConfiguration('void').get('greptileApiKey') ?? '', - githubPAT: vscode.workspace.getConfiguration('void').get('githubPAT') ?? '', + apikey: vscode.workspace.getConfiguration('void').get('greptile.apiKey') ?? '', + githubPAT: vscode.workspace.getConfiguration('void').get('greptile.githubPAT') ?? '', repoinfo: { remote: 'github', repository: 'TODO', @@ -29,8 +29,8 @@ const getApiConfig = () => { } }, ollama: { - endpoint: vscode.workspace.getConfiguration('void').get('ollamaSettings.endpoint') ?? '', - model: vscode.workspace.getConfiguration('void').get('ollamaSettings.model') ?? '', + endpoint: vscode.workspace.getConfiguration('void').get('ollama.endpoint') ?? '', + model: vscode.workspace.getConfiguration('void').get('ollama.model') ?? '', }, whichApi: vscode.workspace.getConfiguration('void').get('whichApi') ?? '' }