You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Disaggregated router: apply the chat stream filter to output #198
Follow-up from epic #116 (#126, router front). The disaggregated router does not strip model-specific structural tokens from its output.
Problem
The single-node chat route applies a StreamFilter (src/server/tool_calls/stream_filter.rs:249) that strips <think>, <|channel>, tool-call markers, and stray turn tokens from content deltas and routes thinking content to reasoning_content. The disaggregated router (src/server/router_front.rs) forwards the decode node's raw detokenized text directly into the SSE delta.content, so for reasoning models or tool-calling prompts those markers leak to the client. This is why tests/disaggregated_router_e2e.rs currently uses enable_thinking=false.
Implementation
Instantiate a StreamFilter per request in the router handler, mirroring the chat route's setup (including the primed-open-thinking start state when the rendered prompt ends inside an open thinking block).
Feed each decode-node text piece through the filter in drive_handoff_result; emit filtered content into delta.content and thinking content into delta.reasoning_content.
Handle the prefill node's first token the same way (it can be the first reasoning token).
Decide whether tool-call parsing (accumulate-then-parse) is in scope here; if deferred, document that the router supports content + reasoning_content but not tool_calls yet.
Acceptance criteria
A reasoning-model request through the router (thinking enabled) returns the same content/reasoning_content split as the single-node chat route.
tests/disaggregated_router_e2e.rs gains a thinking-enabled case (or a new test).
Activity