# Fish LLM/CC Environment Switch - {{env_name}}
# Generated by fnva

{{#if config.anthropic_auth_token}}
# Anthropic/GLM-CC environment
set -gx ANTHROPIC_AUTH_TOKEN "{{config.anthropic_auth_token}}"
{{/if}}

{{#if config.anthropic_base_url}}
set -gx ANTHROPIC_BASE_URL "{{config.anthropic_base_url}}"
{{/if}}

{{#if config.default_model}}
set -gx ANTHROPIC_DEFAULT_SONNET_MODEL "{{config.default_model}}"
{{/if}}

{{#if config.api_key}}
set -gx OPENAI_API_KEY "{{config.api_key}}"
{{/if}}

{{#if config.openai_base_url}}
set -gx OPENAI_API_BASE "{{config.openai_base_url}}"
{{/if}}

{{#if config.base_url}}
set -gx OPENAI_API_BASE "{{config.base_url}}"
{{/if}}

{{#if config.model}}
set -gx OPENAI_MODEL "{{config.model}}"
{{/if}}

{{#if config.temperature}}
set -gx OPENAI_TEMPERATURE "{{config.temperature}}"
{{/if}}

{{#if config.max_tokens}}
set -gx OPENAI_MAX_TOKENS "{{config.max_tokens}}"
{{/if}}

# Set fnva environment tracking
set -gx FNVA_CURRENT_{{#if (eq env_type "Cc")}}CC{{else}}LLM{{/if}} "{{env_name}}"
set -gx FNVA_ENV_TYPE "{{#if (eq env_type "Cc")}}CC{{else}}LLM{{/if}}"

# Claude Code specific settings
{{#if config.anthropic_auth_token}}
set -gx CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC "1"
set -gx API_TIMEOUT_MS "30000"
{{/if}}

# Verify the switch
echo "✅ Switched to {{#if (eq env_type "Cc")}}Claude Code (CC){{else}}LLM{{/if}} environment: {{env_name}}"

{{#if config.anthropic_auth_token}}
echo "🔑 Anthropic Auth Token: ✓"
{{/if}}

{{#if config.anthropic_base_url}}
echo "🌐 Base URL: {{config.anthropic_base_url}}"
{{/if}}

{{#if config.default_model}}
echo "🤖 Default Model: {{config.default_model}}"
{{/if}}

# Add to command history
echo "fnva {{#if (eq env_type "Cc")}}cc{{else}}llm{{/if}} use {{env_name}}" >> ~/.fnva/history 2>/dev/null || true