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

[BUG] UI keeps track of only the first 20 messages in the chat history #2053

Open
1 of 9 tasks
rohans30 opened this issue Aug 9, 2024 · 1 comment
Open
1 of 9 tasks
Assignees
Labels
bug Something isn't working

Comments

@rohans30
Copy link

rohans30 commented Aug 9, 2024

Pre-check

  • I have searched the existing issues and none cover this bug.

Description

def build_history() -> list[ChatMessage]:`
            history_messages: list[ChatMessage] = []

            for interaction in history:
                history_messages.append(
                    ChatMessage(content=interaction[0], role=MessageRole.USER)
                )
                if len(interaction) > 1 and interaction[1] is not None:
                    history_messages.append(
                        ChatMessage(
                            # Remove from history content the Sources information
                            content=interaction[1].split(SOURCES_SEPARATOR)[0],
                            role=MessageRole.ASSISTANT,
                        )
                    )

            # max 20 messages to try to avoid context overflow
            return history_messages[:20]

This last line where history_message is being spliced with [:20] doesn't make sense because this is grabbing the first 20 messages in the chat history. So if the chat continues longer than 20 messages, then nothing will be added to the chat history. I think this should be changed to [-20:] instead to grab the last 20 messages instead of the first 20.

Steps to Reproduce

Use PrivateGPT UI normally

Expected Behavior

Chat history should comprise of last 20 messages

Actual Behavior

Chat history only tracks first 20 messages

Environment

N/A

Additional Information

No response

Version

No response

Setup Checklist

  • Confirm that you have followed the installation instructions in the project’s documentation.
  • Check that you are using the latest version of the project.
  • Verify disk space availability for model storage and data processing.
  • Ensure that you have the necessary permissions to run the project.

NVIDIA GPU Setup Checklist

  • Check that the all CUDA dependencies are installed and are compatible with your GPU (refer to CUDA's documentation)
  • Ensure an NVIDIA GPU is installed and recognized by the system (run nvidia-smi to verify).
  • Ensure proper permissions are set for accessing GPU resources.
  • Docker users - Verify that the NVIDIA Container Toolkit is configured correctly (e.g. run sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi)
@rohans30 rohans30 added the bug Something isn't working label Aug 9, 2024
@jaluma
Copy link
Collaborator

jaluma commented Aug 13, 2024

Yep, totally right. Can you open a PR with this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants