Module exposing: NewOpenAIRoutingFooterWriter, Header, WriteHeader, Write, Flush, processUpstream, shouldInject, chunkHasToolCall
// Source: https://github.com/weave-os/router | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works // Provided via justclaw.it.com; keep this notice with the code. package translate import ( "bufio" "bytes" "net/http" "strings" "time" "weave-os/router/internal/sse" "github.com/tidwall/gjson" "github.com/tidwall/sjson" ) // OpenAIRoutingFooterWriter wraps an http.ResponseWriter and appends a footer // chunk at the END of an OpenAI-format SSE stream — as a delta-content // chat.completion.chunk emitted just before the chunk that carries // finish_reason — so any client that renders the answer also renders a // post-answer affordance (a feedback thumb). // // It is the symmetric end-of-stream counterpart to OpenAIRoutingMarkerWriter's // le ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key