feat: group all tools in single spoiler with names in summary
Раньше: каждый инструмент — отдельный <details>. Теперь: один <details> с именами всех инструментов в summary, каждый инструмент внутри с <b>toolName</b> заголовком.
This commit is contained in:
parent
1778231a2d
commit
28992f8657
15
index.ts
15
index.ts
|
|
@ -330,19 +330,22 @@ async function runPlugin(ctx: any, options: any, dataDir: string) {
|
|||
parts.push(`<details>\n<summary>Thinking</summary>\n\n${step.reasoning}\n\n</details>`)
|
||||
}
|
||||
|
||||
// Tool calls
|
||||
// Tool calls — all in one spoiler with tool names in summary
|
||||
if (step.tools.length > 0) {
|
||||
const toolNames = step.tools.map(t => t.name).join(", ")
|
||||
parts.push(`<details>\n<summary>🔧 ${toolNames}</summary>\n\n`)
|
||||
for (const tool of step.tools) {
|
||||
parts.push(`<details>\n<summary>🔧 ${tool.name}</summary>\n\n`)
|
||||
parts.push(`<b>Args:</b>\n\`\`\`\n${tool.args}\n\`\`\`\n\n`)
|
||||
parts.push(`<b>${tool.name}</b>\n`)
|
||||
parts.push(`<b>Args:</b>\n\`\`\`\n${tool.args}\n\`\`\`\n`)
|
||||
if (tool.failed) {
|
||||
parts.push(`<b>Failed:</b> ${tool.result}\n\n`)
|
||||
parts.push(`<b>Failed:</b> ${tool.result}\n`)
|
||||
} else {
|
||||
parts.push(`<b>Result:</b>\n\`\`\`\n${tool.result}\n\`\`\`\n\n`)
|
||||
parts.push(`<b>Result:</b>\n\`\`\`\n${tool.result}\n\`\`\`\n`)
|
||||
}
|
||||
parts.push("\n")
|
||||
}
|
||||
parts.push(`</details>`)
|
||||
}
|
||||
}
|
||||
|
||||
// Separator before text
|
||||
if (step.text) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue