mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 14:15:56 +00:00
fix(install): preserve Claude model preferences in sonnet profile
- add smart filtering to remove GLM vars but keep Claude models - remove ANTHROPIC_DEFAULT_* only if value is GLM (e.g. 'glm-4.6') - preserve ANTHROPIC_DEFAULT_* if value contains 'claude' (user preference) - add null safety with tostring? // "" - add case-insensitive matching with ascii_downcase - add explanatory comments for filter logic Fixes bug where sonnet.settings.json incorrectly had GLM model overrides
This commit is contained in:
1 parent
df464e0296
commit
5227c0b28d
1 file changed
+8
@@ -141,7 +141,15 @@ create_sonnet_profile() {
|
||||
else
|
||||
echo "Creating Claude Sonnet profile template at $sonnet_settings"
|
||||
if [[ -f "$current_settings" ]] && command -v jq &> /dev/null; then
|
||||
# Remove GLM-specific vars, but keep ANTHROPIC_DEFAULT_* if they contain "claude" (user preference)
|
||||
# Filter logic assumes Claude model IDs contain "claude" substring (case-insensitive)
|
||||
if jq 'del(.env.ANTHROPIC_BASE_URL, .env.ANTHROPIC_AUTH_TOKEN, .env.ANTHROPIC_MODEL) |
|
||||
.env |= with_entries(
|
||||
select(
|
||||
(.key | IN("ANTHROPIC_DEFAULT_OPUS_MODEL", "ANTHROPIC_DEFAULT_SONNET_MODEL", "ANTHROPIC_DEFAULT_HAIKU_MODEL") | not) or
|
||||
(.value | tostring? // "" | ascii_downcase | contains("claude"))
|
||||
)
|
||||
) |
|
||||
if (.env | length) == 0 then .env = {} else . end' "$current_settings" > "$sonnet_settings.tmp" 2>/dev/null; then
|
||||
atomic_mv "$sonnet_settings.tmp" "$sonnet_settings"
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user