mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-21 04:41:16 -05:00
Fixes
This commit is contained in:
@@ -1586,9 +1586,7 @@ export class ClaudeDev {
|
|||||||
"api_req_started",
|
"api_req_started",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
request:
|
request:
|
||||||
userContent
|
userContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n") + "\n\nLoading...",
|
||||||
.map((block) => formatContentBlockToMarkdown(block, this.apiConversationHistory))
|
|
||||||
.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
|
// 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")
|
const lastApiReqIndex = findLastIndex(this.claudeMessages, (m) => m.say === "api_req_started")
|
||||||
this.claudeMessages[lastApiReqIndex].text = JSON.stringify({
|
this.claudeMessages[lastApiReqIndex].text = JSON.stringify({
|
||||||
request: userContent
|
request: userContent.map((block) => formatContentBlockToMarkdown(block)).join("\n\n"),
|
||||||
.map((block) => formatContentBlockToMarkdown(block, this.apiConversationHistory))
|
|
||||||
.join("\n\n"),
|
|
||||||
} satisfies ClaudeApiReqInfo)
|
} satisfies ClaudeApiReqInfo)
|
||||||
await this.saveClaudeMessages()
|
await this.saveClaudeMessages()
|
||||||
await this.providerRef.deref()?.postStateToWebview()
|
await this.providerRef.deref()?.postStateToWebview()
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export async function downloadTask(dateTs: number, conversationHistory: Anthropi
|
|||||||
.map((message) => {
|
.map((message) => {
|
||||||
const role = message.role === "user" ? "**User:**" : "**Assistant:**"
|
const role = message.role === "user" ? "**User:**" : "**Assistant:**"
|
||||||
const content = Array.isArray(message.content)
|
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
|
: message.content
|
||||||
return `${role}\n\n${content}\n\n`
|
return `${role}\n\n${content}\n\n`
|
||||||
})
|
})
|
||||||
@@ -46,8 +46,8 @@ export function formatContentBlockToMarkdown(
|
|||||||
| Anthropic.TextBlockParam
|
| Anthropic.TextBlockParam
|
||||||
| Anthropic.ImageBlockParam
|
| Anthropic.ImageBlockParam
|
||||||
| Anthropic.ToolUseBlockParam
|
| Anthropic.ToolUseBlockParam
|
||||||
| Anthropic.ToolResultBlockParam,
|
| Anthropic.ToolResultBlockParam
|
||||||
messages: Anthropic.MessageParam[]
|
// messages: Anthropic.MessageParam[]
|
||||||
): string {
|
): string {
|
||||||
switch (block.type) {
|
switch (block.type) {
|
||||||
case "text":
|
case "text":
|
||||||
@@ -65,12 +65,14 @@ export function formatContentBlockToMarkdown(
|
|||||||
}
|
}
|
||||||
return `[Tool Use: ${block.name}]\n${input}`
|
return `[Tool Use: ${block.name}]\n${input}`
|
||||||
case "tool_result":
|
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") {
|
if (typeof block.content === "string") {
|
||||||
return `[${toolName}${block.is_error ? " (Error)" : ""}]\n${block.content}`
|
return `[${toolName}${block.is_error ? " (Error)" : ""}]\n${block.content}`
|
||||||
} else if (Array.isArray(block.content)) {
|
} else if (Array.isArray(block.content)) {
|
||||||
return `[${toolName}${block.is_error ? " (Error)" : ""}]\n${block.content
|
return `[${toolName}${block.is_error ? " (Error)" : ""}]\n${block.content
|
||||||
.map((contentBlock) => formatContentBlockToMarkdown(contentBlock, messages))
|
.map((contentBlock) => formatContentBlockToMarkdown(contentBlock))
|
||||||
.join("\n")}`
|
.join("\n")}`
|
||||||
} else {
|
} else {
|
||||||
return `[${toolName}${block.is_error ? " (Error)" : ""}]`
|
return `[${toolName}${block.is_error ? " (Error)" : ""}]`
|
||||||
|
|||||||
Reference in New Issue
Block a user