SurfSense/surfsense_backend/app/tasks/chat/streaming/flows/shared
CREDO23 40300d300a refactor(chat): add streaming/flows/shared/premium_quota.py
Centralizes the premium-credits lifecycle for chat turns:

* needs_premium_quota: gate check (premium user + non-fallback config).
* PremiumReservation: dataclass capturing reservation state + token totals.
* reserve_premium / finalize_premium / release_premium: idempotent
  reservation, commit, and rollback used by the orchestrators.

Add-only; legacy stream_new_chat.py keeps its inline quota handling
until cutover.
2026-05-25 21:49:14 +02:00
..
__init__.py refactor(chat): add streaming/flows/shared/ base helpers 2026-05-25 21:49:09 +02:00
finalize_emit.py refactor(chat): add streaming/flows/shared/ base helpers 2026-05-25 21:49:09 +02:00
finally_cleanup.py refactor(chat): add streaming/flows/shared/ base helpers 2026-05-25 21:49:09 +02:00
first_frames.py refactor(chat): add streaming/flows/shared/ base helpers 2026-05-25 21:49:09 +02:00
llm_bundle.py refactor(chat): add streaming/flows/shared/ base helpers 2026-05-25 21:49:09 +02:00
pre_stream_setup.py refactor(chat): add streaming/flows/shared/ base helpers 2026-05-25 21:49:09 +02:00
premium_quota.py refactor(chat): add streaming/flows/shared/premium_quota.py 2026-05-25 21:49:14 +02:00
span.py refactor(chat): add streaming/flows/shared/ base helpers 2026-05-25 21:49:09 +02:00