Skip to content

Commit bc61a55

Browse files
committed
fix: use clearroute cache and raw value for header mutation
Signed-off-by: bitliu <[email protected]>
1 parent a71922c commit bc61a55

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/semantic-router/pkg/extproc/request_handler.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,16 +385,18 @@ func (r *OpenAIRouter) handleModelRouting(openAIRequest *openai.ChatCompletionNe
385385
if selectedEndpoint != "" {
386386
setHeaders = append(setHeaders, &core.HeaderValueOption{
387387
Header: &core.HeaderValue{
388-
Key: "x-semantic-destination-endpoint",
389-
Value: selectedEndpoint,
388+
Key: "x-semantic-destination-endpoint",
389+
Value: selectedEndpoint,
390+
RawValue: []byte(selectedEndpoint),
390391
},
391392
})
392393
}
393394
if actualModel != "" {
394395
setHeaders = append(setHeaders, &core.HeaderValueOption{
395396
Header: &core.HeaderValue{
396-
Key: "x-selected-model",
397-
Value: actualModel,
397+
Key: "x-selected-model",
398+
Value: actualModel,
399+
RawValue: []byte(actualModel),
398400
},
399401
})
400402
}
@@ -414,9 +416,10 @@ func (r *OpenAIRouter) handleModelRouting(openAIRequest *openai.ChatCompletionNe
414416
Response: &ext_proc.ProcessingResponse_RequestBody{
415417
RequestBody: &ext_proc.BodyResponse{
416418
Response: &ext_proc.CommonResponse{
417-
Status: ext_proc.CommonResponse_CONTINUE,
418-
HeaderMutation: headerMutation,
419-
BodyMutation: bodyMutation,
419+
ClearRouteCache: true,
420+
Status: ext_proc.CommonResponse_CONTINUE_AND_REPLACE,
421+
HeaderMutation: headerMutation,
422+
BodyMutation: bodyMutation,
420423
},
421424
},
422425
},

0 commit comments

Comments
 (0)