Skip to content

Commit 440c636

Browse files
authored
fix bug
The old code removed all non-ASCII characters.
1 parent 8c1430d commit 440c636

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llama-cpp-2/src/model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ impl LlamaModel {
549549
if res > buff.len() as i32 {
550550
return Err(ApplyChatTemplateError::BuffSizeError);
551551
}
552-
String::from_utf8(buff.iter().filter(|c| **c > 0).map(|&c| c as u8).collect())
552+
Ok::<String, ApplyChatTemplateError>(CStr::from_ptr(buff.as_mut_ptr()).to_string_lossy().to_string())
553553
}?;
554554
Ok(formatted_chat)
555555
}

0 commit comments

Comments
 (0)