mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Fix: Improve reasoning block formatting for better readability (#7868)
This commit is contained in:
parent
0e1b23d09c
commit
9dabb85007
1 changed files with 14 additions and 2 deletions
|
|
@ -1944,10 +1944,22 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
|
|||
}
|
||||
|
||||
switch (chunk.type) {
|
||||
case "reasoning":
|
||||
case "reasoning": {
|
||||
reasoningMessage += chunk.text
|
||||
await this.say("reasoning", reasoningMessage, undefined, true)
|
||||
// Only apply formatting if the message contains sentence-ending punctuation followed by **
|
||||
let formattedReasoning = reasoningMessage
|
||||
if (reasoningMessage.includes("**")) {
|
||||
// Add line breaks before **Title** patterns that appear after sentence endings
|
||||
// This targets section headers like "...end of sentence.**Title Here**"
|
||||
// Handles periods, exclamation marks, and question marks
|
||||
formattedReasoning = reasoningMessage.replace(
|
||||
/([.!?])\*\*([^*\n]+)\*\*/g,
|
||||
"$1\n\n**$2**",
|
||||
)
|
||||
}
|
||||
await this.say("reasoning", formattedReasoning, undefined, true)
|
||||
break
|
||||
}
|
||||
case "usage":
|
||||
inputTokens += chunk.inputTokens
|
||||
outputTokens += chunk.outputTokens
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue