diff --git a/src/vs/platform/void/common/voidSettingsTypes.ts b/src/vs/platform/void/common/voidSettingsTypes.ts index fce75bcd..64c74477 100644 --- a/src/vs/platform/void/common/voidSettingsTypes.ts +++ b/src/vs/platform/void/common/voidSettingsTypes.ts @@ -144,8 +144,8 @@ export const defaultProviderSettings = { export type ProviderName = keyof typeof defaultProviderSettings export const providerNames = Object.keys(defaultProviderSettings) as ProviderName[] -export const localProviderNames: ProviderName[] = ['ollama'] // all local names -export const nonlocalProviderNames = providerNames.filter((name) => !localProviderNames.includes(name)) // all non-local names +export const localProviderNames = ['ollama', 'openAICompatible'] satisfies ProviderName[] // all local names +export const nonlocalProviderNames = providerNames.filter((name) => !(localProviderNames as string[]).includes(name)) // all non-local names type CustomSettingName = UnionOfKeys type CustomProviderSettings = { @@ -379,7 +379,7 @@ export const featureNames = ['Ctrl+L', 'Ctrl+K', 'Autocomplete'] as const // the models of these can be refreshed (in theory all can, but not all should) -export const refreshableProviderNames = ['ollama', 'openAICompatible'] satisfies ProviderName[] +export const refreshableProviderNames = localProviderNames export type RefreshableProviderName = typeof refreshableProviderNames[number] @@ -405,7 +405,7 @@ type FeatureFlagDisplayInfo = { export const displayInfoOfFeatureFlag = (featureFlag: FeatureFlagName): FeatureFlagDisplayInfo => { if (featureFlag === 'autoRefreshModels') { return { - description: `Automatically detect local providers and models (like Ollama).`, // ${`refreshableProviderNames.map(providerName => titleOfProviderName(providerName)).join(', ')`} + description: `Automatically detect local providers and models (${refreshableProviderNames.map(providerName => displayInfoOfProviderName(providerName).title).join(', ')}).`, } } throw new Error(`featureFlagInfo: Unknown feature flag: "${featureFlag}"`) diff --git a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts index da288609..a1c7fd65 100644 --- a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts +++ b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts @@ -117,7 +117,7 @@ type CtrlKZone = { editorId: string; // the editor the input lives on _mountInfo: null | { - inputBox: InputBox | null; // the input box that lives in the zone + inputBoxRef: { current: InputBox | null }; // the input box that lives in the zone dispose: () => void; refresh: () => void; } @@ -329,7 +329,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { let zoneId: string | null = null let viewZone_: IViewZone | null = null - let inputBox_: InputBox | null = null + const inputBoxRef: { current: InputBox | null } = { current: null } const itemId = this._consistentEditorItemService.addToEditor(editor, () => { const domNode = document.createElement('div'); @@ -352,7 +352,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { mountCtrlK(domNode, accessor, { diffareaid: ctrlKZone.diffareaid, onGetInputBox: (inputBox) => { - inputBox_ = inputBox + inputBoxRef.current = inputBox // if it's mounting for the first time, focus it if (!(ctrlKZone.diffareaid in this.mostRecentTextOfCtrlKZoneId)) { // detect first mount this way (a hack) this.mostRecentTextOfCtrlKZoneId[ctrlKZone.diffareaid] = undefined @@ -381,10 +381,8 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { }) }) - - return { - inputBox: inputBox_, + inputBoxRef, refresh: () => editor.changeViewZones(accessor => { if (zoneId && viewZone_) { viewZone_.afterLineNumber = ctrlKZone.startLine - 1 @@ -394,7 +392,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { dispose: () => { this._consistentEditorItemService.removeFromEditor(itemId) }, - } + } satisfies CtrlKZone['_mountInfo'] } @@ -405,6 +403,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { if (diffArea.type !== 'CtrlKZone') continue if (!diffArea._mountInfo) { diffArea._mountInfo = this._addCtrlKZoneInput(diffArea) + console.log('MOUNTED', diffArea.diffareaid) } else { diffArea._mountInfo.refresh() @@ -887,7 +886,7 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { if (diffArea.type !== 'CtrlKZone') continue const noOverlap = diffArea.startLine > endLine || diffArea.endLine < startLine if (!noOverlap) { - setTimeout(() => diffArea._mountInfo?.inputBox?.focus(), 0) + setTimeout(() => diffArea._mountInfo?.inputBoxRef.current?.focus(), 0) return } } @@ -943,6 +942,8 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { let uri: URI let userMessage: string + console.log('AA') + if (featureName === 'Ctrl+L') { const uri_ = this._getActiveEditorURI() @@ -983,14 +984,13 @@ class InlineDiffsService extends Disposable implements IInlineDiffsService { startLine = startLine_ endLine = endLine_ - if (!_mountInfo?.inputBox) return - userMessage = _mountInfo.inputBox?.value + if (!_mountInfo?.inputBoxRef.current) return + userMessage = _mountInfo.inputBoxRef.current?.value } else { throw new Error(`Void: diff.type not recognized on: ${featureName}`) } - const currentFileStr = this._readURI(uri) if (currentFileStr === null) return const originalCode = currentFileStr.split('\n').slice((startLine - 1), (endLine - 1) + 1).join('\n') 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 62fd2450..cc935cc3 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 @@ -420,13 +420,12 @@ export const Settings = () => {

Local Providers

{/*

{`Keep your data private by hosting AI locally on your computer.`}

*/} {/*

{`Instructions:`}

*/} -

{`Void can access any model that you host locally.`}

-
-

-

-

-

-

+

{`Void can access any model that you host locally. By default, we automatically detect your local models.`}

+
+

+

+

+

{/* TODO we should create UI for downloading models without user going into terminal */}
@@ -435,7 +434,7 @@ export const Settings = () => {

More Providers

-

{`Void can also access models like ChatGPT and Claude. We recommend using Anthropic or OpenAI.`}

+

{`Void can also access models like ChatGPT and Claude. We recommend using Anthropic or OpenAI.`}

{/*

{`Access models like ChatGPT and Claude. We recommend using Anthropic or OpenAI as providers, or Groq as a faster alternative.`}

*/}