Spaces:
Running
Running
Commit History
20 days ago
-
feat(chatbot): token-optimization layer v3.6.0 — minimum token spend, zero quality delta
ahmdelbaz28-uxMeasured on the real builders (scripts/token-audit.ts): - cache-friendly prompt layout: 47-56% of the prompt is now a byte-identical stable prefix (provider prompt caching discounts 50-90% of prompt tokens) - catalog gating: full 40-course catalog only on course/platform intent (sticky over recent history); featured 8-course sample otherwise — 6.3k chars (~1.6k+ tokens, ~3k Arabic BPE) saved per technical message - sliding-window history trim: 48-54% of shipped history chars cut (last 2 assistant turns + current question always full) - vision description cap 6000 -> 2400 chars (~900 tokens/frame) - rolling-summary transcript cap 40k -> 12k chars - web plugin attached only on current-info intent (1-3k tokens/attempt) - attempt budgets: OpenRouter sweep 10, last-resort 8 (was unbounded ~25-40 full-payload calls per message in degraded states) - token usage telemetry: every billed call now parses the OpenAI-compatible usage field and logs [Chatbot/Tokens] + aggregates (was: ze…8d2c603