mirror of
https://github.com/alibaba/higress.git
synced 2026-03-03 16:10:48 +08:00
fix: qwen stream issue (#1564)
This commit is contained in:
@@ -134,7 +134,7 @@ type TransformRequestBodyHandler interface {
|
||||
}
|
||||
|
||||
// TransformRequestBodyHeadersHandler allows to transform request headers based on the request body.
|
||||
// Some providers (e.g. baidu, gemini) transform request headers (e.g., path) based on the request body (e.g., model).
|
||||
// Some providers (e.g. gemini) transform request headers (e.g., path) based on the request body (e.g., model).
|
||||
type TransformRequestBodyHeadersHandler interface {
|
||||
TransformRequestBodyHeaders(ctx wrapper.HttpContext, apiName ApiName, body []byte, headers http.Header, log wrapper.Log) ([]byte, error)
|
||||
}
|
||||
|
||||
@@ -158,11 +158,11 @@ func (m *qwenProvider) onChatCompletionRequestBody(ctx wrapper.HttpContext, body
|
||||
|
||||
streaming := request.Stream
|
||||
if streaming {
|
||||
_ = proxywasm.ReplaceHttpRequestHeader("Accept", "text/event-stream")
|
||||
_ = proxywasm.ReplaceHttpRequestHeader("X-DashScope-SSE", "enable")
|
||||
headers.Set("Accept", "text/event-stream")
|
||||
headers.Set("X-DashScope-SSE", "enable")
|
||||
} else {
|
||||
_ = proxywasm.ReplaceHttpRequestHeader("Accept", "*/*")
|
||||
_ = proxywasm.RemoveHttpRequestHeader("X-DashScope-SSE")
|
||||
headers.Set("Accept", "*/*")
|
||||
headers.Del("X-DashScope-SSE")
|
||||
}
|
||||
|
||||
return m.buildQwenTextGenerationRequest(ctx, request, streaming)
|
||||
|
||||
Reference in New Issue
Block a user