feat: update deepseek_r3 regex and add test case

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.
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-11-05 14:28:14 -03:00
parent cc741b378e
commit 741d736715
3 changed files with 1211 additions and 173 deletions

View file

@ -9,7 +9,7 @@ impl ModelHandler for DeepseekR3Handler {
}
fn process_content(&self, content: &str) -> String {
let re = regex::Regex::new(r"<think>.*?</think>").unwrap();
let re = regex::Regex::new(r"(?s)<think>.*?</think>").unwrap();
re.replace_all(content, "").to_string()
}

View file

@ -12,9 +12,24 @@ mod tests {
}
#[test]
fn test_deepseek_r3() {
fn test_deepseek_r3_process_content() {
test_util::setup();
assert!(true, "Deepseek R3 placeholder test");
let handler = DeepseekR3Handler;
let input = r#"<think>
Alright, I need to help the user revise their resume entry. Let me read what they provided first.
The original message says: " Auxiliom has been updated last week! New release!" They want it in a few words. Hmm, so maybe instead of saying "has been updated," we can use more concise language because resumes usually don't require too much detail unless there's specific information to include.
I notice that the user wants it for their resume, which often requires bullet points or short sentences without being verbose. So perhaps combining these two thoughts into a single sentence would make sense. Also, using an exclamation mark might help convey enthusiasm about the new release.
Let me put it together: "Auxiliom has been updated last week! New release." That's concise and fits well for a resume. It effectively communicates both that something was updated recently and introduces them as having a new release without adding unnecessary details.
</think>
" Auxiliom has been updated last week! New release.""#;
let expected = r#"" Auxiliom has been updated last week! New release.""#;
let result = handler.process_content(input);
assert_eq!(result, expected);
}
#[test]

File diff suppressed because it is too large Load diff