mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2025-12-08 18:09:44 +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';
|
||||
const isError = content.is_error || false;
|
||||
|
||||
// Show tool result and save to conversation
|
||||
this._sendAndSaveMessage({
|
||||
type: 'toolResult',
|
||||
data: {
|
||||
content: resultContent,
|
||||
isError: isError,
|
||||
toolUseId: content.tool_use_id
|
||||
}
|
||||
});
|
||||
// Find the last tool use to get the tool name
|
||||
const lastToolUse = this._currentConversation[this._currentConversation.length-1]
|
||||
|
||||
const toolName = lastToolUse?.data?.toolName;
|
||||
|
||||
// Don't send tool result for Read and Edit tools unless there's an error
|
||||
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);
|
||||
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>`
|
||||
|
||||
export default styles
|
||||
@@ -722,6 +722,15 @@ const html = `<!DOCTYPE html>
|
||||
}
|
||||
|
||||
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');
|
||||
messageDiv.className = data.isError ? 'message error' : 'message tool-result';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user