claude-code-tracker 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generate-charts.py +47 -20
package/package.json
CHANGED
package/src/generate-charts.py
CHANGED
|
@@ -204,20 +204,33 @@ tpm_data_js = json.dumps([
|
|
|
204
204
|
if e.get("duration_seconds", 0) > 0 and e.get("output_tokens", 0) > 0
|
|
205
205
|
])
|
|
206
206
|
|
|
207
|
-
#
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
207
|
+
# Prompt length histogram: bucket turns by duration across multiple ranges
|
|
208
|
+
_dur_ranges = {
|
|
209
|
+
"30s": [("0–5s", 0, 5), ("5–10s", 5, 10), ("10–15s", 10, 15),
|
|
210
|
+
("15–20s", 15, 20), ("20–25s", 20, 25), ("25–30s", 25, 30), ("30s+", 30, None)],
|
|
211
|
+
"60s": [("0–10s", 0, 10), ("10–20s", 10, 20), ("20–30s", 20, 30),
|
|
212
|
+
("30–40s", 30, 40), ("40–50s", 40, 50), ("50–60s", 50, 60), ("60s+", 60, None)],
|
|
213
|
+
"30m": [("0–5m", 0, 300), ("5–10m", 300, 600), ("10–15m", 600, 900),
|
|
214
|
+
("15–20m", 900, 1200), ("20–25m", 1200, 1500), ("25–30m", 1500, 1800), ("30m+", 1800, None)],
|
|
215
|
+
"60m": [("0–10m", 0, 600), ("10–20m", 600, 1200), ("20–30m", 1200, 1800),
|
|
216
|
+
("30–40m", 1800, 2400), ("40–50m", 2400, 3000), ("50–60m", 3000, 3600), ("60m+", 3600, None)],
|
|
217
|
+
}
|
|
218
|
+
_dur_all = {}
|
|
219
|
+
for rkey, buckets in _dur_ranges.items():
|
|
220
|
+
counts = {label: 0 for label, _, _ in buckets}
|
|
221
|
+
for e in data:
|
|
222
|
+
d = e.get("duration_seconds", 0)
|
|
223
|
+
if d <= 0:
|
|
224
|
+
continue
|
|
225
|
+
for label, lo, hi in buckets:
|
|
226
|
+
if hi is None or d < hi:
|
|
227
|
+
counts[label] += 1
|
|
228
|
+
break
|
|
229
|
+
_dur_all[rkey] = {
|
|
230
|
+
"labels": [b[0] for b in buckets],
|
|
231
|
+
"values": [counts[b[0]] for b in buckets],
|
|
232
|
+
}
|
|
233
|
+
dur_hist_ranges_js = json.dumps(_dur_all)
|
|
221
234
|
|
|
222
235
|
model_labels_js = json.dumps(list(by_model.keys()))
|
|
223
236
|
model_costs_js = json.dumps([round(by_model[m]["cost"], 4) for m in by_model])
|
|
@@ -433,7 +446,16 @@ html = f"""<!DOCTYPE html>
|
|
|
433
446
|
</div>
|
|
434
447
|
|
|
435
448
|
<div class="card">
|
|
436
|
-
<
|
|
449
|
+
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px">
|
|
450
|
+
<h2 style="margin-bottom:0">Prompt length distribution</h2>
|
|
451
|
+
<select id="durRange" style="background:#0f1521;color:#94a3b8;border:1px solid #2d3748;
|
|
452
|
+
border-radius:6px;padding:4px 8px;font-size:0.75rem;cursor:pointer">
|
|
453
|
+
<option value="30s" selected>0–30s</option>
|
|
454
|
+
<option value="60s">0–60s</option>
|
|
455
|
+
<option value="30m">0–30m</option>
|
|
456
|
+
<option value="60m">0–60m</option>
|
|
457
|
+
</select>
|
|
458
|
+
</div>
|
|
437
459
|
<canvas id="durationDist"></canvas>
|
|
438
460
|
</div>
|
|
439
461
|
|
|
@@ -478,8 +500,7 @@ const CUMUL_DURATION = {cumul_duration_js};
|
|
|
478
500
|
const AVG_DURATION_BY_DATE = {avg_duration_by_date_js};
|
|
479
501
|
const SCATTER_DATA = {scatter_data_js};
|
|
480
502
|
const TPM_DATA = {tpm_data_js};
|
|
481
|
-
const
|
|
482
|
-
const DUR_HIST_VALUES = {dur_hist_values_js};
|
|
503
|
+
const DUR_HIST_RANGES = {dur_hist_ranges_js};
|
|
483
504
|
|
|
484
505
|
function formatDuration(s) {{
|
|
485
506
|
if (s <= 0) return '0s';
|
|
@@ -653,11 +674,11 @@ new Chart(document.getElementById('tokensPerMin'), {{
|
|
|
653
674
|
}});
|
|
654
675
|
|
|
655
676
|
// Prompt length distribution histogram
|
|
656
|
-
new Chart(document.getElementById('durationDist'), {{
|
|
677
|
+
const durChart = new Chart(document.getElementById('durationDist'), {{
|
|
657
678
|
type: 'bar',
|
|
658
679
|
data: {{
|
|
659
|
-
labels:
|
|
660
|
-
datasets: [{{ label: 'Prompts', data:
|
|
680
|
+
labels: DUR_HIST_RANGES['30s'].labels,
|
|
681
|
+
datasets: [{{ label: 'Prompts', data: DUR_HIST_RANGES['30s'].values,
|
|
661
682
|
backgroundColor: '#34d399', borderRadius: 4 }}]
|
|
662
683
|
}},
|
|
663
684
|
options: {{ ...baseOpts,
|
|
@@ -665,6 +686,12 @@ new Chart(document.getElementById('durationDist'), {{
|
|
|
665
686
|
scales: {{ ...baseOpts.scales,
|
|
666
687
|
y: {{ ...baseOpts.scales.y, ticks: {{ ...baseOpts.scales.y.ticks, stepSize: 1 }} }} }} }}
|
|
667
688
|
}});
|
|
689
|
+
document.getElementById('durRange').addEventListener('change', function() {{
|
|
690
|
+
const r = DUR_HIST_RANGES[this.value];
|
|
691
|
+
durChart.data.labels = r.labels;
|
|
692
|
+
durChart.data.datasets[0].data = r.values;
|
|
693
|
+
durChart.update();
|
|
694
|
+
}});
|
|
668
695
|
|
|
669
696
|
// Total vs key prompts per day
|
|
670
697
|
new Chart(document.getElementById('promptsVsTotal'), {{
|