Skip to content

bugfix: Avoid null reference to last_user_message in ChatHistory#580

Open
eob wants to merge 1 commit intomainfrom
null-reference
Open

bugfix: Avoid null reference to last_user_message in ChatHistory#580
eob wants to merge 1 commit intomainfrom
null-reference

Conversation

@eob
Copy link
Copy Markdown
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
Copy Markdown
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