mirror of
https://github.com/voideditor/void
synced 2026-05-24 01:48:25 +00:00
Merge pull request #42 from DaveHogan/main
Minor improvement to whichapi & anthropic configuration
This commit is contained in:
commit
3fd9b572fe
4 changed files with 19 additions and 5 deletions
|
|
@ -19,7 +19,7 @@
|
|||
"void.whichApi": {
|
||||
"type": "string",
|
||||
"default": "anthropic",
|
||||
"description": "Choose a model to use",
|
||||
"description": "Choose an API provider",
|
||||
"enum": [
|
||||
"anthropic",
|
||||
"openai",
|
||||
|
|
@ -32,6 +32,14 @@
|
|||
"default": "",
|
||||
"description": "Anthropic API Key"
|
||||
},
|
||||
"void.anthropicModel": {
|
||||
"type": "string",
|
||||
"default": "claude-3-5-sonnet-20240620",
|
||||
"description": "Anthropic Model to use",
|
||||
"enum": [
|
||||
"claude-3-5-sonnet-20240620"
|
||||
]
|
||||
},
|
||||
"void.openAIApiKey": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import OpenAI from 'openai';
|
|||
export type ApiConfig = {
|
||||
anthropic: {
|
||||
apikey: string,
|
||||
model: string,
|
||||
maxTokens: string
|
||||
},
|
||||
openai: {
|
||||
apikey: string
|
||||
|
|
@ -60,12 +62,11 @@ type SendLLMMessageFnTypeExternal = (params: {
|
|||
// Claude
|
||||
const sendClaudeMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, apiConfig }) => {
|
||||
|
||||
|
||||
const anthropic = new Anthropic({ apiKey: apiConfig.anthropic.apikey, dangerouslyAllowBrowser: true }); // defaults to process.env["ANTHROPIC_API_KEY"]
|
||||
|
||||
const stream = anthropic.messages.stream({
|
||||
model: "claude-3-5-sonnet-20240620",
|
||||
max_tokens: 1024,
|
||||
model: apiConfig.anthropic.model,
|
||||
max_tokens: parseInt(apiConfig.anthropic.maxTokens),
|
||||
messages: messages,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@ const readFileContentOfUri = async (uri: vscode.Uri) => {
|
|||
|
||||
const getApiConfig = () => {
|
||||
const apiConfig: ApiConfig = {
|
||||
anthropic: { apikey: vscode.workspace.getConfiguration('void').get('anthropicApiKey') ?? '' },
|
||||
anthropic: {
|
||||
apikey: vscode.workspace.getConfiguration('void').get('anthropicApiKey') ?? '',
|
||||
model: vscode.workspace.getConfiguration('void').get('anthropicModel') ?? '',
|
||||
maxTokens: vscode.workspace.getConfiguration('void').get('anthropicMaxToken') ?? '',
|
||||
},
|
||||
openai: { apikey: vscode.workspace.getConfiguration('void').get('openAIApiKey') ?? '' },
|
||||
greptile: {
|
||||
apikey: vscode.workspace.getConfiguration('void').get('greptileApiKey') ?? '',
|
||||
|
|
|
|||
1
void
Submodule
1
void
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 6d513a1e602c8dea3f89f85cc5a04d840a0abfa9
|
||||
Loading…
Reference in a new issue