fix: show token alert popover during agent responses and agent failure cases (#3536)

This commit is contained in:
Zane
2025-07-23 09:33:11 -07:00
committed by GitHub
parent 82528841ba
commit 3d5f395ce6
3 changed files with 15 additions and 9 deletions

View File

@@ -382,7 +382,7 @@ export default function ChatInput({
useEffect(() => {
clearAlerts();
// Only show token alerts if we have loaded the real token limit
// Always show token alerts if we have loaded the real token limit and have tokens
if (isTokenLimitLoaded && tokenLimit && numTokens && numTokens > 0) {
if (numTokens >= tokenLimit) {
// Only show error alert when limit reached
@@ -409,6 +409,16 @@ export default function ChatInput({
},
});
}
} else if (isTokenLimitLoaded && tokenLimit) {
// Always show context window info even when no tokens are present (start of conversation)
addAlert({
type: AlertType.Info,
message: 'Context window',
progress: {
current: 0,
total: tokenLimit,
},
});
}
// Add tool count alert if we have the data

View File

@@ -12,7 +12,6 @@ interface AlertPopoverProps {
export default function BottomMenuAlertPopover({ alerts }: AlertPopoverProps) {
const [isOpen, setIsOpen] = useState(false);
const [hasShownInitial, setHasShownInitial] = useState(false);
const [isHovered, setIsHovered] = useState(false);
const [wasAutoShown, setWasAutoShown] = useState(false);
const [popoverPosition, setPopoverPosition] = useState({ top: 0, left: 0 });
@@ -116,17 +115,14 @@ export default function BottomMenuAlertPopover({ alerts }: AlertPopoverProps) {
// Only auto-show if any of the new/changed alerts have autoShow: true
const hasNewAutoShowAlert = changedAlerts.some((alert) => alert.autoShow === true);
// Auto show the popover only if:
// 1. There are new alerts that should auto-show AND
// 2. We haven't shown this specific alert before (tracked by hasShownInitial)
if (hasNewAutoShowAlert && !hasShownInitial) {
// Auto show the popover for new auto-show alerts
if (hasNewAutoShowAlert) {
setIsOpen(true);
setHasShownInitial(true);
setWasAutoShown(true);
// Start 3 second timer for auto-show
startHideTimer(3000);
}
}, [alerts, hasShownInitial, startHideTimer]);
}, [alerts, startHideTimer]);
// Handle auto-hide based on hover state changes
useEffect(() => {

View File

@@ -35,7 +35,7 @@ export const DirSwitcher: React.FC<DirSwitcherProps> = ({
</div>
</button>
</TooltipTrigger>
<TooltipContent className="max-w-96 overflow-auto scrollbar-thin" side="top">
<TooltipContent side="top">
{window.appConfig.get('GOOSE_WORKING_DIR') as string}
</TooltipContent>
</Tooltip>