Commit 0ef46ab
committed
🤖 fix: use cumulative token usage for auto-compaction check
Previous implementation only checked last message tokens against context window,
effectively disabling auto-compaction unless a single response exceeded 70%.
Now uses WorkspaceUsageState.totalTokens for cumulative conversation tracking.
- Remove lastUsage extraction and manual token calculation
- Use pre-calculated totalTokens from WorkspaceStore
- Simplifies code by ~20 lines
- Auto-compaction now correctly triggers at 70% cumulative usage1 parent 75bea13 commit 0ef46ab
File tree
2 files changed
+4
-22
lines changed- src/browser/utils
- compaction
2 files changed
+4
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 63 | | |
74 | 64 | | |
75 | 65 | | |
| |||
83 | 73 | | |
84 | 74 | | |
85 | 75 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 76 | + | |
| 77 | + | |
96 | 78 | | |
97 | 79 | | |
98 | 80 | | |
| |||
0 commit comments