Fix Anthropic responses when tools are called

This commit is contained in:
perf3ct
2025-04-15 22:34:23 +00:00
parent 38e7d10fd7
commit e5aab5bc04
2 changed files with 27 additions and 22 deletions

View File

@@ -996,18 +996,18 @@ export default class LlmChatPanel extends BasicWidget {
*/
private showToolExecutionInfo(toolExecutionData: any) {
console.log(`Showing tool execution info: ${JSON.stringify(toolExecutionData)}`);
// Enhanced debugging for tool execution
if (!toolExecutionData) {
console.error('Tool execution data is missing or undefined');
return;
}
// Check for required properties
const actionType = toolExecutionData.action || '';
const toolName = toolExecutionData.tool || 'unknown';
console.log(`Tool execution details: action=${actionType}, tool=${toolName}, hasResult=${!!toolExecutionData.result}`);
// Force action to 'result' if missing but result is present
if (!actionType && toolExecutionData.result) {
console.log('Setting missing action to "result" since result is present');