# PowerShell Claude Code Environment Switch - {{env_name}}
# Generated by fnva

# 设置UTF-8编码以正确显示中文
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [System.Console]::OutputEncoding

{{#if config.anthropic_auth_token}}
# Anthropic/GLM-CC environment
$env:ANTHROPIC_AUTH_TOKEN = "{{config.anthropic_auth_token}}"
{{/if}}

{{#if config.anthropic_base_url}}
$env:ANTHROPIC_BASE_URL = "{{config.anthropic_base_url}}"
{{/if}}

{{#if config.opus_model}}
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "{{config.opus_model}}"
{{/if}}

{{#if config.sonnet_model}}
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "{{config.sonnet_model}}"
{{/if}}

{{#if config.haiku_model}}
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "{{config.haiku_model}}"
{{/if}}

# Set fnva environment tracking
$env:FNVA_CURRENT_CC = "{{env_name}}"
$env:FNVA_ENV_TYPE = "CC"

# Claude Code specific settings
{{#if config.anthropic_auth_token}}
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1"
$env:API_TIMEOUT_MS = "{{config.api_timeout_ms}}"
{{/if}}

{{#if config.api_key}}
$env:OPENAI_API_KEY = "{{config.api_key}}"
{{/if}}

{{#if config.openai_base_url}}
$env:OPENAI_API_BASE = "{{config.openai_base_url}}"
{{/if}}

{{#if config.base_url}}
$env:OPENAI_API_BASE = "{{config.base_url}}"
{{/if}}

{{#if config.model}}
$env:OPENAI_MODEL = "{{config.model}}"
{{/if}}

{{#if config.temperature}}
$env:OPENAI_TEMPERATURE = "{{config.temperature}}"
{{/if}}

{{#if config.max_tokens}}
$env:OPENAI_MAX_TOKENS = "{{config.max_tokens}}"
{{/if}}

# Verify the switch
if (-not $env:_FNVA_QUIET) {
    Write-Host "✓ Switched to CC: {{env_name}}" -ForegroundColor Green
}
