Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let cache files like chat_store.json looks more pretty #14227

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llama-index-core/llama_index/core/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def to_dict(self, **kwargs: Any) -> Dict[str, Any]:

def to_json(self, **kwargs: Any) -> str:
data = self.to_dict(**kwargs)
return json.dumps(data)
return json.dumps(data, ensure_ascii=False, indent=4)

# TODO: return type here not supported by current mypy version
@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def persist(
if not fs.exists(dirpath):
fs.makedirs(dirpath)

with fs.open(persist_path, "w") as f:
with fs.open(persist_path, "w", encoding="utf8") as f:
f.write(json.dumps(self.json()))

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def persist(
if not fs.exists(dirpath):
fs.makedirs(dirpath)

with fs.open(persist_path, "w") as f:
f.write(json.dumps(self._data))
with fs.open(persist_path, "w", encoding="utf-8") as f:
f.write(json.dumps(self._data, ensure_ascii=False, indent=4))

@classmethod
def from_persist_path(
Expand Down
Loading