fix the output not being visible issue (#3491)
This commit is contained in:
@@ -309,29 +309,8 @@ export const useChatEngine = ({
|
||||
}
|
||||
}, [stop, messages, _setInput, setMessages]);
|
||||
|
||||
// Filter out standalone tool response messages for rendering
|
||||
const filteredMessages = useMemo(() => {
|
||||
return [...ancestorMessages, ...messages].filter((message) => {
|
||||
// Only filter out when display is explicitly false
|
||||
if (message.display === false) return false;
|
||||
|
||||
// Keep all assistant messages and user messages that aren't just tool responses
|
||||
if (message.role === 'assistant') return true;
|
||||
|
||||
// For user messages, check if they're only tool responses
|
||||
if (message.role === 'user') {
|
||||
const hasOnlyToolResponses = message.content.every((c) => c.type === 'toolResponse');
|
||||
const hasTextContent = message.content.some((c) => c.type === 'text');
|
||||
const hasToolConfirmation = message.content.every(
|
||||
(c) => c.type === 'toolConfirmationRequest'
|
||||
);
|
||||
|
||||
// Keep the message if it has text content or tool confirmation or is not just tool responses
|
||||
return hasTextContent || !hasOnlyToolResponses || hasToolConfirmation;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
return [...ancestorMessages, ...messages].filter((message) => message.display);
|
||||
}, [ancestorMessages, messages]);
|
||||
|
||||
// Generate command history from filtered messages
|
||||
|
||||
Reference in New Issue
Block a user