Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend: Not possible to open input history #1119

Open
jns-br opened this issue Jul 7, 2024 · 0 comments · May be fixed by #1121
Open

Frontend: Not possible to open input history #1119

jns-br opened this issue Jul 7, 2024 · 0 comments · May be fixed by #1121

Comments

@jns-br
Copy link

jns-br commented Jul 7, 2024

Describe the bug
There seems to be an error in the implementation of the input history, which was shown in the chat input field in earlier versions. Looking at the source code, the input history itself is indeed implemented, but is missing a button (or other action) to actually open it. I wrote a small fix for this which I will include below, would also be happy to open a PR for this.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Chainlit frontend
  2. Scroll down to chat input field

Expected behavior
A button to open the input history is showing in the chat input field.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome/Firefox
  • Version: 1.1.306

Additional context
Possible fix in frontend/src/components/organisms/chat/history/index.tsx

import HistoryIcon from '@mui/icons-material/History';
import {
  IconButton,
  Menu,
  MenuItem,
  Stack,
  Theme,
  Typography,
  useMediaQuery
} from '@mui/material';


...

export default function InputHistoryButton({ onClick }: Props) {

...

  const handleHistoryButtonClick = (
      event: React.MouseEvent<HTMLButtonElement>
    ) => {
      setAnchorEl(event.currentTarget);
      toggleChatHistoryMenu(true);
    };
  
    const size = useMediaQuery<Theme>((theme) => theme.breakpoints.down('sm'))
      ? 'small'
      : 'medium';
  
    return (
      <div ref={ref}>
        <IconButton
          color="inherit"
          size={size}
          onClick={handleHistoryButtonClick}
        >
          <HistoryIcon />
        </IconButton>
        {menu}
      </div>
    );
}
 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant