mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 12:47:28 +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.
|
// 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 {
|
type TransformRequestBodyHeadersHandler interface {
|
||||||
TransformRequestBodyHeaders(ctx wrapper.HttpContext, apiName ApiName, body []byte, headers http.Header, log wrapper.Log) ([]byte, error)
|
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
|
streaming := request.Stream
|
||||||
if streaming {
|
if streaming {
|
||||||
_ = proxywasm.ReplaceHttpRequestHeader("Accept", "text/event-stream")
|
headers.Set("Accept", "text/event-stream")
|
||||||
_ = proxywasm.ReplaceHttpRequestHeader("X-DashScope-SSE", "enable")
|
headers.Set("X-DashScope-SSE", "enable")
|
||||||
} else {
|
} else {
|
||||||
_ = proxywasm.ReplaceHttpRequestHeader("Accept", "*/*")
|
headers.Set("Accept", "*/*")
|
||||||
_ = proxywasm.RemoveHttpRequestHeader("X-DashScope-SSE")
|
headers.Del("X-DashScope-SSE")
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.buildQwenTextGenerationRequest(ctx, request, streaming)
|
return m.buildQwenTextGenerationRequest(ctx, request, streaming)
|
||||||
|
|||||||
Reference in New Issue
Block a user