mirror of
https://github.com/alibaba/higress.git
synced 2026-03-04 16:40:50 +08:00
fix(ai-proxy): fix streaming process
This commit is contained in:
@@ -433,6 +433,10 @@ func onStreamingResponseBody(ctx wrapper.HttpContext, pluginConfig config.Plugin
|
||||
return claudeChunk
|
||||
}
|
||||
|
||||
if !needsClaudeResponseConversion(ctx) {
|
||||
return chunk
|
||||
}
|
||||
|
||||
// If provider doesn't implement any streaming handlers but we need Claude conversion
|
||||
// First extract complete events from the chunk
|
||||
events := provider.ExtractStreamingEvents(ctx, chunk)
|
||||
|
||||
@@ -825,7 +825,7 @@ func ExtractStreamingEvents(ctx wrapper.HttpContext, chunk []byte) []StreamEvent
|
||||
continue
|
||||
}
|
||||
|
||||
if lineStartIndex != -1 && valueStartIndex != -1 {
|
||||
if lineStartIndex != -1 {
|
||||
value := string(body[valueStartIndex:i])
|
||||
currentEvent.SetValue(currentKey, value)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user