[model-gateway] Fix duplicate classify prefix in response ID (#16101)

Co-authored-by: Chang Su <chang.s.su@oracle.com>
This commit is contained in:
Simo Lin
2025-12-29 11:07:21 -08:00
committed by GitHub
co-authored by Chang Su
parent 2ff289e2dc
commit f39382c6ca
2 changed files with 17 additions and 6 deletions
+16 -5
View File
@@ -398,12 +398,17 @@ impl Tree {
// Attach tenant to the new split node (intermediate - no timestamp update) // Attach tenant to the new split node (intermediate - no timestamp update)
// The cloned DashMap already has the tenant; just ensure char count is correct // The cloned DashMap already has the tenant; just ensure char count is correct
if !new_node.tenant_last_access_time.contains_key(tenant_id.as_ref()) { if !new_node
.tenant_last_access_time
.contains_key(tenant_id.as_ref())
{
self.tenant_char_count self.tenant_char_count
.entry(Arc::clone(&tenant_id)) .entry(Arc::clone(&tenant_id))
.and_modify(|count| *count += matched_text_count) .and_modify(|count| *count += matched_text_count)
.or_insert(matched_text_count); .or_insert(matched_text_count);
new_node.tenant_last_access_time.insert(Arc::clone(&tenant_id), 0); new_node
.tenant_last_access_time
.insert(Arc::clone(&tenant_id), 0);
} }
InsertStep::Continue { InsertStep::Continue {
@@ -415,12 +420,17 @@ impl Tree {
drop(matched_node_text); drop(matched_node_text);
// Ensure tenant exists at this intermediate node // Ensure tenant exists at this intermediate node
if !matched_node.tenant_last_access_time.contains_key(tenant_id.as_ref()) { if !matched_node
.tenant_last_access_time
.contains_key(tenant_id.as_ref())
{
self.tenant_char_count self.tenant_char_count
.entry(Arc::clone(&tenant_id)) .entry(Arc::clone(&tenant_id))
.and_modify(|count| *count += matched_node_text_count) .and_modify(|count| *count += matched_node_text_count)
.or_insert(matched_node_text_count); .or_insert(matched_node_text_count);
matched_node.tenant_last_access_time.insert(Arc::clone(&tenant_id), 0); matched_node
.tenant_last_access_time
.insert(Arc::clone(&tenant_id), 0);
} }
InsertStep::Continue { InsertStep::Continue {
@@ -447,7 +457,8 @@ impl Tree {
// Loop exited normally (remaining empty) - prev is the leaf node // Loop exited normally (remaining empty) - prev is the leaf node
// Update its timestamp for LRU ordering // Update its timestamp for LRU ordering
let epoch = get_epoch(); let epoch = get_epoch();
prev.tenant_last_access_time.insert(Arc::clone(&tenant_id), epoch); prev.tenant_last_access_time
.insert(Arc::clone(&tenant_id), epoch);
} }
/// Performs prefix matching and returns detailed result with char counts. /// Performs prefix matching and returns detailed result with char counts.
@@ -198,7 +198,7 @@ impl PipelineStage for ClassifyResponseProcessingStage {
// Build response // Build response
let response = ClassifyResponse::new( let response = ClassifyResponse::new(
format!("classify-{}", dispatch.request_id), dispatch.request_id.clone(),
dispatch.model.clone(), dispatch.model.clone(),
dispatch.created, dispatch.created,
vec![classify_data], vec![classify_data],