Skip to content

Commit

Permalink
Add 13 lines in ToolResult.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
AtlantisPleb committed Aug 28, 2024
1 parent 61d605e commit 8c45725
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions panes/chat/ToolResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,21 @@ const getToolParams = (toolName: string, args: any): string => {
}
}
const filteredArgs = Object.entries(args).filter(([key]) => !['token', 'repoContext', 'content', 'path'].includes(key));
return filteredArgs.map(([key, value]) => `${key}: ${typeof value === 'string' ? value : '[complex value]'}`).join(', ');
return filteredArgs.map(([key, value]) => {
if (typeof value === 'string') {
return `${key}: ${value}`;
} else if (typeof value === 'number' || typeof value === 'boolean') {
return `${key}: ${value}`;
} else if (value === null) {
return `${key}: null`;
} else if (Array.isArray(value)) {
return `${key}: [Array]`;
} else if (typeof value === 'object') {
return `${key}: {Object}`;
} else {
return `${key}: ${typeof value}`;
}
}).join(', ');
};

export const ToolResult: React.FC<ToolResultProps> = ({ toolName, args, result, state }) => {
Expand Down Expand Up @@ -123,4 +137,4 @@ export const ToolResult: React.FC<ToolResultProps> = ({ toolName, args, result,
</div>
</div>
);
};
};

0 comments on commit 8c45725

Please sign in to comment.