feat: брендовые цвета имён моделей, персистентность model между сессиями
- _brand_color: цвет имени модели по AI_LAUNCHER deepseek=синий(69), claude=оранжевый(173), kimi=голубой(81), openrouter=фиолетовый(135), остальные=кремовый(223) - _restore_model / _restore_model_str: сохранение и восстановление model_id в кэше лаунчера (~/.cache/ai-setup/model_<launcher>) - effort-save-hook также сохраняет model_id при завершении сессии - ai-claude/ai-openrouter используют восстановленную модель при старте Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4,17 +4,21 @@
|
||||
launcher="${AI_LAUNCHER:-}"
|
||||
[ -z "$launcher" ] && exit 0
|
||||
cat /dev/stdin > /dev/null 2>&1 # drain stdin (Claude Code передаёт JSON)
|
||||
effort=$(python3 -c "
|
||||
import json, os
|
||||
p = os.path.expanduser('~/.claude/settings.json')
|
||||
if os.path.exists(p):
|
||||
try:
|
||||
d = json.load(open(p))
|
||||
print(d.get('effortLevel', ''))
|
||||
except Exception:
|
||||
pass
|
||||
" 2>/dev/null)
|
||||
[ -z "$effort" ] && exit 0
|
||||
mkdir -p "$HOME/.cache/ai-setup"
|
||||
echo "$effort" > "$HOME/.cache/ai-setup/effort_${launcher}"
|
||||
python3 - "$HOME/.claude/settings.json" "$HOME/.cache/ai-setup" "$launcher" <<'PYEOF'
|
||||
import json, os, sys
|
||||
settings_path, cache_dir, launcher = sys.argv[1], sys.argv[2], sys.argv[3]
|
||||
if not os.path.exists(settings_path):
|
||||
sys.exit(0)
|
||||
try:
|
||||
d = json.load(open(settings_path))
|
||||
except Exception:
|
||||
sys.exit(0)
|
||||
effort = d.get('effortLevel', '')
|
||||
if effort:
|
||||
open(os.path.join(cache_dir, f'effort_{launcher}'), 'w').write(effort)
|
||||
model = d.get('model', '')
|
||||
if model:
|
||||
open(os.path.join(cache_dir, f'model_{launcher}'), 'w').write(model)
|
||||
PYEOF
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user