added option '-a' to match all tags when selecting chat history entries
This commit is contained in:
@@ -64,6 +64,7 @@ def create_chat(question: Optional[str],
|
||||
tags: Optional[List[str]],
|
||||
extags: Optional[List[str]],
|
||||
config: Dict[str, Any],
|
||||
match_all_tags: bool = False,
|
||||
with_tags: bool = False,
|
||||
with_file: bool = False
|
||||
) -> List[Dict[str, str]]:
|
||||
@@ -78,8 +79,11 @@ def create_chat(question: Optional[str],
|
||||
else:
|
||||
continue
|
||||
data_tags = set(data.get('tags', []))
|
||||
tags_match = \
|
||||
not tags or data_tags.intersection(tags)
|
||||
tags_match: bool
|
||||
if match_all_tags:
|
||||
tags_match = not tags or set(tags).issubset(data_tags)
|
||||
else:
|
||||
tags_match = not tags or bool(data_tags.intersection(tags))
|
||||
extags_do_not_match = \
|
||||
not extags or not data_tags.intersection(extags)
|
||||
if tags_match and extags_do_not_match:
|
||||
|
||||
Reference in New Issue
Block a user