MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / InjectStream

Function InjectStream

internal/toolinjection/inject_stream.go:28–34  ·  view source on GitHub ↗

--------------------------------------------------------------------------- OpenAI Chat Completions streaming injection Chunks are raw JSON; the handler wraps them with "data: %s\n\n". --------------------------------------------------------------------------- InjectStream dispatches to the format-s

(dataChan <-chan []byte, rule *config.ToolCallInjectionRule, modelName string, format string)

Source from the content-addressed store, hash-verified

26
27// InjectStream dispatches to the format-specific streaming injection wrapper.
28func InjectStream(dataChan <-chan []byte, rule *config.ToolCallInjectionRule, modelName string, format string) <-chan []byte {
29 f := GetFormat(format)
30 if f == nil {
31 return dataChan
32 }
33 return f.InjectStream(dataChan, rule, modelName)
34}
35
36// InjectOpenAIStream wraps a data channel to inject tool_call chunks into a
37// real OpenAI streaming response.

Callers 1

Calls 2

GetFormatFunction · 0.85
InjectStreamMethod · 0.65

Tested by 1