-
Notifications
You must be signed in to change notification settings - Fork 28
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
UI for metadata filters #484
Conversation
…to corpus-dev-ui
"size": {"type": int}, | ||
"extension": {"type": str}, |
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.
We can keep this for now as it is supplied by our default LocalDocument
, but they have to be variable before we can merge into main
.
return self.convert_operator(self.operator)( | ||
key=self.key, value=self.convert_value(self.value) | ||
) |
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.
Instead of letting convert_operator
return the convenience method, let's have it return the actual operator and instantiate the MetadataFilter
manually:
return self.convert_operator(self.operator)( | |
key=self.key, value=self.convert_value(self.value) | |
) | |
return MetadataFilter( | |
operator=self.convert_operator(self.operator), | |
key=self.key, | |
value=self.convert_value(self.value), | |
) |
|
||
self.delete_buttons = [] | ||
|
||
# dummy_row = FilterRow(key="document_name", operator="==", value="applications.md") |
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.
# dummy_row = FilterRow(key="document_name", operator="==", value="applications.md") |
self.metadata_filters = self.metadata_filters + [new_metadata_filter_row] | ||
|
||
def delete_metadata_filter(self, event): | ||
print("should delete filter : ", event) |
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.
print("should delete filter : ", event) |
if not filter.validate(): | ||
result = False | ||
# Do not break, we want to call validate() on every filters |
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.
Why?
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.
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.
In that case the variable naming is confusing. So filter
is not a row, but rather one element inside the row? Maybe name it filter_component
than?
asyncio.ensure_future( | ||
self.did_finish_upload( | ||
self.metadata_filters_builder.get_metadata_filters() | ||
) | ||
) |
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.
Why not make this method async and just await
the result?
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.
The function is a button callback. I have had issues in the past with making such callbacks async. But that seems to work now, so let's do it.
Co-authored-by: Philip Meier <[email protected]>
…to corpus-dev-ui
Superseded by #499. |
This PR adds a UI to open a new chat, either by uploading a document, or by using the existing corpus and adding metadata filters.
Enregistrement.de.l.ecran.2024-08-06.a.17.55.51.mov