Commit 97fe13d
committed
fix: Prevent context token counter from resetting on failed API calls
- Only update context tokens when both input and output tokens are non-zero
- Keep previous context token count when API calls fail
- Avoid resetting counter on partial or failed responses
This makes the context token counter more resilient against edge cases
and provides more accurate context size tracking during API failures.1 parent e668169 commit 97fe13d
File tree
1 file changed
+4
-1
lines changed1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
0 commit comments