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

bugfix: Avoid null reference to last_user_message in ChatHistory #580

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eob
Copy link
Contributor

@eob eob commented Oct 7, 2023

@douglas-reid I'm not 100% sure if I'm fixing an error or enabling odd uses of ChatHistory, but some experiments I was doing in the game resulted in attempting to do a completion on a history where the user hadn't yet chimed in, and that caused None-deferences in the code touched in this PR.

Does this look OK to you? I gave it an eyeball scan, but I know this code is very delicate..

@eob eob requested a review from douglas-reid October 7, 2023 02:19
context.chat_history.search(context.chat_history.last_user_message.text, k=3)
.wait()
.to_ranked_blocks()
context.chat_history.search(_last_user_message, k=3).wait().to_ranked_blocks()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context.chat_history.search(_last_user_message, k=3).wait().to_ranked_blocks()
context.chat_history.search(_last_user_message.text, k=3).wait().to_ranked_blocks()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants