(values: ProviderSettings)
| 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 |
no test coverage detected