mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
refactor(experiments): simplify experiment config structure
- Remove redundant id field from ExperimentConfig interface - Update UI components to use experiment keys directly - Improve type safety by using key-based mapping instead of object values
This commit is contained in:
@@ -5,7 +5,7 @@ import { validateApiConfiguration, validateModelId } from "../../utils/validate"
|
||||
import { vscode } from "../../utils/vscode"
|
||||
import ApiOptions from "./ApiOptions"
|
||||
import ExperimentalFeature from "./ExperimentalFeature"
|
||||
import { EXPERIMENT_IDS, experimentConfigsMap } from "../../../../src/shared/experiments"
|
||||
import { EXPERIMENT_IDS, experimentConfigsMap, ExperimentId, ExperimentKey } from "../../../../src/shared/experiments"
|
||||
import ApiConfigManager from "./ApiConfigManager"
|
||||
|
||||
type SettingsViewProps = {
|
||||
@@ -97,6 +97,8 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
apiConfiguration,
|
||||
})
|
||||
|
||||
console.log("Experiments", experiments)
|
||||
|
||||
vscode.postMessage({
|
||||
type: "updateExperimental",
|
||||
values: experiments,
|
||||
@@ -646,14 +648,21 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{Object.values(experimentConfigsMap)
|
||||
.filter((config) => config.id !== EXPERIMENT_IDS.DIFF_STRATEGY)
|
||||
{Object.entries(experimentConfigsMap)
|
||||
.filter((config) => config[0] !== "DIFF_STRATEGY")
|
||||
.map((config) => (
|
||||
<ExperimentalFeature
|
||||
key={config.id}
|
||||
{...config}
|
||||
enabled={experiments[config.id] ?? false}
|
||||
onChange={(enabled) => setExperimentEnabled(config.id, enabled)}
|
||||
key={config[0]}
|
||||
{...config[1]}
|
||||
enabled={
|
||||
experiments[EXPERIMENT_IDS[config[0] as keyof typeof EXPERIMENT_IDS]] ?? false
|
||||
}
|
||||
onChange={(enabled) =>
|
||||
setExperimentEnabled(
|
||||
EXPERIMENT_IDS[config[0] as keyof typeof EXPERIMENT_IDS],
|
||||
enabled,
|
||||
)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user