Removed redundant metrics, fixed description accuracy, and excluded no-data fallback from generation timing.
CI / Formatting (push) Successful in 4s
CI / Linting (push) Successful in 4s
CI / Tests (push) Successful in 23s
CI / Type Checking (push) Successful in 10s
CI / Spelling (push) Successful in 5s

This commit is contained in:
2026-03-23 15:31:43 -04:00
parent 70095f3184
commit bc9f7fa539
5 changed files with 11 additions and 37 deletions
+9 -12
View File
@@ -163,15 +163,15 @@ async def generate(
:param hard_limit: Character count to hard-cut the sentence at.
:return: A new generated sentence.
"""
word = await db.get_random_start_word(channel_id)
if word is None:
return (
"There's not enough data to generate a message yet."
" Chat a bit more so I can learn how this channel talks!"
)
with metrics.GENERATION_DURATION.time():
word = await db.get_random_start_word(channel_id)
if word is None:
return (
"There's not enough data to generate a message yet."
" Chat a bit more so I can learn how this channel talks!"
)
parts: list[str] = [word]
current_length = len(word)
@@ -201,7 +201,4 @@ async def generate(
result = result[:hard_limit]
# Strip the internal sentence-end marker so it never appears in output.
result = result.removesuffix(DEFAULT_SENTENCE_END)
metrics.GENERATED_MESSAGE_LENGTH.observe(len(result))
return result
return result.removesuffix(DEFAULT_SENTENCE_END)