fix: deploy cleans stale kimi/moonshot config from server
The server's config.json and .env persist old moonshot/kimi values across deploys. Even though env.Parse() overrides these at runtime, stale config causes confusion. This commit: - Removes old PICOCLAW_PROVIDERS_ZHIPU/MOONSHOT env vars from .env - Force-updates config.json model/provider if they still reference kimi or moonshot https://claude.ai/code/session_01MYemTMPtHrcgidWs8UdjcG
This commit is contained in:
parent
16db87983b
commit
08ace1c8b3
1 changed files with 26 additions and 0 deletions
26
.github/workflows/deploy-hostinger.yml
vendored
26
.github/workflows/deploy-hostinger.yml
vendored
|
|
@ -118,6 +118,13 @@ jobs:
|
||||||
echo "WARNING: PICOCLAW_ZAI_API_KEY secret is empty"
|
echo "WARNING: PICOCLAW_ZAI_API_KEY secret is empty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove stale moonshot/zhipu env vars that conflict with Z.ai migration
|
||||||
|
for old_key in PICOCLAW_PROVIDERS_ZHIPU_API_KEY PICOCLAW_PROVIDERS_ZHIPU_API_BASE \
|
||||||
|
PICOCLAW_PROVIDERS_MOONSHOT_API_KEY PICOCLAW_PROVIDERS_MOONSHOT_API_BASE \
|
||||||
|
PICOCLAW_ZHIPU_API_KEY PICOCLAW_MOONSHOT_API_KEY; do
|
||||||
|
sed -i "/^\${old_key}=/d" "\$ENV_FILE" 2>/dev/null || true
|
||||||
|
done
|
||||||
|
|
||||||
# Create config.json if it doesn't exist (copy from example)
|
# Create config.json if it doesn't exist (copy from example)
|
||||||
if [ ! -f "\$CONFIG_FILE" ]; then
|
if [ ! -f "\$CONFIG_FILE" ]; then
|
||||||
if [ -f "/opt/picoclaw/src/config/config.example.json" ]; then
|
if [ -f "/opt/picoclaw/src/config/config.example.json" ]; then
|
||||||
|
|
@ -126,6 +133,25 @@ jobs:
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Force-update model and provider in existing config.json to prevent
|
||||||
|
# stale kimi/moonshot values from persisting across deploys.
|
||||||
|
# env.Parse() overrides these at runtime, but keeping config.json
|
||||||
|
# consistent avoids confusion when debugging.
|
||||||
|
if [ -f "\$CONFIG_FILE" ]; then
|
||||||
|
# Update model if it still references kimi/moonshot
|
||||||
|
if grep -q '"model".*kimi\|"model".*moonshot' "\$CONFIG_FILE" 2>/dev/null; then
|
||||||
|
sed -i 's/"model"[[:space:]]*:[[:space:]]*"[^"]*kimi[^"]*"/"model": "glm-4.7"/' "\$CONFIG_FILE"
|
||||||
|
sed -i 's/"model"[[:space:]]*:[[:space:]]*"[^"]*moonshot[^"]*"/"model": "glm-4.7"/' "\$CONFIG_FILE"
|
||||||
|
echo "Updated config.json: replaced kimi/moonshot model with glm-4.7"
|
||||||
|
fi
|
||||||
|
# Update provider if it still references zhipu/moonshot
|
||||||
|
if grep -q '"provider".*zhipu\|"provider".*moonshot' "\$CONFIG_FILE" 2>/dev/null; then
|
||||||
|
sed -i 's/"provider"[[:space:]]*:[[:space:]]*"zhipu"/"provider": "zai"/' "\$CONFIG_FILE"
|
||||||
|
sed -i 's/"provider"[[:space:]]*:[[:space:]]*"moonshot"/"provider": "zai"/' "\$CONFIG_FILE"
|
||||||
|
echo "Updated config.json: replaced zhipu/moonshot provider with zai"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify critical config
|
# Verify critical config
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Deploy Config Verification ==="
|
echo "=== Deploy Config Verification ==="
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue