replace Path.is_relative_to to make py38 compatible (#4029)

This commit is contained in:
liunux4odoo 2024-05-16 11:06:22 +08:00 committed by GitHub
parent ede538bfe2
commit 8ca9e8ff28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,9 +42,9 @@ def get_vs_path(knowledge_base_name: str, vector_name: str):
def get_file_path(knowledge_base_name: str, doc_name: str):
doc_path = Path(get_doc_path(knowledge_base_name))
doc_path = Path(get_doc_path(knowledge_base_name)).resolve()
file_path = (doc_path / doc_name).resolve()
if file_path.is_relative_to(doc_path):
if str(file_path).startswith(str(doc_path)):
return str(file_path)