Pull requests / #2959

#2959 fix: ignore unrenderable optional prefix heads

open · @Tsury · 0 comentários · No GitHub

Descrição

A valid conversation can return HTTP 400 when `strata_prefix` renders a partial head that the model template rejects. For example, a system message followed by a user message is valid, but `{"messages": 1}` renders only the system message. Templates requiring a user query raise `TemplateRequestError: No user query found in messages.` The same problem affects character prefixes ending in the system message.

Catch `TemplateRequestError` only while rendering the optional head and ignore that unusable prefix, as `resolve_prefix` already promises. Full-request template validation and malformed prefix errors remain unchanged. Requests without `strata_prefix` take the existing path. This also applies alongside #2874; the repair does not depend on its image support.

Validation on main `477ac13cbe8e582c20484871ce459d20d82df09d`: the new regression fails before the fix with the template error, then all six `SharedPrefix` tests pass. It checks both message/character forms, unchanged prepared tokens, the diagnostic, and continued rejection of invalid full requests. A separate local check alongside #2874 covers text/image requests; 13 `SharedPrefix`/`ImageMarkers` tests pass. Python only; no native backend changed.

No site

Links install, modelos, releases.