mirror of
https://github.com/microsoft/graphrag.git
synced 2026-01-14 00:57:23 +08:00
Nicer automatic title
This commit is contained in:
parent
e2395e97ba
commit
36b7be72f1
@ -45,9 +45,8 @@ class StructuredFileReader(InputReader):
|
||||
else gen_sha512_hash({"text": text}, ["text"])
|
||||
)
|
||||
# title is optional - harvest from dict or use filename
|
||||
title = (
|
||||
row[self._title_column] if self._title_column else f"{path} ({index})"
|
||||
)
|
||||
num = f" ({index})" if len(rows) > 1 else ""
|
||||
title = row[self._title_column] if self._title_column else f"{path}{num}"
|
||||
creation_date = await self._storage.get_creation_date(path)
|
||||
documents.append(
|
||||
TextDocument(
|
||||
|
||||
@ -19,7 +19,7 @@ async def test_json_loader_one_file_one_object():
|
||||
reader = create_input_reader(config, storage)
|
||||
documents = await reader.read_files()
|
||||
assert len(documents) == 1
|
||||
assert documents[0].title == "input.json (0)"
|
||||
assert documents[0].title == "input.json"
|
||||
assert documents[0].raw_data == {
|
||||
"title": "Hello",
|
||||
"text": "Hi how are you today?",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user