mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Fixes
This commit is contained in:
@@ -1586,9 +1586,7 @@ export class ClaudeDev {
|
||||
"api_req_started",
|
||||
JSON.stringify({
|
||||
request:
|
||||
userContent
|
||||
.map((block) => formatContentBlockToMarkdown(block, this.apiConversationHistory))
|
||||
.join("\n\n") + "\n\nLoading...",
|
||||
userContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n") + "\n\nLoading...",
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1602,9 +1600,7 @@ export class ClaudeDev {
|
||||
// since we sent off a placeholder api_req_started message to update the webview while waiting to actually start the API request (to load potential details for example), we need to update the text of that message
|
||||
const lastApiReqIndex = findLastIndex(this.claudeMessages, (m) => m.say === "api_req_started")
|
||||
this.claudeMessages[lastApiReqIndex].text = JSON.stringify({
|
||||
request: userContent
|
||||
.map((block) => formatContentBlockToMarkdown(block, this.apiConversationHistory))
|
||||
.join("\n\n"),
|
||||
request: userContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n"),
|
||||
} satisfies ClaudeApiReqInfo)
|
||||
await this.saveClaudeMessages()
|
||||
await this.providerRef.deref()?.postStateToWebview()
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function downloadTask(dateTs: number, conversationHistory: Anthropi
|
||||
.map((message) => {
|
||||
const role = message.role === "user" ? "**User:**" : "**Assistant:**"
|
||||
const content = Array.isArray(message.content)
|
||||
? message.content.map((block) => formatContentBlockToMarkdown(block, conversationHistory)).join("\n")
|
||||
? message.content.map((block) => formatContentBlockToMarkdown(block)).join("\n")
|
||||
: message.content
|
||||
return `${role}\n\n${content}\n\n`
|
||||
})
|
||||
@@ -46,8 +46,8 @@ export function formatContentBlockToMarkdown(
|
||||
| Anthropic.TextBlockParam
|
||||
| Anthropic.ImageBlockParam
|
||||
| Anthropic.ToolUseBlockParam
|
||||
| Anthropic.ToolResultBlockParam,
|
||||
messages: Anthropic.MessageParam[]
|
||||
| Anthropic.ToolResultBlockParam
|
||||
// messages: Anthropic.MessageParam[]
|
||||
): string {
|
||||
switch (block.type) {
|
||||
case "text":
|
||||
@@ -65,12 +65,14 @@ export function formatContentBlockToMarkdown(
|
||||
}
|
||||
return `[Tool Use: ${block.name}]\n${input}`
|
||||
case "tool_result":
|
||||
const toolName = findToolName(block.tool_use_id, messages)
|
||||
// For now we're not doing tool name lookup since we don't use tools anymore
|
||||
// const toolName = findToolName(block.tool_use_id, messages)
|
||||
const toolName = "Tool"
|
||||
if (typeof block.content === "string") {
|
||||
return `[${toolName}${block.is_error ? " (Error)" : ""}]\n${block.content}`
|
||||
} else if (Array.isArray(block.content)) {
|
||||
return `[${toolName}${block.is_error ? " (Error)" : ""}]\n${block.content
|
||||
.map((contentBlock) => formatContentBlockToMarkdown(contentBlock, messages))
|
||||
.map((contentBlock) => formatContentBlockToMarkdown(contentBlock))
|
||||
.join("\n")}`
|
||||
} else {
|
||||
return `[${toolName}${block.is_error ? " (Error)" : ""}]`
|
||||
|
||||
Reference in New Issue
Block a user