Unified · Split
| @@ -588,8 +588,9 @@ func SaveConfigPreserveComments(configFile string, cfg *Config) error { · 587 unmodified lines | |||
| 588 | 588 | ||
| 589 | // Remove deprecated auth block before merging to avoid persisting it again. | 589 | // Remove deprecated auth block before merging to avoid persisting it again. |
| 590 | removeMapKey(original.Content[0], "auth") | 590 | removeMapKey(original.Content[0], "auth") |
| 591 | removeLegacyOpenAICompatAPIKeys(original.Content[0]) | ||
| 592 | removeMapKey(original.Content[0], "generative-language-api-key") | 591 | removeMapKey(original.Content[0], "generative-language-api-key") |
| 592 | removeLegacyOpenAICompatAPIKeys(original.Content[0]) | ||
| 593 | removeLegacyAmpKeys(original.Content[0]) | ||
| 593 | pruneMappingToGeneratedKeys(original.Content[0], generated.Content[0], "oauth-excluded-models") | 594 | pruneMappingToGeneratedKeys(original.Content[0], generated.Content[0], "oauth-excluded-models") |
| 594 | 595 | ||
| 595 | // Merge generated into original in-place, preserving comments/order of existing nodes. | 596 | // Merge generated into original in-place, preserving comments/order of existing nodes. |
| @@ -1071,6 +1072,16 @@ func removeLegacyOpenAICompatAPIKeys(root *yaml.Node) { · 475 unmodified lines | |||
| 1071 | } | 1072 | } |
| 1072 | } | 1073 | } |
| 1073 | 1074 | ||
| 1075 | func removeLegacyAmpKeys(root *yaml.Node) { | ||
| 1076 | if root == nil || root.Kind != yaml.MappingNode { | ||
| 1077 | return | ||
| 1078 | } | ||
| 1079 | removeMapKey(root, "amp-upstream-url") | ||
| 1080 | removeMapKey(root, "amp-upstream-api-key") | ||
| 1081 | removeMapKey(root, "amp-restrict-management-to-localhost") | ||
| 1082 | removeMapKey(root, "amp-model-mappings") | ||
| 1083 | } | ||
| 1084 | |||
| 1074 | func pruneMappingToGeneratedKeys(dstRoot, srcRoot *yaml.Node, key string) { | 1085 | func pruneMappingToGeneratedKeys(dstRoot, srcRoot *yaml.Node, key string) { |
| 1075 | if key == "" || dstRoot == nil || srcRoot == nil { | 1086 | if key == "" || dstRoot == nil || srcRoot == nil { |
| 1076 | return | 1087 | return |