-
Notifications
You must be signed in to change notification settings - Fork 37
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
Update file expiry with RAG chat #435
Update file expiry with RAG chat #435
Conversation
assert ( | ||
ChatMessage.objects.get(chat_history__id=session_id, role=ChatRoleEnum.ai).source_files.first() == uploaded_file | ||
) | ||
assert initial_file_expiry_date != File.objects.get(core_file_uuid=uploaded_file.core_file_uuid).expiry_date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this more utilitarian by adding a last_used date, so it can be used for more than expiry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good idea :)
fe330be
to
1ff6288
Compare
|
||
def __str__(self) -> str: # pragma: no cover | ||
return f"{self.original_file_name} {self.user}" | ||
|
||
def save(self, *args, **kwargs): | ||
if not self.expiry_date: | ||
if not self.last_referenced: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we need this part if we have the migration? (or vice versa)
1ff6288
to
eeeb8ad
Compare
eeeb8ad
to
ce22eb9
Compare
ce22eb9
to
929d927
Compare
Context
File expiry dates are set on file creation (since #425 ), but should be updated to give another 30 days before expiry whenever they are quoted in a RAG chat.
Changes proposed in this pull request
On a call to
/post-message
, the returned source files each have their expiry date extended for another 30 days (or as long into the future as configured with env vars).Guidance to review
Could use Django shell to inspect a file expiry date before and after it is used in a RAG chat.
Relevant links
https://technologyprogramme.atlassian.net/browse/REDBOX-234
Things to check
[ ] I have added any new ENV vars in all deployed environments[ ] I have run integration tests