Skip to content

Commit 348b589

Browse files
committed
fix test failure
Signed-off-by: Huamin Chen <[email protected]>
1 parent 0517760 commit 348b589

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,18 @@ func (r *OpenAIRouter) handleModelRouting(openAIRequest *openai.ChatCompletionNe
596596

597597
// Add category-specific system prompt if configured
598598
if categoryName != "" {
599-
// Use global config to get the most up-to-date category configuration
599+
// Try to get the most up-to-date category configuration from global config first
600600
// This ensures API updates are reflected immediately
601601
globalConfig := config.GetConfig()
602602
var category *config.Category
603603
if globalConfig != nil {
604604
category = globalConfig.GetCategoryByName(categoryName)
605605
}
606+
607+
// If not found in global config, fall back to router's config (for tests and initial setup)
608+
if category == nil {
609+
category = r.Classifier.GetCategoryByName(categoryName)
610+
}
606611

607612
if category != nil && category.SystemPrompt != "" && category.IsSystemPromptEnabled() {
608613
mode := category.GetSystemPromptMode()

0 commit comments

Comments
 (0)