message: fixed tag matching for YAML file format
This commit is contained in:
parent
e3e79cf736
commit
ffcf500acb
@ -372,10 +372,6 @@ class Message():
|
||||
tags = TagLine(fd.readline()).tags()
|
||||
except TagError:
|
||||
fd.seek(pos)
|
||||
if tags_or or tags_and or tags_not:
|
||||
# match with an empty set if the file has no tags
|
||||
if not match_tags(tags, tags_or, tags_and, tags_not):
|
||||
return None
|
||||
# AILine (Optional)
|
||||
try:
|
||||
pos = fd.tell()
|
||||
@ -400,6 +396,12 @@ class Message():
|
||||
answer = Answer.from_list(text[answer_idx + 1:])
|
||||
except ValueError:
|
||||
question = Question.from_list(text[question_idx:])
|
||||
# match tags AFTER reading the whole file
|
||||
# -> make sure it's a valid 'txt' file format
|
||||
if tags_or or tags_and or tags_not:
|
||||
# match with an empty set if the file has no tags
|
||||
if not match_tags(tags, tags_or, tags_and, tags_not):
|
||||
return None
|
||||
return cls(question, answer, tags, ai, model, file_path)
|
||||
|
||||
@classmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user