Files
tabbyAPI/common
NNN e0f24264bb Fix ValidationError on early client disconnect and ZeroDivisionError in draft metrics logging (#433)
* Fix ValidationError when a client disconnects during prefill

_chat_stream_collector initialized `generation = {}` and only set the
"index" key inside the `async for` loop body. If the client disconnects
before the first token is produced (still in prefill), the loop never
runs, the empty dict is returned, and _compose_response constructs
ChatCompletionRespChoice(index=None), raising a pydantic ValidationError.
Initialize `generation = {"index": task_idx}` so a valid index is always
present even when no tokens were generated.

* Guard against division by zero in draft accept-rate logging

When draft_accept and draft_reject are both 0 (a request that produced
no draft tokens), total_draft is 0 and `accept / total_draft` raises
ZeroDivisionError inside log_metrics. Guard the division and report
0.0% in that case.
2026-07-15 22:06:32 +02:00
..
2026-03-30 00:19:07 +02:00
2026-07-15 16:58:31 +02:00
2026-03-30 00:19:07 +02:00
2026-04-02 01:26:44 +02:00
2026-07-15 02:31:50 +02:00
2026-07-15 01:15:01 +02:00
2026-07-15 00:59:24 +02:00
2026-03-30 00:19:07 +02:00
2026-03-30 00:19:07 +02:00