Skip to content

Commit 194b621

Browse files
committed
Refactor chunking debug log in ai_moderator.py
Improved readability of the debug log statement by calculating the number of chunks in a separate variable before logging. No functional changes to chunking logic.
1 parent 3a26a50 commit 194b621

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/services/ai/ai_moderator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ def moderate_content(self, content, content_type='text', custom_prompt=None):
313313

314314
# Force chunking if content is too large BY CHARACTER COUNT
315315
if content_chars > MAX_CHARS_PER_CHUNK:
316-
current_app.logger.debug(f"Chunking content: {content_chars} chars split into {
317-
(content_chars // MAX_CHARS_PER_CHUNK) + 1} chunks")
316+
num_chunks = (content_chars // MAX_CHARS_PER_CHUNK) + 1
317+
current_app.logger.debug(
318+
f"Chunking content: {content_chars} chars split into {num_chunks} chunks")
318319

319320
# Split by character count, not tokens
320321
chunks = []

0 commit comments

Comments
 (0)