diff --git a/src/vs/workbench/contrib/void/browser/editCodeService.ts b/src/vs/workbench/contrib/void/browser/editCodeService.ts index ffae89c7..ad8fa505 100644 --- a/src/vs/workbench/contrib/void/browser/editCodeService.ts +++ b/src/vs/workbench/contrib/void/browser/editCodeService.ts @@ -1596,15 +1596,6 @@ class EditCodeService extends Disposable implements IEditCodeService { latestStreamLocationMutable = { line: startLine, addedSplitYet: false, col: 1, originalCodeStartLine: 1 } } // <-- done adding diffarea - // if a block is done, finish it by writing all - if (block.state === 'done') { - const { startLine: finalStartLine, endLine: finalEndLine } = addedDiffAreaOfBlockNum[blockNum] - this._writeText(uri, block.final, - { startLineNumber: finalStartLine, startColumn: 1, endLineNumber: finalEndLine, endColumn: Number.MAX_SAFE_INTEGER }, // 1-indexed - { shouldRealignDiffAreas: true } - ) - currStreamingBlockNum = blockNum + 1 - } // should always be in streaming state here if (!diffZone._streamState.isStreaming) { @@ -1613,17 +1604,25 @@ class EditCodeService extends Disposable implements IEditCodeService { } if (!latestStreamLocationMutable) continue + // if a block is done, finish it by writing all + if (block.state === 'done') { + const { startLine: finalStartLine, endLine: finalEndLine } = addedDiffAreaOfBlockNum[blockNum] + this._writeText(uri, block.final, + { startLineNumber: finalStartLine, startColumn: 1, endLineNumber: finalEndLine, endColumn: Number.MAX_SAFE_INTEGER }, // 1-indexed + { shouldRealignDiffAreas: true } + ) + diffZone._streamState.line = finalEndLine + 1 + currStreamingBlockNum = blockNum + 1 + continue + } // write the added text to the file const deltaFinalText = block.final.substring((oldBlocks[blockNum]?.final ?? '').length, Infinity) this._writeStreamedDiffZoneLLMText(uri, block.orig, block.final, deltaFinalText, latestStreamLocationMutable) - oldBlocks = blocks + oldBlocks = blocks // oldblocks is only used if writingFinal - // update stream line if it's still streaming (otherwise another block might be streaming) - if (block.state !== 'done') { - const { endLine: currentEndLine } = addedDiffAreaOfBlockNum[blockNum] - diffZone._streamState.line = currentEndLine - } + const { endLine: currentEndLine } = addedDiffAreaOfBlockNum[blockNum] + diffZone._streamState.line = currentEndLine } // end for 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 e62e7a9e..270870a7 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 @@ -152,12 +152,13 @@ export const VoidInputBox2 = forwardRef(fun }) -export const VoidInputBox = ({ onChangeText, onCreateInstance, inputBoxRef, placeholder, multiline }: { +export const VoidInputBox = ({ onChangeText, onCreateInstance, inputBoxRef, placeholder, isPasswordField, multiline }: { onChangeText: (value: string) => void; styles?: Partial, onCreateInstance?: (instance: InputBox) => void | IDisposable[]; inputBoxRef?: { current: InputBox | null }; placeholder: string; + isPasswordField?: boolean; multiline: boolean; }) => { @@ -182,6 +183,7 @@ export const VoidInputBox = ({ onChangeText, onCreateInstance, inputBoxRef, plac }, placeholder, tooltip: '', + type: isPasswordField ? 'password' : undefined, flexibleHeight: multiline, flexibleMaxHeight: 500, flexibleWidth: false, 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 fd612c43..a6aec380 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 @@ -21,7 +21,7 @@ import { os } from '../../../helpers/systemInfo.js' const SubtleButton = ({ onClick, text, icon, disabled }: { onClick: () => void, text: string, icon: React.ReactNode, disabled: boolean }) => { - return
+ return
@@ -82,9 +82,7 @@ const RefreshableModels = () => { const buttons = refreshableProviderNames.map(providerName => { if (!settingsState.settingsOfProvider[providerName]._didFillInProviderSettings) return null - return
- -
+ return }) return <> @@ -257,7 +255,7 @@ const ProviderSetting = ({ providerName, settingName }: { providerName: Provider // const { title: providerTitle, } = displayInfoOfProviderName(providerName) - const { title: settingTitle, placeholder, subTextMd } = displayInfoOfSettingName(providerName, settingName) + const { title: settingTitle, placeholder, isPasswordField, subTextMd } = displayInfoOfSettingName(providerName, settingName) const accessor = useAccessor() const voidSettingsService = accessor.get('IVoidSettingsService') @@ -269,6 +267,7 @@ const ProviderSetting = ({ providerName, settingName }: { providerName: Provider { if (weChangedTextRef) return voidSettingsService.setSettingOfProvider(providerName, settingName, newVal) @@ -291,6 +290,7 @@ const ProviderSetting = ({ providerName, settingName }: { providerName: Provider return [disposable] }, [voidSettingsService, providerName, settingName])} multiline={false} + isPasswordField={isPasswordField} /> {subTextMd === undefined ? null :
@@ -339,7 +339,7 @@ const SettingsForProvider = ({ providerName }: { providerName: ProviderName }) = {needsModel ? providerName === 'ollama' ? - : + : : null}
@@ -368,15 +368,16 @@ export const AutoRefreshToggle = () => { // right now this is just `enabled_autoRefreshModels` const enabled = voidSettingsState.globalSettings[settingName] - return { - voidSettingsService.setGlobalSetting(settingName, !enabled) - metricsService.capture('Click', { action: 'Autorefresh Toggle', settingName, enabled: !enabled }) - }} - text={`Automatically detect local providers and models (${refreshableProviderNames.map(providerName => displayInfoOfProviderName(providerName).title).join(', ')}).`} - icon={enabled ? : } - disabled={false} - /> + return { + voidSettingsService.setGlobalSetting(settingName, !enabled) + metricsService.capture('Click', { action: 'Autorefresh Toggle', settingName, enabled: !enabled }) + }} + text={`Automatically detect local providers and models (${refreshableProviderNames.map(providerName => displayInfoOfProviderName(providerName).title).join(', ')}).`} + icon={enabled ? : } + disabled={false} + /> + } export const AIInstructionsBox = () => { @@ -400,6 +401,7 @@ export const FeaturesTab = () => { +
diff --git a/src/vs/workbench/contrib/void/common/toolsService.ts b/src/vs/workbench/contrib/void/common/toolsService.ts index 9686920f..522f17c5 100644 --- a/src/vs/workbench/contrib/void/common/toolsService.ts +++ b/src/vs/workbench/contrib/void/common/toolsService.ts @@ -68,6 +68,18 @@ export const voidTools = { required: ['query'], }, + // go_to_definition: + + // go_to_usages: + + // create_file: { + // name: 'create_file', + // description: `Creates a file at the given path. Fails gracefully if the file already exists by doing nothing.` + // params: { + // uri: { type: 'string', description: undefined }, + // } + // } + // semantic_search: { // description: 'Searches files semantically for the given string query.', // // RAG @@ -86,6 +98,7 @@ export type ToolCallReturnType : T extends 'list_dir' ? string : T extends 'pathname_search' ? string | URI[] : T extends 'search' ? string | URI[] + : T extends 'create_file' ? string : never export type ToolFns = { [T in ToolName]: (p: string) => Promise<[ToolCallReturnType, boolean]> } diff --git a/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts b/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts index 06e708fd..96337d33 100644 --- a/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts +++ b/src/vs/workbench/contrib/void/common/voidSettingsTypes.ts @@ -505,9 +505,10 @@ export const displayInfoOfProviderName = (providerName: ProviderName): DisplayIn } type DisplayInfo = { - title: string, - placeholder: string, - subTextMd?: string, + title: string; + placeholder: string; + subTextMd?: string; + isPasswordField?: boolean; } export const displayInfoOfSettingName = (providerName: ProviderName, settingName: SettingName): DisplayInfo => { if (settingName === 'apiKey') { @@ -537,6 +538,7 @@ export const displayInfoOfSettingName = (providerName: ProviderName, settingName providerName === 'xAI' ? 'Get your [API Key here](https://console.x.ai).' : providerName === 'openAICompatible' ? undefined : '', + isPasswordField: true, } } else if (settingName === 'endpoint') { diff --git a/src/vs/workbench/contrib/void/electron-main/llmMessage/openai.ts b/src/vs/workbench/contrib/void/electron-main/llmMessage/openai.ts index 66c0ffe1..37b8b468 100644 --- a/src/vs/workbench/contrib/void/electron-main/llmMessage/openai.ts +++ b/src/vs/workbench/contrib/void/electron-main/llmMessage/openai.ts @@ -201,6 +201,7 @@ export const sendOpenAIChat: _InternalSendLLMChatMessageFnType = ({ messages: me // message let newText = '' newText += chunk.choices[0]?.delta?.content ?? '' + console.log('!!!!', chunk.choices[0]?.delta) fullText += newText; onText({ newText, fullText });