diff --git a/src/encoding.rs b/src/encoding.rs index afe1fce..fe0b8f8 100644 --- a/src/encoding.rs +++ b/src/encoding.rs @@ -820,6 +820,12 @@ impl Render for HarmonyEncoding { } }; + // next header channel + if let Some(channel) = &message.channel { + self.render_formatting_token_into(FormattingToken::Channel, into)?; + self.render_text_into(channel, into)?; + } + // next render the header recipient, if there is one if let Some(recipient) = &message.recipient { if recipient != "all" { @@ -827,12 +833,6 @@ impl Render for HarmonyEncoding { } } - // next header channel - if let Some(channel) = &message.channel { - self.render_formatting_token_into(FormattingToken::Channel, into)?; - self.render_text_into(channel, into)?; - } - // finally content type if let Some(content_type) = &message.content_type { self.render_text_into(format!(" {content_type}"), into)?; diff --git a/test-data/test_does_not_drop_if_ongoing_analysis.txt b/test-data/test_does_not_drop_if_ongoing_analysis.txt index 29f8519..004ecf6 100644 --- a/test-data/test_does_not_drop_if_ongoing_analysis.txt +++ b/test-data/test_does_not_drop_if_ongoing_analysis.txt @@ -1 +1 @@ -<|start|>user<|message|>What is the weather in SF?<|end|><|start|>assistant<|channel|>analysis<|message|>User asks: “What is the weather in SF?” We need to use lookup_weather tool.<|end|><|start|>assistant to=functions.lookup_weather<|channel|>commentary <|constrain|>json<|message|>{"location": "San Francisco"}<|call|><|start|>functions.lookup_weather<|message|>{"temperature": 20, "description": "sunny"}<|end|><|start|>assistant \ No newline at end of file +<|start|>user<|message|>What is the weather in SF?<|end|><|start|>assistant<|channel|>analysis<|message|>User asks: “What is the weather in SF?” We need to use lookup_weather tool.<|end|><|start|>assistant<|channel|>commentary to=functions.lookup_weather <|constrain|>json<|message|>{"location": "San Francisco"}<|call|><|start|>functions.lookup_weather<|message|>{"temperature": 20, "description": "sunny"}<|end|><|start|>assistant \ No newline at end of file