diff --git a/src/public/app/widgets/llm_chat/llm_chat_panel.ts b/src/public/app/widgets/llm_chat/llm_chat_panel.ts
index 2feae2cc7..e485cd394 100644
--- a/src/public/app/widgets/llm_chat/llm_chat_panel.ts
+++ b/src/public/app/widgets/llm_chat/llm_chat_panel.ts
@@ -360,31 +360,60 @@ export default class LlmChatPanel extends BasicWidget {
// Fill with tool execution content
toolExecutionElement.innerHTML = `
+
`;
- // Add event listener for the clear button
- const clearButton = toolExecutionElement.querySelector('.tool-execution-chat-clear');
- if (clearButton) {
- clearButton.addEventListener('click', (e) => {
- e.preventDefault();
- e.stopPropagation();
- toolExecutionElement.remove();
+ // Add event listener for the toggle button
+ const toggleButton = toolExecutionElement.querySelector('.tool-execution-toggle');
+ if (toggleButton) {
+ toggleButton.addEventListener('click', () => {
+ const stepsContainer = toolExecutionElement.querySelector('.tool-execution-container');
+ const icon = toggleButton.querySelector('i');
+
+ if (stepsContainer) {
+ if (stepsContainer.classList.contains('collapsed')) {
+ // Expand
+ stepsContainer.classList.remove('collapsed');
+ (stepsContainer as HTMLElement).style.display = 'block';
+ if (icon) {
+ icon.className = 'bx bx-chevron-down';
+ }
+ } else {
+ // Collapse
+ stepsContainer.classList.add('collapsed');
+ (stepsContainer as HTMLElement).style.display = 'none';
+ if (icon) {
+ icon.className = 'bx bx-chevron-right';
+ }
+ }
+ }
});
}
+
+ // Add click handler for the header to toggle expansion as well
+ const header = toolExecutionElement.querySelector('.tool-execution-header');
+ if (header) {
+ header.addEventListener('click', (e) => {
+ // Only toggle if the click isn't on the toggle button itself
+ const target = e.target as HTMLElement;
+ if (target && !target.closest('.tool-execution-toggle')) {
+ const toggleButton = toolExecutionElement.querySelector('.tool-execution-toggle');
+ toggleButton?.dispatchEvent(new Event('click'));
+ }
+ });
+ (header as HTMLElement).style.cursor = 'pointer';
+ }
}
/**
@@ -990,29 +1019,18 @@ export default class LlmChatPanel extends BasicWidget {
toolExecutionElement = document.createElement('div');
toolExecutionElement.className = 'chat-tool-execution mb-3';
- // Create header with title and controls
+ // Create header with title and dropdown toggle
const header = document.createElement('div');
header.className = 'tool-execution-header d-flex align-items-center p-2 rounded';
header.innerHTML = `
Tool Execution
-