Skip to content

Commit b28dc21

Browse files
committed
Fix newline handling for tool decision messages
Ensure tool decision messages (allowed/denied) are properly isolated with newlines before and after the content. The fix adds a trailing newline to the content when missing, in addition to the existing logic that prepends a newline if the output doesn't already end with one. This guarantees these messages appear on their own lines in the chat window. * Plugin/ai/ChatAIWindow.cpp **Generated by CodeLite** Signed-off-by: Eran Ifrah <eran@codelite.org>
1 parent c594538 commit b28dc21

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Plugin/ai/ChatAIWindow.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,14 @@ void ChatAIWindow::OnChatAIOutput(clLLMEvent& event)
449449
if (event.GetOutputReason().has_value()) {
450450
if (event.GetOutputReason().value() == assistant::Reason::kToolDenied ||
451451
event.GetOutputReason().value() == assistant::Reason::kToolAllowed) {
452+
// Make sure these lines are placed on their own line.
452453
if (!m_stcOutput->GetText().EndsWith("\n")) {
453-
// Make sure these lines are placed on their own line.
454454
content.Prepend("\n");
455455
}
456+
457+
if (!content.EndsWith("\n")) {
458+
content << "\n";
459+
}
456460
}
457461
}
458462
AppendOutput(content);

0 commit comments

Comments
 (0)