Skip to content

Commit 6023a09

Browse files
committed
idk
1 parent cdd74c1 commit 6023a09

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/gitingest/output_formatter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def _format_token_count(text: str) -> str | None:
177177

178178
return str(total_tokens)
179179

180-
# Rename JinjaFormatter to DefaultFormatter throughout the file
181180
class DefaultFormatter:
182181
def __init__(self):
183182
self.env = Environment(loader=BaseLoader())
@@ -217,7 +216,8 @@ def _(self, node: FileSystemDirectory, query):
217216

218217
@summary.register
219218
def _(self, node: FileSystemDirectory, query):
220-
template = """
219+
template = \
220+
"""
221221
Directory structure:
222222
{{ node.tree }}
223223
"""

src/server/query_processor.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,26 @@ async def process_query(
291291
context = ingest_query(query)
292292
digest = context.generate_digest()
293293

294-
summary, tree, content = context.generate_digest()
294+
# Store digest based on S3 configuration
295+
if is_s3_enabled():
296+
# Upload to S3 instead of storing locally
297+
s3_file_path = generate_s3_file_path(
298+
source=query.url,
299+
user_name=cast("str", query.user_name),
300+
repo_name=cast("str", query.repo_name),
301+
commit=query.commit,
302+
include_patterns=query.include_patterns,
303+
ignore_patterns=query.ignore_patterns,
304+
)
305+
s3_url = upload_to_s3(content=context.digest, s3_file_path=s3_file_path, ingest_id=query.id)
306+
# Store S3 URL in query for later use
307+
query.s3_url = s3_url
308+
else:
309+
# Store locally
310+
local_txt_file = Path(clone_config.local_path).with_suffix(".txt")
311+
with local_txt_file.open("w", encoding="utf-8") as f:
312+
f.write(digest)
295313

296-
# Prepare the digest content (tree + content)
297-
digest_content = tree + "\n" + content
298-
_store_digest_content(query, clone_config, digest_content, summary, tree, content)
299314
except Exception as exc:
300315
_print_error(query.url, exc, max_file_size, pattern_type, pattern)
301316
return IngestErrorResponse(error=str(exc))

0 commit comments

Comments
 (0)