From 00814d51f12e95be39ddf03b40235094990396e8 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Sat, 9 Nov 2024 20:23:28 -0800 Subject: [PATCH] misc updates --- .../contrib/void/browser/registerSettings.ts | 110 +++++++++--------- .../contrib/void/browser/registerSidebar.ts | 4 +- .../void/browser/registerThreadsHistory.ts | 14 +-- 3 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/registerSettings.ts b/src/vs/workbench/contrib/void/browser/registerSettings.ts index c588c346..56961406 100644 --- a/src/vs/workbench/contrib/void/browser/registerSettings.ts +++ b/src/vs/workbench/contrib/void/browser/registerSettings.ts @@ -46,20 +46,20 @@ const voidConfigInfo: Record< > = { default: { whichApi: configEnum( - "API Provider.", + 'API Provider.', 'anthropic', nonDefaultConfigFields, ), maxTokens: configEnum( - "Max number of tokens to output.", + 'Max number of tokens to output.', '1024', [ - "default", // this will be parseInt'd into NaN and ignored by the API. Anything that's not a number has this behavior. - "1024", - "2048", - "4096", - "8192" + 'default', // this will be parseInt'd into NaN and ignored by the API. Anything that's not a number has this behavior. + '1024', + '2048', + '4096', + '8192' ] as const, ), @@ -67,13 +67,13 @@ const voidConfigInfo: Record< anthropic: { apikey: configString('Anthropic API key.', ''), model: configEnum( - "Anthropic model to use.", + 'Anthropic model to use.', 'claude-3-5-sonnet-20240620', [ - "claude-3-5-sonnet-20240620", - "claude-3-opus-20240229", - "claude-3-sonnet-20240229", - "claude-3-haiku-20240307" + 'claude-3-5-sonnet-20240620', + 'claude-3-opus-20240229', + 'claude-3-sonnet-20240229', + 'claude-3-haiku-20240307' ] as const, ), }, @@ -83,23 +83,23 @@ const voidConfigInfo: Record< 'OpenAI model to use.', 'gpt-4o', [ - "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" + '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' ] as const ), }, @@ -114,19 +114,19 @@ const voidConfigInfo: Record< 'gitlab' ] as const ), - repository: configString('Repository identifier in "owner/repository" format.', ''), + repository: configString('Repository identifier in "owner / repository" format.', ''), branch: configString('Name of the branch to use.', 'main'), }, ollama: { endpoint: configString( - 'The endpoint of your Ollama instance. Start Ollama by running `OLLAMA_ORIGINS="vscode-webview://*" ollama serve`.', + 'The endpoint of your Ollama instance. Start Ollama by running `OLLAMA_ORIGINS="vscode - webview://*" ollama serve`.', 'http://127.0.0.1:11434' ), // TODO we should allow user to select model inside Void, but for now we'll just let them handle the Ollama setup on their own // model: configEnum( // 'Ollama model to use.', // 'llama3.1', - // ["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"] as const + // ['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'] as const // ), }, openRouter: { @@ -142,29 +142,29 @@ const voidConfigInfo: Record< apikey: configString('Your API key.', ''), }, azure: { - // "void.azure.apiKey": { - // "type": "string", - // "description": "Azure API key." + // 'void.azure.apiKey': { + // 'type': 'string', + // 'description': 'Azure API key.' // }, - // "void.azure.deploymentId": { - // "type": "string", - // "description": "Azure API deployment ID." + // 'void.azure.deploymentId': { + // 'type': 'string', + // 'description': 'Azure API deployment ID.' // }, - // "void.azure.resourceName": { - // "type": "string", - // "description": "Name of the Azure OpenAI resource. Either this or `baseURL` can be used. \nThe resource name is used in the assembled URL: `https://{resourceName}.openai.azure.com/openai/deployments/{modelId}{path}`" + // 'void.azure.resourceName': { + // 'type': 'string', + // 'description': 'Name of the Azure OpenAI resource. Either this or `baseURL` can be used. \nThe resource name is used in the assembled URL: `https://{resourceName}.openai.azure.com/openai/deployments/{modelId}{path}`' // }, - // "void.azure.providerSettings": { - // "type": "object", - // "properties": { - // "baseURL": { - // "type": "string", - // "default": "https://${resourceName}.openai.azure.com/openai/deployments", - // "description": "Azure API base URL." + // 'void.azure.providerSettings': { + // 'type': 'object', + // 'properties': { + // 'baseURL': { + // 'type': 'string', + // 'default': 'https://${resourceName}.openai.azure.com/openai/deployments', + // 'description': 'Azure API base URL.' // }, - // "headers": { - // "type": "object", - // "description": "Custom headers to include in the requests." + // 'headers': { + // 'type': 'object', + // 'description': 'Custom headers to include in the requests.' // } // } // }, @@ -175,10 +175,10 @@ const voidConfigInfo: Record< 'Gemini model to use.', 'gemini-1.5-flash', [ - "gemini-1.5-flash", - "gemini-1.5-pro", - "gemini-1.5-flash-8b", - "gemini-1.0-pro" + 'gemini-1.5-flash', + 'gemini-1.5-pro', + 'gemini-1.5-flash-8b', + 'gemini-1.0-pro' ] as const ), }, diff --git a/src/vs/workbench/contrib/void/browser/registerSidebar.ts b/src/vs/workbench/contrib/void/browser/registerSidebar.ts index 63a0f789..1178089a 100644 --- a/src/vs/workbench/contrib/void/browser/registerSidebar.ts +++ b/src/vs/workbench/contrib/void/browser/registerSidebar.ts @@ -48,8 +48,8 @@ const mountFn = (...params: any) => { } // and debug.contribution.ts, scm.contribution.ts (source control) type VoidSidebarState = { - isHistoryOpen: boolean - currentTab: 'chat' | 'settings' + isHistoryOpen: boolean; + currentTab: 'chat' | 'settings'; } diff --git a/src/vs/workbench/contrib/void/browser/registerThreadsHistory.ts b/src/vs/workbench/contrib/void/browser/registerThreadsHistory.ts index 89fff739..ee57c224 100644 --- a/src/vs/workbench/contrib/void/browser/registerThreadsHistory.ts +++ b/src/vs/workbench/contrib/void/browser/registerThreadsHistory.ts @@ -6,7 +6,7 @@ import { IStorageService, StorageScope, StorageTarget } from '../../../../platfo import { URI } from '../../../../base/common/uri.js'; import { Emitter, Event } from '../../../../base/common/event.js'; -export type CodeSelection = { selectionStr: string, filePath: URI } +export type CodeSelection = { selectionStr: string; filePath: URI } export type ChatThreads = { [id: string]: { @@ -14,30 +14,30 @@ export type ChatThreads = { createdAt: string; // ISO string lastModified: string; // ISO string messages: ChatMessage[]; - } + }; } type ChatMessage = | { - role: "user"; + role: 'user'; content: string; // content sent to the llm displayContent: string; // content displayed to user selection: CodeSelection | null; // the user's selection files: URI[]; // the files sent in the message } | { - role: "assistant"; + role: 'assistant'; content: string; // content received from LLM displayContent: string | undefined; // content displayed to user (this is the same as content for now) } | { - role: "system"; + role: 'system'; content: string; displayContent?: undefined; } -// a "thread" means a chat message history +// a 'thread' means a chat message history const newThreadObject = () => { const now = new Date().toISOString() @@ -94,7 +94,7 @@ class ThreadHistoryService extends Disposable implements IThreadHistoryService { // if a thread with 0 messages already exists, switch to it const currentThreads = this.getAllThreads() - for (let threadId in currentThreads) { + for (const threadId in currentThreads) { if (currentThreads[threadId].messages.length === 0) { this.switchToThread(threadId) return