mirror of
https://github.com/alibaba/higress.git
synced 2026-05-29 23:27:28 +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
|
return claudeChunk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !needsClaudeResponseConversion(ctx) {
|
||||||
|
return chunk
|
||||||
|
}
|
||||||
|
|
||||||
// If provider doesn't implement any streaming handlers but we need Claude conversion
|
// If provider doesn't implement any streaming handlers but we need Claude conversion
|
||||||
// First extract complete events from the chunk
|
// First extract complete events from the chunk
|
||||||
events := provider.ExtractStreamingEvents(ctx, chunk)
|
events := provider.ExtractStreamingEvents(ctx, chunk)
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ func ExtractStreamingEvents(ctx wrapper.HttpContext, chunk []byte) []StreamEvent
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if lineStartIndex != -1 && valueStartIndex != -1 {
|
if lineStartIndex != -1 {
|
||||||
value := string(body[valueStartIndex:i])
|
value := string(body[valueStartIndex:i])
|
||||||
currentEvent.SetValue(currentKey, value)
|
currentEvent.SetValue(currentKey, value)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user