feat: enable SSE streaming support in Anthropic handler
- Updated AnthropicHandler to check for streaming configuration before handling SSE transform. - Modified handleStreaming to use the original request body instead of forcing stream to true. - Adjusted the transformation logic in AnthropicToBifrost to respect the original stream setting. - Added logging for SSE streaming configuration in the main application.
This commit is contained in:
@@ -16,6 +16,7 @@ type Config struct {
|
||||
LogLevel string // "debug", "info", or "warn" — console log verbosity
|
||||
RequestTimeoutSeconds int
|
||||
OpenAIModel string // default model when client omits it
|
||||
Streaming bool // enable/disable SSE streaming responses
|
||||
}
|
||||
|
||||
// Load reads environment variables and returns a populated Config.
|
||||
@@ -51,6 +52,13 @@ func Load() *Config {
|
||||
openAIApiKey := os.Getenv("OPENAI_KEY")
|
||||
openAIModel := os.Getenv("OPENAI_MODEL")
|
||||
|
||||
streaming := true
|
||||
if v := os.Getenv("STREAMING"); v != "" {
|
||||
if parsed, err := strconv.ParseBool(v); err == nil {
|
||||
streaming = parsed
|
||||
}
|
||||
}
|
||||
|
||||
return &Config{
|
||||
Port: port,
|
||||
OpenAIBackend: openAIBackend,
|
||||
@@ -61,5 +69,6 @@ func Load() *Config {
|
||||
LogLevel: logLevel,
|
||||
RequestTimeoutSeconds: timeoutSec,
|
||||
OpenAIModel: openAIModel,
|
||||
Streaming: streaming,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user