mirror of
https://github.com/aljazceru/goose.git
synced 2026-01-01 13:34:30 +01:00
fix the output not being visible issue (#3491)
This commit is contained in:
@@ -62,6 +62,8 @@ export default function ProgressiveMessageList({
|
||||
const [isLoading, setIsLoading] = useState(() => messages.length > showLoadingThreshold);
|
||||
const timeoutRef = useRef<number | null>(null);
|
||||
const mountedRef = useRef(true);
|
||||
const hasOnlyToolResponses = (message: Message) =>
|
||||
message.content.every((c) => c.type === 'toolResponse');
|
||||
|
||||
// Try to use context manager, but don't require it for session history
|
||||
let hasContextHandlerContent: ((message: Message) => boolean) | undefined;
|
||||
@@ -199,7 +201,7 @@ export default function ProgressiveMessageList({
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<UserMessage message={message} />
|
||||
!hasOnlyToolResponses(message) && <UserMessage message={message} />
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -44,29 +44,8 @@ const isUserMessage = (message: Message): boolean => {
|
||||
return true;
|
||||
};
|
||||
|
||||
// Filter messages for display (same logic as useChatEngine)
|
||||
const filterMessagesForDisplay = (messages: Message[]): Message[] => {
|
||||
return 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 messages.filter((message) => message.display);
|
||||
};
|
||||
|
||||
interface SessionHistoryViewProps {
|
||||
|
||||
@@ -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