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:
Beyhan Ogur
2026-05-11 15:28:56 +03:00
parent f0a4e89e0f
commit c56ae7194c
10 changed files with 193 additions and 21 deletions
+9
View File
@@ -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,
}
}