mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
docs: guard division by zero in script example
Add size > 0 check before computing context percentage to prevent division by zero when context_window_size is unavailable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
12e1ef4594
commit
813d863e7c
1 changed files with 1 additions and 1 deletions
|
|
@ -135,7 +135,7 @@ branch=$(git branch --show-current 2>/dev/null)
|
|||
parts=()
|
||||
[ -n "$model" ] && parts+=("$model")
|
||||
[ -n "$branch" ] && parts+=("($branch)")
|
||||
if [ "$tokens" -gt 0 ] 2>/dev/null; then
|
||||
if [ "$tokens" -gt 0 ] && [ "$size" -gt 0 ] 2>/dev/null; then
|
||||
pct=$((tokens * 100 / size))
|
||||
parts+=("ctx:${pct}%")
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue