mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-02 18:33:33 -05:00
refac: metadata handling in vectordb
This commit is contained in:
14
backend/open_webui/retrieval/vector/utils.py
Normal file
14
backend/open_webui/retrieval/vector/utils.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def stringify_metadata(
|
||||
metadata: dict[str, any],
|
||||
) -> dict[str, any]:
|
||||
for key, value in metadata.items():
|
||||
if (
|
||||
isinstance(value, datetime)
|
||||
or isinstance(value, list)
|
||||
or isinstance(value, dict)
|
||||
):
|
||||
metadata[key] = str(value)
|
||||
return metadata
|
||||
Reference in New Issue
Block a user