mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Fix parsing all user generated messages in tool results
This commit is contained in:
@@ -1637,7 +1637,7 @@ ${this.customInstructions.trim()}
|
|||||||
// TextBlockParam, ImageBlockParam, ToolUseBlockParam, and ToolResultBlockParam.
|
// TextBlockParam, ImageBlockParam, ToolUseBlockParam, and ToolResultBlockParam.
|
||||||
// We need to apply parseMentions() to:
|
// We need to apply parseMentions() to:
|
||||||
// 1. All TextBlockParam's text (first user message with task)
|
// 1. All TextBlockParam's text (first user message with task)
|
||||||
// 2. ToolResultBlockParam's content/context text arrays if it contains "<feedback>" (see formatToolDeniedFeedback and consecutiveMistakeCount >= 3 above, we place all user generated tool results in <feedback> tags)
|
// 2. ToolResultBlockParam's content/context text arrays if it contains "<feedback>" (see formatToolDeniedFeedback, attemptCompletion, executeCommand, and consecutiveMistakeCount >= 3) or "<answer>" (see askFollowupQuestion), we place all user generated content in these tags so they can effectively be used as markers for when we should parse mentions)
|
||||||
Promise.all(
|
Promise.all(
|
||||||
userContent.map(async (block) => {
|
userContent.map(async (block) => {
|
||||||
if (block.type === "text") {
|
if (block.type === "text") {
|
||||||
@@ -1646,7 +1646,8 @@ ${this.customInstructions.trim()}
|
|||||||
text: await parseMentions(block.text, cwd, this.providerRef.deref()?.urlScraper),
|
text: await parseMentions(block.text, cwd, this.providerRef.deref()?.urlScraper),
|
||||||
}
|
}
|
||||||
} else if (block.type === "tool_result") {
|
} else if (block.type === "tool_result") {
|
||||||
if (typeof block.content === "string" && block.content.includes("<feedback>")) {
|
const isUserMessage = (text: string) => text.includes("<feedback>") || text.includes("<answer>")
|
||||||
|
if (typeof block.content === "string" && isUserMessage(block.content)) {
|
||||||
return {
|
return {
|
||||||
...block,
|
...block,
|
||||||
content: await parseMentions(block.content, cwd, this.providerRef.deref()?.urlScraper),
|
content: await parseMentions(block.content, cwd, this.providerRef.deref()?.urlScraper),
|
||||||
@@ -1654,7 +1655,7 @@ ${this.customInstructions.trim()}
|
|||||||
} else if (Array.isArray(block.content)) {
|
} else if (Array.isArray(block.content)) {
|
||||||
const parsedContent = await Promise.all(
|
const parsedContent = await Promise.all(
|
||||||
block.content.map(async (contentBlock) => {
|
block.content.map(async (contentBlock) => {
|
||||||
if (contentBlock.type === "text" && contentBlock.text.includes("<feedback>")) {
|
if (contentBlock.type === "text" && isUserMessage(contentBlock.text)) {
|
||||||
return {
|
return {
|
||||||
...contentBlock,
|
...contentBlock,
|
||||||
text: await parseMentions(
|
text: await parseMentions(
|
||||||
|
|||||||
Reference in New Issue
Block a user