[router] Use get_pooled in process_single_choice (#11079)
This commit is contained in:
@@ -769,20 +769,22 @@ impl GrpcRouter {
|
|||||||
|
|
||||||
// Check if reasoning parsing is enabled and separate_reasoning is requested
|
// Check if reasoning parsing is enabled and separate_reasoning is requested
|
||||||
if original_request.separate_reasoning {
|
if original_request.separate_reasoning {
|
||||||
if let Ok(mut parser) = self
|
let pooled_parser = self
|
||||||
.reasoning_parser_factory
|
.reasoning_parser_factory
|
||||||
.create(&original_request.model)
|
.get_pooled(&original_request.model);
|
||||||
{
|
|
||||||
match parser.detect_and_parse_reasoning(&processed_text) {
|
let mut parser = pooled_parser
|
||||||
Ok(result) => {
|
.lock()
|
||||||
if !result.reasoning_text.is_empty() {
|
.map_err(|e| format!("Failed to acquire reasoning parser lock: {}", e))?;
|
||||||
reasoning_text = Some(result.reasoning_text);
|
match parser.detect_and_parse_reasoning(&processed_text) {
|
||||||
}
|
Ok(result) => {
|
||||||
processed_text = result.normal_text;
|
if !result.reasoning_text.is_empty() {
|
||||||
}
|
reasoning_text = Some(result.reasoning_text);
|
||||||
Err(e) => {
|
|
||||||
return Err(format!("Reasoning parsing error: {}", e));
|
|
||||||
}
|
}
|
||||||
|
processed_text = result.normal_text;
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
return Err(format!("Reasoning parsing error: {}", e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user