Merge pull request #84 from voideditor/config-improvements

Improve Void VS Code configuration
This commit is contained in:
Andrew Pareles 2024-10-02 00:02:56 -07:00 committed by GitHub
commit 8937b52e72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 23 deletions

View file

@ -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"
}
}
}

View file

@ -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,

View file

@ -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') ?? ''
}