Skip to content

Commit ee16d1b

Browse files
CopilotCyberSecDef
andauthored
Address code review feedback: improve test readability and simplify expansion prompt
Agent-Logs-Url: https://github.com/CyberSecDef/NovelForge/sessions/edfa2372-2014-43cf-8520-a4f613600a1b Co-authored-by: CyberSecDef <17597068+CyberSecDef@users.noreply.github.com>
1 parent c906378 commit ee16d1b

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

prompts.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,12 +1141,12 @@ prompts:
11411141
- Preserve the existing voice, tone, and pacing shape.
11421142
- Return the COMPLETE expanded chapter text.
11431143
user: |
1144-
The following chapter is {{ current_words }} words but must be at least
1145-
{{ min_words }} words (target: {{ target_words }} words).
1144+
This chapter currently has {{ current_words }} words. Expand it to meet the
1145+
minimum of {{ min_words }} words (target: {{ target_words }} words).
11461146
1147-
Expand it to at least {{ min_words }} words by deepening scenes, dialogue,
1148-
sensory detail, and character interiority. Do NOT remove or summarize any
1149-
existing content. Return the COMPLETE expanded chapter.
1147+
Deepen scenes, dialogue, sensory detail, and character interiority.
1148+
Do NOT remove or summarize any existing content.
1149+
Return the COMPLETE expanded chapter.
11501150
11511151
---
11521152

tests/test_length_enforcement.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,12 @@ def mock_llm(msgs, action=""):
184184

185185
def test_expansion_handles_llm_failure(self, monkeypatch):
186186
"""If LLM call fails, returns original text."""
187+
def mock_llm(msgs, action=""):
188+
raise RuntimeError("API down")
189+
187190
monkeypatch.setattr(
188191
"novelforge.agents.chapter._helpers.call_llm",
189-
lambda msgs, action="": (_ for _ in ()).throw(RuntimeError("API down")),
192+
mock_llm,
190193
)
191194
original = "short text with few words"
192195
result_text, result_wc = expand_chapter(

0 commit comments

Comments
 (0)