fix(deepseek): USD-only balance display, drop CNY/¥
Launcher and statusline show only USD from balance_infos; ¥ removed. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ The custom statusline script renders **only ASCII-safe characters and ANSI color
|
|||||||
|
|
||||||
- ASCII brackets `[ ]` for git branch and effort level
|
- ASCII brackets `[ ]` for git branch and effort level
|
||||||
- ANSI 256-color escape sequences for model names, effort levels, and rate-limit percentages
|
- ANSI 256-color escape sequences for model names, effort levels, and rate-limit percentages
|
||||||
- The `¥` symbol (U+00A5) for CNY balance in DeepSeek output
|
- The `$` symbol for the DeepSeek balance (USD only)
|
||||||
|
|
||||||
It does **not** use Nerd Font glyphs, powerline separators, or emoji.
|
It does **not** use Nerd Font glyphs, powerline separators, or emoji.
|
||||||
|
|
||||||
|
|||||||
@@ -171,13 +171,12 @@ if [[ "$model_id" == *deepseek* ]]; then
|
|||||||
import sys, json
|
import sys, json
|
||||||
d = json.load(sys.stdin)
|
d = json.load(sys.stdin)
|
||||||
infos = d.get('balance_infos', [])
|
infos = d.get('balance_infos', [])
|
||||||
symbols = {'USD': '\$', 'CNY': '\u00a5'}
|
|
||||||
parts = []
|
parts = []
|
||||||
for info in infos:
|
for info in infos:
|
||||||
curr = info.get('currency', '')
|
if info.get('currency', '').upper() != 'USD':
|
||||||
|
continue
|
||||||
total = info.get('total_balance', '0')
|
total = info.get('total_balance', '0')
|
||||||
sym = symbols.get(curr, curr)
|
parts.append(f'\${total}')
|
||||||
parts.append(f'{sym}{total}')
|
|
||||||
if parts:
|
if parts:
|
||||||
print(' '.join(parts))
|
print(' '.join(parts))
|
||||||
" 2>/dev/null)
|
" 2>/dev/null)
|
||||||
|
|||||||
@@ -706,25 +706,24 @@ try:
|
|||||||
d = json.load(sys.stdin)
|
d = json.load(sys.stdin)
|
||||||
available = d.get('is_available', False)
|
available = d.get('is_available', False)
|
||||||
infos = d.get('balance_infos', [])
|
infos = d.get('balance_infos', [])
|
||||||
|
# Показываем только USD (CNY не выводим)
|
||||||
|
infos = [i for i in infos if i.get('currency', '').upper() == 'USD']
|
||||||
if not infos:
|
if not infos:
|
||||||
print(' \033[0;33m[БАЛАНС]\033[0m Нет данных о балансе')
|
print(' \033[0;33m[БАЛАНС]\033[0m Нет данных о балансе')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
symbols = {'USD': '\$', 'CNY': '¥'}
|
|
||||||
cache_parts = []
|
cache_parts = []
|
||||||
for info in infos:
|
for info in infos:
|
||||||
curr = info.get('currency', '???')
|
|
||||||
total = info.get('total_balance', '0')
|
total = info.get('total_balance', '0')
|
||||||
granted = info.get('granted_balance', '0')
|
granted = info.get('granted_balance', '0')
|
||||||
topped_up = info.get('topped_up_balance', '0')
|
topped_up = info.get('topped_up_balance', '0')
|
||||||
sym = symbols.get(curr, curr)
|
|
||||||
status = '✅ доступен' if available else '❌ не активен'
|
status = '✅ доступен' if available else '❌ не активен'
|
||||||
print(f' \033[1;36m💰 Баланс DeepSeek:\033[0m {total} {curr} {status}')
|
print(f' \033[1;36m💰 Баланс DeepSeek:\033[0m \${total} {status}')
|
||||||
if float(granted) > 0:
|
if float(granted) > 0:
|
||||||
print(f' └─ Начислено: {granted} {curr}')
|
print(f' └─ Начислено: \${granted}')
|
||||||
if float(topped_up) > 0:
|
if float(topped_up) > 0:
|
||||||
print(f' └─ Пополнено: {topped_up} {curr}')
|
print(f' └─ Пополнено: \${topped_up}')
|
||||||
cache_parts.append(f'{sym}{total}')
|
cache_parts.append(f'\${total}')
|
||||||
# Cache all currencies with symbols for statusline
|
# Cache USD balance for statusline
|
||||||
if cache_parts:
|
if cache_parts:
|
||||||
cache_dir = os.path.expanduser('~/.cache/ai-setup')
|
cache_dir = os.path.expanduser('~/.cache/ai-setup')
|
||||||
os.makedirs(cache_dir, exist_ok=True)
|
os.makedirs(cache_dir, exist_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user