Nicer automatic title

This commit is contained in:
Nathan Evans 2026-01-06 16:48:14 -08:00
parent e2395e97ba
commit 36b7be72f1
2 changed files with 3 additions and 4 deletions

View File

@ -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(

View File

@ -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?",