refactor(kb_utils): 简化文件路径处理逻辑
This commit is contained in:
parent
1043f9e84f
commit
f1098f0c7d
@ -49,8 +49,8 @@ def prepare_item_metadata(item: str, content_type: str, db_id: str) -> dict:
|
||||
file_path = Path(item)
|
||||
file_id = f"file_{hashstr(str(file_path) + str(time.time()), 6)}"
|
||||
file_type = file_path.suffix.lower().replace(".", "")
|
||||
filename = os.path.relpath(file_path, Path.cwd())
|
||||
item_path = str(file_path)
|
||||
filename = file_path.name
|
||||
item_path = os.path.relpath(file_path, Path.cwd())
|
||||
else: # URL
|
||||
file_id = f"url_{hashstr(item + str(time.time()), 6)}"
|
||||
file_type = "url"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user