From 7dea59f026721c0c6b03067abdcb1ccc07dabbb9 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 5 Oct 2024 20:54:37 +0300 Subject: [PATCH] Format tool result if JSON --- public/scripts/tool-calling.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/scripts/tool-calling.js b/public/scripts/tool-calling.js index ffef21071..922b9dc14 100644 --- a/public/scripts/tool-calling.js +++ b/public/scripts/tool-calling.js @@ -529,7 +529,10 @@ export class ToolManager { const preElement = document.createElement('pre'); const codeElement = document.createElement('code'); codeElement.classList.add('language-json'); - data.forEach(i => i.parameters = tryParse(i.parameters)); + data.forEach(i => { + i.parameters = tryParse(i.parameters); + i.result = tryParse(i.result); + }); codeElement.textContent = JSON.stringify(data, null, 2); const toolNames = data.map(i => i.displayName || i.name).join(', '); summaryElement.textContent = `Tool calls: ${toolNames}`;