mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2025-12-09 01:59:43 +00:00
Hide result message for Read and Edit
This commit is contained in:
@@ -574,15 +574,36 @@ class ClaudeChatProvider {
|
|||||||
let resultContent = content.content || 'Tool executed successfully';
|
let resultContent = content.content || 'Tool executed successfully';
|
||||||
const isError = content.is_error || false;
|
const isError = content.is_error || false;
|
||||||
|
|
||||||
// Show tool result and save to conversation
|
// Find the last tool use to get the tool name
|
||||||
this._sendAndSaveMessage({
|
const lastToolUse = this._currentConversation[this._currentConversation.length-1]
|
||||||
type: 'toolResult',
|
|
||||||
data: {
|
const toolName = lastToolUse?.data?.toolName;
|
||||||
content: resultContent,
|
|
||||||
isError: isError,
|
// Don't send tool result for Read and Edit tools unless there's an error
|
||||||
toolUseId: content.tool_use_id
|
if ((toolName === 'Read' || toolName === 'Edit') && !isError) {
|
||||||
}
|
// Still send to UI to hide loading state, but mark it as hidden
|
||||||
});
|
this._sendAndSaveMessage({
|
||||||
|
type: 'toolResult',
|
||||||
|
data: {
|
||||||
|
content: resultContent,
|
||||||
|
isError: isError,
|
||||||
|
toolUseId: content.tool_use_id,
|
||||||
|
toolName: toolName,
|
||||||
|
hidden: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Show tool result and save to conversation
|
||||||
|
this._sendAndSaveMessage({
|
||||||
|
type: 'toolResult',
|
||||||
|
data: {
|
||||||
|
content: resultContent,
|
||||||
|
isError: isError,
|
||||||
|
toolUseId: content.tool_use_id,
|
||||||
|
toolName: toolName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1646,6 +1646,71 @@ const styles = `
|
|||||||
color: var(--vscode-descriptionForeground);
|
color: var(--vscode-descriptionForeground);
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tool loading animation */
|
||||||
|
.tool-loading {
|
||||||
|
padding: 16px 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
background-color: var(--vscode-panel-background);
|
||||||
|
border-top: 1px solid var(--vscode-panel-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-spinner {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-ball {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--vscode-button-background);
|
||||||
|
animation: bounce 1.4s ease-in-out infinite both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-ball:nth-child(1) { animation-delay: -0.32s; }
|
||||||
|
.loading-ball:nth-child(2) { animation-delay: -0.16s; }
|
||||||
|
.loading-ball:nth-child(3) { animation-delay: 0s; }
|
||||||
|
|
||||||
|
@keyframes bounce {
|
||||||
|
0%, 80%, 100% {
|
||||||
|
transform: scale(0.6);
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
40% {
|
||||||
|
transform: scale(1);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--vscode-descriptionForeground);
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tool completion indicator */
|
||||||
|
.tool-completion {
|
||||||
|
padding: 8px 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background-color: rgba(76, 175, 80, 0.1);
|
||||||
|
border-top: 1px solid rgba(76, 175, 80, 0.2);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.completion-icon {
|
||||||
|
color: #4caf50;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.completion-text {
|
||||||
|
color: var(--vscode-foreground);
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
</style>`
|
</style>`
|
||||||
|
|
||||||
export default styles
|
export default styles
|
||||||
@@ -722,6 +722,15 @@ const html = `<!DOCTYPE html>
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addToolResultMessage(data) {
|
function addToolResultMessage(data) {
|
||||||
|
// For Read and Edit tools with hidden flag, just hide loading state and show completion message
|
||||||
|
if (data.hidden && (data.toolName === 'Read' || data.toolName === 'Edit') && !data.isError) {
|
||||||
|
// Show completion message
|
||||||
|
const toolName = data.toolName;
|
||||||
|
const completionText = toolName === 'Read' ? '✅ Read completed' : '✅ Edit completed';
|
||||||
|
addMessage(completionText, 'system');
|
||||||
|
return; // Don't show the result message
|
||||||
|
}
|
||||||
|
|
||||||
const messageDiv = document.createElement('div');
|
const messageDiv = document.createElement('div');
|
||||||
messageDiv.className = data.isError ? 'message error' : 'message tool-result';
|
messageDiv.className = data.isError ? 'message error' : 'message tool-result';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user