Fix backwards compatibility of -W flag.
This commit is contained in:
parent
820d938060
commit
ca3a53e68b
@ -16,7 +16,7 @@ def read_file(fname: pathlib.Path, tags_only: bool = False) -> Dict[str, Any]:
|
|||||||
question = "\n".join(text[question_idx:answer_idx]).strip()
|
question = "\n".join(text[question_idx:answer_idx]).strip()
|
||||||
answer = "\n".join(text[answer_idx + 1:]).strip()
|
answer = "\n".join(text[answer_idx + 1:]).strip()
|
||||||
return {"question": question, "answer": answer, "tags": tags,
|
return {"question": question, "answer": answer, "tags": tags,
|
||||||
"file": pathlib.Path(fname).name}
|
"file": fname.name}
|
||||||
|
|
||||||
|
|
||||||
def dump_data(data: Dict[str, Any]) -> str:
|
def dump_data(data: Dict[str, Any]) -> str:
|
||||||
@ -74,6 +74,7 @@ def create_chat(question: Optional[str],
|
|||||||
if file.suffix == '.yaml':
|
if file.suffix == '.yaml':
|
||||||
with open(file, 'r') as f:
|
with open(file, 'r') as f:
|
||||||
data = yaml.load(f, Loader=yaml.FullLoader)
|
data = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
|
data['file'] = file.name
|
||||||
elif file.suffix == '.txt':
|
elif file.suffix == '.txt':
|
||||||
data = read_file(file)
|
data = read_file(file)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user