a2d238d92e
Make Zed Agent closer to Cursor: deterministic DevOps path index, live Traefik port probe before blind edits, stop-after-edit, and quieter Russian progress.
42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Switch PRIMARY_PROVIDER and regenerate litellm_config.yaml
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
PROFILE="${1:-}"
|
|
if [[ -z "$PROFILE" ]]; then
|
|
echo "Usage: bash scripts/switch-provider.sh <profile>" >&2
|
|
echo "Profiles:" >&2
|
|
python3 -c "
|
|
import yaml
|
|
from pathlib import Path
|
|
p = yaml.safe_load(Path('config/providers.yaml').read_text(encoding='utf-8'))
|
|
for k, v in sorted(p.get('profiles', {}).items()):
|
|
wc = ' [welcome credit]' if v.get('welcome_credit') else ''
|
|
print(f' {k:12} {v.get(\"label\", \"\")}{wc}')
|
|
"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f .env ]]; then
|
|
echo "ERROR: .env missing — copy from .env.example" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if grep -q '^PRIMARY_PROVIDER=' .env; then
|
|
sed -i "s/^PRIMARY_PROVIDER=.*/PRIMARY_PROVIDER=${PROFILE}/" .env
|
|
else
|
|
echo "PRIMARY_PROVIDER=${PROFILE}" >> .env
|
|
fi
|
|
|
|
set -a
|
|
# shellcheck disable=SC1091
|
|
source .env
|
|
set +a
|
|
|
|
python3 scripts/gen-litellm-config.py
|
|
echo ""
|
|
echo "Switched to PRIMARY_PROVIDER=${PROFILE}"
|
|
echo "Redeploy on IFT: bash scripts/deploy.sh (Swarm configs are immutable — stack rm if deploy fails)"
|