@@ -3,7 +3,7 @@ use nom::{
33 bytes:: complete:: { tag, take_until} ,
44 character:: complete:: multispace0,
55 combinator:: map,
6- sequence:: { delimited, terminated } ,
6+ sequence:: delimited,
77} ;
88use std:: collections:: HashMap ;
99
@@ -96,10 +96,7 @@ impl StreamingParser {
9696
9797fn parse_think_block ( input : & str ) -> IResult < & str , String > {
9898 let mut parser = map (
99- terminated (
100- delimited ( tag ( "<think>" ) , take_until ( "</think>" ) , tag ( "</think>" ) ) ,
101- multispace0,
102- ) ,
99+ delimited ( tag ( "<think>" ) , take_until ( "</think>" ) , tag ( "</think>" ) ) ,
103100 |content : & str | content. trim ( ) . to_string ( ) ,
104101 ) ;
105102 parser. parse ( input)
@@ -167,7 +164,7 @@ mod tests {
167164 items,
168165 [
169166 Response :: Reasoning ( "I need to process this request." . to_string( ) ) ,
170- Response :: TextDelta ( "Here 's my " . to_string( ) ) ,
167+ Response :: TextDelta ( "\n Here 's my " . to_string( ) ) ,
171168 Response :: TextDelta ( "response." . to_string( ) )
172169 ]
173170 ) ;
@@ -220,6 +217,7 @@ mod tests {
220217 items,
221218 [
222219 Response :: Reasoning ( "I need to process this request." . to_string( ) ) ,
220+ Response :: TextDelta ( "\n " . to_string( ) ) ,
223221 Response :: ToolCall {
224222 name: "greet" . to_string( ) ,
225223 arguments: HashMap :: from( [ (
@@ -327,7 +325,7 @@ Hyprnote is an AI-powered notepad designed for private meetings with complete on
327325 . map ( |item| match item {
328326 Response :: TextDelta ( text) => text. clone ( ) ,
329327 Response :: Reasoning ( reasoning) => {
330- format ! ( "<think>\n {}\n </think>\n " , reasoning)
328+ format ! ( "<think>\n {}\n </think>" , reasoning)
331329 }
332330 _ => "" . to_string ( ) ,
333331 } )
0 commit comments