MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / setProviderSettings

Method setProviderSettings

src/core/config/ContextProxy.ts:510–532  ·  view source on GitHub ↗
(values: ProviderSettings)

Source from the content-addressed store, hash-verified

508 }
509
510 public async setProviderSettings(values: ProviderSettings) {
511 // Explicitly clear out any old API configuration values before that
512 // might not be present in the new configuration.
513 // If a value is not present in the new configuration, then it is assumed
514 // that the setting's value should be `undefined` and therefore we
515 // need to remove it from the state cache if it exists.
516
517 // Ensure openAiHeaders is always an object even when empty
518 // This is critical for proper serialization/deserialization through IPC
519 if (values.openAiHeaders !== undefined) {
520 // Check if it's empty or null
521 if (!values.openAiHeaders || Object.keys(values.openAiHeaders).length === 0) {
522 values.openAiHeaders = {}
523 }
524 }
525
526 await this.setValues({
527 ...PROVIDER_SETTINGS_KEYS.filter((key) => !isSecretStateKey(key))
528 .filter((key) => !!this.stateCache[key])
529 .reduce((acc, key) => ({ ...acc, [key]: undefined }), {} as ProviderSettings),
530 ...values,
531 })
532 }
533
534 /**
535 * RooCodeSettings

Callers 4

upsertProviderProfileMethod · 0.80
importSettingsFromPathFunction · 0.80

Calls 3

setValuesMethod · 0.95
isSecretStateKeyFunction · 0.90
keysMethod · 0.65

Tested by

no test coverage detected