Updated the regex pattern in DeepseekR3Handler to use (?s) flag for dot-matches-newline behavior when removing <think> tags. Added comprehensive test case that verifies the handler correctly processes content with multiline think tags. Also made styling changes to the web interface, though the full diff was truncated.
19 lines
498 B
Rust
19 lines
498 B
Rust
use super::ModelHandler;
|
|
use regex;
|
|
|
|
pub struct DeepseekR3Handler;
|
|
|
|
impl ModelHandler for DeepseekR3Handler {
|
|
fn is_analysis_complete(&self, buffer: &str) -> bool {
|
|
buffer.contains("</think>")
|
|
}
|
|
|
|
fn process_content(&self, content: &str) -> String {
|
|
let re = regex::Regex::new(r"(?s)<think>.*?</think>").unwrap();
|
|
re.replace_all(content, "").to_string()
|
|
}
|
|
|
|
fn has_analysis_markers(&self, buffer: &str) -> bool {
|
|
buffer.contains("<think>")
|
|
}
|
|
}
|