fix: skip execute tool entirely when script has child tools
Результат execute уже в step.text (после ---), не дублируем спойлером. Если в скрипте есть инструменты — показываем только их спойлеры. Если инструментов нет — execute как обычный инструмент.
This commit is contained in:
parent
f261e1361c
commit
542f72d449
9
index.ts
9
index.ts
|
|
@ -579,7 +579,8 @@ async function runPlugin(ctx: any, options: any, dataDir: string) {
|
||||||
: []
|
: []
|
||||||
|
|
||||||
if (childTools.length > 0) {
|
if (childTools.length > 0) {
|
||||||
// Execute has child tool calls — show children, then execute result separately
|
// Execute has child tool calls — show only children, skip execute entirely
|
||||||
|
// (execute result is in step.text, shown after "---")
|
||||||
for (const child of childTools) {
|
for (const child of childTools) {
|
||||||
parts.push(`<details>\n<summary>🔧 ${child.name}</summary>\n\n`)
|
parts.push(`<details>\n<summary>🔧 ${child.name}</summary>\n\n`)
|
||||||
parts.push(`<b>Args:</b>\n\`\`\`\n${child.args}\n\`\`\`\n\n`)
|
parts.push(`<b>Args:</b>\n\`\`\`\n${child.args}\n\`\`\`\n\n`)
|
||||||
|
|
@ -590,12 +591,6 @@ async function runPlugin(ctx: any, options: any, dataDir: string) {
|
||||||
}
|
}
|
||||||
parts.push(`</details>`)
|
parts.push(`</details>`)
|
||||||
}
|
}
|
||||||
// Show execute result as a separate spoiler after all child tools
|
|
||||||
if (executeTool?.result) {
|
|
||||||
parts.push(`<details>\n<summary>🔧 execute</summary>\n\n`)
|
|
||||||
parts.push(`<b>Result:</b>\n\`\`\`\n${executeTool.result}\n\`\`\`\n\n`)
|
|
||||||
parts.push(`</details>`)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// No child tool calls — show tools normally (including execute as-is)
|
// No child tool calls — show tools normally (including execute as-is)
|
||||||
for (const tool of step.tools) {
|
for (const tool of step.tools) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue