diff --git a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx index 0b2ce3a8..1b8df220 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx @@ -664,7 +664,7 @@ export const VoidCustomDropdownBox = >({ {isOpen && (
{ infoOfModelName[m.modelName] = { - showAsDefault: m.isDefault, + showAsDefault: m.type === 'default', isDownloaded: true } }) @@ -367,7 +367,7 @@ const TableOfModelsForProvider = ({ providerName }: { providerName: ProviderName return ( - + {!showAsDefault && removeModelButton} {modelName} diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx index a8cbe365..47fd95f8 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx @@ -286,7 +286,7 @@ export const ModelDump = () => { return
{modelDump.map((m, i) => { - const { isHidden, isDefault, isAutodetected, modelName, providerName, providerEnabled } = m + const { isHidden, type, modelName, providerName, providerEnabled } = m const isNewProviderName = (i > 0 ? modelDump[i - 1] : undefined)?.providerName !== providerName @@ -318,7 +318,7 @@ export const ModelDump = () => { // : (isHidden ? `'${modelName}' won't appear in dropdowns` : ``) // } > - {isAutodetected ? '(detected locally)' : isDefault ? '' : '(custom model)'} + {type === 'autodetected' ? '(detected locally)' : type === 'default' ? '' : '(custom model)'} { />
- {isDefault ? null : } + {type === 'default' ? null : }
@@ -692,7 +692,7 @@ const transferTheseFilesOfOS = (os: 'mac' | 'windows' | 'linux' | null, fromEdit }, { from: URI.joinPath(URI.from({ scheme: 'file' }), userprofile, '.cursor', 'extensions'), to: URI.joinPath(URI.from({ scheme: 'file' }), userprofile, '.void-editor', 'extensions'), - }] + }] } else if (fromEditor === 'Windsurf') { return [{ from: URI.joinPath(URI.from({ scheme: 'file' }), appdata, 'Windsurf', 'User', 'settings.json'), diff --git a/src/vs/workbench/contrib/void/browser/toolsService.ts b/src/vs/workbench/contrib/void/browser/toolsService.ts index f3695343..82f1819c 100644 --- a/src/vs/workbench/contrib/void/browser/toolsService.ts +++ b/src/vs/workbench/contrib/void/browser/toolsService.ts @@ -263,7 +263,7 @@ export class ToolsService implements IToolsService { read_file: async ({ uri, startLine, endLine, pageNumber }) => { await voidModelService.initializeModel(uri) const { model } = await voidModelService.getModelSafe(uri) - if (model === null) { throw new Error(`Contents were empty. There may have been an error, or the file may not exist.`) } + if (model === null) { throw new Error(`No contents; File does not exist.`) } let contents: string if (startLine === null && endLine === null) { diff --git a/src/vs/workbench/contrib/void/common/modelCapabilities.ts b/src/vs/workbench/contrib/void/common/modelCapabilities.ts index c8d923b7..71459066 100644 --- a/src/vs/workbench/contrib/void/common/modelCapabilities.ts +++ b/src/vs/workbench/contrib/void/common/modelCapabilities.ts @@ -190,7 +190,7 @@ type VoidStaticProviderInfo = { // doesn't change (not stateful) const modelOptionsDefaults: VoidStaticModelInfo = { - contextWindow: 32_000, + contextWindow: 16_000, maxOutputTokens: 4_096, cost: { input: 0, output: 0 }, downloadable: false, diff --git a/src/vs/workbench/contrib/void/common/prompt/prompts.ts b/src/vs/workbench/contrib/void/common/prompt/prompts.ts index 61372d99..2a0ddbeb 100644 --- a/src/vs/workbench/contrib/void/common/prompt/prompts.ts +++ b/src/vs/workbench/contrib/void/common/prompt/prompts.ts @@ -447,7 +447,8 @@ export const DIVIDER = `=======` export const FINAL = `>>>>>>> UPDATED` export const searchReplace_systemMessage = `\ -You are a coding assistant that takes in a high-level code description of a change to make, and outputs SEARCH/REPLACE code blocks which implement the change EXACTLY as described. +You are a coding assistant that takes in a diff describing of a change to make, and outputs SEARCH/REPLACE code blocks which implement the change. +The diff will be labeled \`DIFF\` and the original file will be labeled \`ORIGINAL_FILE\`. Format your SEARCH/REPLACE blocks as follows: ${tripleTick[0]} @@ -458,9 +459,9 @@ ${DIVIDER} ${FINAL} ${tripleTick[1]} -1. The change to make will be labeled \`CHANGE\` and the original file will be labeled \`ORIGINAL_FILE\`. +1. Every single item written in \`CHANGE\` should show up in the final result, except for comments explicitly saying things like "// ... existing code". Make sure to include ALL other comments (even descriptive ones), code, whitespace, etc. in the final result. -2. Your SEARCH/REPLACE block(s) must implement the change EXACTLY. Do not introduce (or omit) any new comments, spaces, or whitespace. +2. Your SEARCH/REPLACE block(s) must implement the change EXACTLY. You should use comments like "// ... existing code" as reference points, and everything else in the change should be written verbatim. 3. You are allowed to output multiple SEARCH/REPLACE blocks. @@ -473,6 +474,13 @@ ${tripleTick[1]} 7. Each ORIGINAL text must be DISJOINT from all other ORIGINAL text. ## EXAMPLE 1 +DIFF +${tripleTick[0]} +// ... existing code +let x = 6.5 +// ... existing code +${tripleTick[1]} + ORIGINAL_FILE ${tripleTick[0]} let w = 5 @@ -481,14 +489,6 @@ let y = 7 let z = 8 ${tripleTick[1]} -CHANGE -${tripleTick[0]} -// ... existing code -let x = 6.5 -// ... existing code -${tripleTick[1]} - - ## ACCEPTED OUTPUT ${tripleTick[0]} ${ORIGINAL} @@ -500,7 +500,7 @@ ${tripleTick[1]} ` export const searchReplace_userMessage = ({ originalCode, applyStr }: { originalCode: string, applyStr: string }) => `\ -CHANGE +DIFF ${applyStr} ORIGINAL_FILE diff --git a/src/vs/workbench/contrib/void/common/voidSettingsService.ts b/src/vs/workbench/contrib/void/common/voidSettingsService.ts index 40de78a2..b8b3fd10 100644 --- a/src/vs/workbench/contrib/void/common/voidSettingsService.ts +++ b/src/vs/workbench/contrib/void/common/voidSettingsService.ts @@ -71,24 +71,22 @@ export interface IVoidSettingsService { -const _updatedModelsAfterDefaultModelsChange = (defaultModelNames: string[], options: { existingModels: VoidStatefulModelInfo[], didAutoDetect: boolean }) => { - const { existingModels, didAutoDetect } = options +const _modelsWithSwappedInNewModels = (options: { existingModels: VoidStatefulModelInfo[], models: string[], type: 'autodetected' | 'default' }) => { + const { existingModels, models, type } = options const existingModelsMap: Record = {} for (const existingModel of existingModels) { existingModelsMap[existingModel.modelName] = existingModel } - const newDefaultModels = defaultModelNames.map((modelName, i) => ({ - modelName, - isDefault: true, - isAutodetected: didAutoDetect, - isHidden: !!existingModelsMap[modelName]?.isHidden, - })) + const newDefaultModels = models.map((modelName, i) => ({ modelName, type, isHidden: !!existingModelsMap[modelName]?.isHidden, })) return [ - ...newDefaultModels, // swap out all the default models for the new default models - ...existingModels.filter(m => !m.isDefault), // keep any non-default (custom) models + ...newDefaultModels, // swap out all the models of this type for the new models of this type + ...existingModels.filter(m => { + const keep = m.type !== type + return keep + }) ] } @@ -101,7 +99,7 @@ export const modelFilterOfFeatureName: { [featureName in FeatureName]: { filter: } -const _stateWithUpdatedDefaultModels = (state: VoidSettingsState): VoidSettingsState => { +const _stateWithMergedDefaultModels = (state: VoidSettingsState): VoidSettingsState => { let newSettingsOfProvider = state.settingsOfProvider // recompute default models @@ -109,7 +107,7 @@ const _stateWithUpdatedDefaultModels = (state: VoidSettingsState): VoidSettingsS const defaultModels = defaultSettingsOfProvider[providerName]?.models ?? [] const currentModels = newSettingsOfProvider[providerName]?.models ?? [] const defaultModelNames = defaultModels.map(m => m.modelName) - const newModels = _updatedModelsAfterDefaultModelsChange(defaultModelNames, { existingModels: currentModels, didAutoDetect: false }) + const newModels = _modelsWithSwappedInNewModels({ existingModels: currentModels, models: defaultModelNames, type: 'default' }) newSettingsOfProvider = { ...newSettingsOfProvider, [providerName]: { @@ -257,18 +255,19 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService { ...defaultSettingsOfProvider[providerName], ...readS.settingsOfProvider[providerName], } as any + + // conversion from 1.0.3 to 1.2.5 (can remove this when enough people update) + for (const m of readS.settingsOfProvider[providerName].models) { + if (!m.type) { + const old = (m as { isAutodetected?: boolean; isDefault?: boolean }) + if (old.isAutodetected) + m.type = 'autodetected' + else if (old.isDefault) + m.type = 'default' + else m.type = 'custom' + } + } } - // readS = { - // ...readS, - // settingsOfProvider: { - // ...defaultSettingsOfProvider, - // ...readS.settingsOfProvider, - // mistral: { // we added mistral - // ...defaultSettingsOfProvider.mistral, - // ...readS.settingsOfProvider.mistral, - // }, - // } // we added mistral - // } } catch (e) { @@ -276,7 +275,7 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService { } this.state = readS - this.state = _stateWithUpdatedDefaultModels(this.state) + this.state = _stateWithMergedDefaultModels(this.state) this.state = _validatedModelState(this.state); @@ -409,7 +408,7 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService { const { models } = this.state.settingsOfProvider[providerName] const oldModelNames = models.map(m => m.modelName) - const newModels = _updatedModelsAfterDefaultModelsChange(autodetectedModelNames, { existingModels: models, didAutoDetect: true }) + const newModels = _modelsWithSwappedInNewModels({ existingModels: models, models: autodetectedModelNames, type: 'autodetected' }) this.setSettingOfProvider(providerName, 'models', newModels) // if the models changed, log it @@ -443,7 +442,7 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService { if (existingIdx !== -1) return // if exists, do nothing const newModels = [ ...models, - { modelName, isDefault: false, isHidden: false } + { modelName, type: 'custom', isHidden: false } as const ] this.setSettingOfProvider(providerName, 'models', newModels) diff --git a/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts b/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts index 5f10c9a4..eea91932 100644 --- a/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts +++ b/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts @@ -30,9 +30,8 @@ export const customSettingNamesOfProvider = (providerName: ProviderName) => { export type VoidStatefulModelInfo = { // <-- STATEFUL modelName: string, - isDefault: boolean, // whether or not it's a default for its provider + type: 'default' | 'autodetected' | 'custom'; isHidden: boolean, // whether or not the user is hiding it (switched off) - isAutodetected?: boolean, // whether the model was autodetected by polling } // TODO!!! eventually we'd want to let the user change supportsFIM, etc on the model themselves @@ -238,8 +237,7 @@ const modelInfoOfDefaultModelNames = (defaultModelNames: string[]): { models: Vo return { models: defaultModelNames.map((modelName, i) => ({ modelName, - isDefault: true, - isAutodetected: false, + type: 'default', isHidden: defaultModelNames.length >= 10, // hide all models if there are a ton of them, and make user enable them individually })) }