mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
separate out thinking by feature
This commit is contained in:
parent
1d9e0faaa3
commit
3c93e0a414
6 changed files with 47 additions and 25 deletions
|
|
@ -793,7 +793,7 @@ export class AutocompleteService extends Disposable implements IAutocompleteServ
|
|||
|
||||
const featureName: FeatureName = 'Autocomplete'
|
||||
const modelSelection = this._settingsService.state.modelSelectionOfFeature[featureName]
|
||||
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName] : undefined
|
||||
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[featureName][modelSelection.providerName]?.[modelSelection.modelName] : undefined
|
||||
|
||||
|
||||
// set parameters of `newAutocompletion` appropriately
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import { INotificationService, Severity } from '../../../../platform/notificatio
|
|||
import { IModelService } from '../../../../editor/common/services/model.js';
|
||||
import { IDirectoryStrService } from './directoryStrService.js';
|
||||
import { truncate } from '../../../../base/common/strings.js';
|
||||
import { THREAD_STORAGE_KEY } from '../common/storageKeys.js';
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -155,10 +156,6 @@ const newThreadObject = () => {
|
|||
}
|
||||
|
||||
|
||||
// past values:
|
||||
// 'void.chatThreadStorage'
|
||||
|
||||
export const THREAD_STORAGE_KEY = 'void.chatThreadStorageI'
|
||||
|
||||
|
||||
|
||||
|
|
@ -455,7 +452,7 @@ class ChatThreadService extends Disposable implements IChatThreadService {
|
|||
// these settings should not change throughout the loop (eg anthropic breaks if you change its thinking mode and it's using tools)
|
||||
const featureName: FeatureName = 'Chat'
|
||||
const modelSelection = this._settingsService.state.modelSelectionOfFeature[featureName]
|
||||
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName] : undefined
|
||||
const modelSelectionOptions = modelSelection ? this._settingsService.state.optionsOfModelSelection[featureName][modelSelection.providerName]?.[modelSelection.modelName] : undefined
|
||||
return { modelSelection, modelSelectionOptions }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ const ReasoningOptionSlider = ({ featureName }: { featureName: FeatureName }) =>
|
|||
const { reasoningCapabilities } = getModelCapabilities(providerName, modelName)
|
||||
const { canTurnOffReasoning, reasoningBudgetSlider } = reasoningCapabilities || {}
|
||||
|
||||
const modelSelectionOptions = voidSettingsState.optionsOfModelSelection[providerName]?.[modelName]
|
||||
const modelSelectionOptions = voidSettingsState.optionsOfModelSelection[featureName][providerName]?.[modelName]
|
||||
const isReasoningEnabled = getIsResoningEnabledState(providerName, modelName, modelSelectionOptions)
|
||||
if (canTurnOffReasoning && !reasoningBudgetSlider) { // if it's just a on/off toggle without a power slider (no models right now)
|
||||
return null // unused right now
|
||||
|
|
@ -174,7 +174,7 @@ const ReasoningOptionSlider = ({ featureName }: { featureName: FeatureName }) =>
|
|||
if (reasoningBudgetSlider?.type === 'slider') { // if it's a slider
|
||||
const { min: min_, max, default: defaultVal } = reasoningBudgetSlider
|
||||
|
||||
const value = voidSettingsState.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName]?.reasoningBudget ?? defaultVal
|
||||
const value = voidSettingsState.optionsOfModelSelection[featureName][modelSelection.providerName]?.[modelSelection.modelName]?.reasoningBudget ?? defaultVal
|
||||
|
||||
const nSteps = 8 // only used in calculating stepSize, stepSize is what actually matters
|
||||
const stepSize = Math.round((max - min_) / nSteps)
|
||||
|
|
@ -191,7 +191,7 @@ const ReasoningOptionSlider = ({ featureName }: { featureName: FeatureName }) =>
|
|||
value={value}
|
||||
onChange={(newVal) => {
|
||||
const disabled = newVal === min && canTurnOffReasoning
|
||||
voidSettingsService.setOptionsOfModelSelection(modelSelection.providerName, modelSelection.modelName, { reasoningEnabled: !disabled, reasoningBudget: newVal })
|
||||
voidSettingsService.setOptionsOfModelSelection(featureName, modelSelection.providerName, modelSelection.modelName, { reasoningEnabled: !disabled, reasoningBudget: newVal })
|
||||
}}
|
||||
/>
|
||||
<span className='text-void-fg-3 text-xs pointer-events-none'>{isReasoningEnabled ? `${value} tokens` : 'Thinking disabled'}</span>
|
||||
|
|
|
|||
19
src/vs/workbench/contrib/void/common/storageKeys.ts
Normal file
19
src/vs/workbench/contrib/void/common/storageKeys.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/*--------------------------------------------------------------------------------------
|
||||
* Copyright 2025 Glass Devtools, Inc. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0. See LICENSE.txt for more information.
|
||||
*--------------------------------------------------------------------------------------*/
|
||||
|
||||
// past values:
|
||||
// 'void.settingsServiceStorage'
|
||||
// 'void.settingsServiceStorageI' // 1.0.2
|
||||
|
||||
// 1.0.3
|
||||
export const VOID_SETTINGS_STORAGE_KEY = 'void.settingsServiceStorageII'
|
||||
|
||||
|
||||
// past values:
|
||||
// 'void.chatThreadStorage'
|
||||
// 'void.chatThreadStorageI' // 1.0.2
|
||||
|
||||
// 1.0.3
|
||||
export const THREAD_STORAGE_KEY = 'void.chatThreadStorageII'
|
||||
|
|
@ -12,13 +12,9 @@ import { createDecorator } from '../../../../platform/instantiation/common/insta
|
|||
import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js';
|
||||
import { IMetricsService } from './metricsService.js';
|
||||
import { getModelCapabilities } from './modelCapabilities.js';
|
||||
import { VOID_SETTINGS_STORAGE_KEY } from './storageKeys.js';
|
||||
import { defaultSettingsOfProvider, FeatureName, ProviderName, ModelSelectionOfFeature, SettingsOfProvider, SettingName, providerNames, ModelSelection, modelSelectionsEqual, featureNames, VoidModelInfo, GlobalSettings, GlobalSettingName, defaultGlobalSettings, defaultProviderSettings, ModelSelectionOptions, OptionsOfModelSelection, ChatMode } from './voidSettingsTypes.js';
|
||||
|
||||
// past values:
|
||||
// 'void.settingsServiceStorage'
|
||||
|
||||
const STORAGE_KEY = 'void.settingsServiceStorageI'
|
||||
|
||||
|
||||
// name is the name in the dropdown
|
||||
export type ModelOption = { name: string, selection: ModelSelection }
|
||||
|
|
@ -38,7 +34,7 @@ type SetModelSelectionOfFeatureFn = <K extends FeatureName>(
|
|||
|
||||
type SetGlobalSettingFn = <T extends GlobalSettingName>(settingName: T, newVal: GlobalSettings[T]) => void;
|
||||
|
||||
type SetOptionsOfModelSelection = (providerName: ProviderName, modelName: string, newVal: Partial<ModelSelectionOptions>) => void
|
||||
type SetOptionsOfModelSelection = (featureName: FeatureName, providerName: ProviderName, modelName: string, newVal: Partial<ModelSelectionOptions>) => void
|
||||
|
||||
|
||||
export type VoidSettingsState = {
|
||||
|
|
@ -177,7 +173,7 @@ const defaultState = () => {
|
|||
settingsOfProvider: deepClone(defaultSettingsOfProvider),
|
||||
modelSelectionOfFeature: { 'Chat': null, 'Ctrl+K': null, 'Autocomplete': null, 'Apply': null },
|
||||
globalSettings: deepClone(defaultGlobalSettings),
|
||||
optionsOfModelSelection: {},
|
||||
optionsOfModelSelection: { 'Chat': {}, 'Ctrl+K': {}, 'Autocomplete': {}, 'Apply': {} },
|
||||
_modelOptions: [], // computed later
|
||||
}
|
||||
return d
|
||||
|
|
@ -227,7 +223,7 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService {
|
|||
|
||||
|
||||
private async _readState(): Promise<VoidSettingsState> {
|
||||
const encryptedState = this._storageService.get(STORAGE_KEY, StorageScope.APPLICATION)
|
||||
const encryptedState = this._storageService.get(VOID_SETTINGS_STORAGE_KEY, StorageScope.APPLICATION)
|
||||
|
||||
if (!encryptedState)
|
||||
return defaultState()
|
||||
|
|
@ -240,7 +236,7 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService {
|
|||
private async _storeState() {
|
||||
const state = this.state
|
||||
const encryptedState = await this._encryptionService.encrypt(JSON.stringify(state))
|
||||
this._storageService.store(STORAGE_KEY, encryptedState, StorageScope.APPLICATION, StorageTarget.USER);
|
||||
this._storageService.store(VOID_SETTINGS_STORAGE_KEY, encryptedState, StorageScope.APPLICATION, StorageTarget.USER);
|
||||
}
|
||||
|
||||
setSettingOfProvider: SetSettingOfProviderFn = async (providerName, settingName, newVal) => {
|
||||
|
|
@ -318,16 +314,19 @@ class VoidSettingsService extends Disposable implements IVoidSettingsService {
|
|||
}
|
||||
|
||||
|
||||
setOptionsOfModelSelection = async (providerName: ProviderName, modelName: string, newVal: Partial<ModelSelectionOptions>) => {
|
||||
setOptionsOfModelSelection = async (featureName: FeatureName, providerName: ProviderName, modelName: string, newVal: Partial<ModelSelectionOptions>) => {
|
||||
const newState: VoidSettingsState = {
|
||||
...this.state,
|
||||
optionsOfModelSelection: {
|
||||
...this.state.optionsOfModelSelection,
|
||||
[providerName]: {
|
||||
...this.state.optionsOfModelSelection[providerName],
|
||||
[modelName]: {
|
||||
...this.state.optionsOfModelSelection[providerName]?.[modelName],
|
||||
...newVal
|
||||
[featureName]: {
|
||||
...this.state.optionsOfModelSelection[featureName],
|
||||
[providerName]: {
|
||||
...this.state.optionsOfModelSelection[featureName][providerName],
|
||||
[modelName]: {
|
||||
...this.state.optionsOfModelSelection[featureName][providerName]?.[modelName],
|
||||
...newVal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,4 +420,11 @@ export type ModelSelectionOptions = {
|
|||
reasoningBudget?: number;
|
||||
}
|
||||
|
||||
export type OptionsOfModelSelection = Partial<{ [providerName in ProviderName]: { [modelName: string]: ModelSelectionOptions | undefined } }>
|
||||
export type OptionsOfModelSelection = {
|
||||
[featureName in FeatureName]: Partial<{
|
||||
[providerName in ProviderName]: {
|
||||
[modelName: string]:
|
||||
ModelSelectionOptions | undefined
|
||||
}
|
||||
}>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue