Ask minimum and maximum size for blog post - #22
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed logic issues in the new word-count input handling and in failure cases where draft generation can leave an empty draft that still proceeds through review.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds configurable target word count bounds (min/max) to the blog-writing workflow, passing them through the state into the author and reviewer prompts so drafts can be generated and evaluated against a user-provided size range.
Changes:
- Add
MinWords/MaxWords(with defaults) toResearchStateand include the range in author/reviewer turn messages. - Prompt the user for min/max word counts in
Program.csand thread them into the initial workflow state. - Update author prompt text and author agent behavior to avoid overwriting an existing draft when generation returns no content.
File summaries
| File | Description |
|---|---|
| ReviewerAgent.cs | Includes the target word-count range in the reviewer’s per-turn input message. |
| ResearchState.cs | Adds default min/max constants plus MinWords/MaxWords to workflow state. |
| Prompts.cs | Updates author/reviewer system prompts to reference the user-provided word-count range. |
| Program.cs | Prompts for min/max word counts, injects into initial state, adjusts output note on revision cap, and changes temperature default. |
| IAuthorAgent.cs | Updates the author agent contract to allow null draft output. |
| AuthorAgent.cs | Adds word-count range to author input message and avoids clobbering existing drafts when generation yields no content. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+106
to
+111
| if (string.IsNullOrEmpty(draft)) | ||
| { | ||
| // Keep whatever draft already exists rather than clobbering it with a | ||
| // placeholder — an empty/failed generation shouldn't erase real content. | ||
| _logger.LogWarning("Author agent produced no draft; keeping the previous draft (if any)."); | ||
| } |
| var chatOptions = new ChatOptions | ||
| { | ||
| Temperature = 0, | ||
| Temperature = 1, |
Comment on lines
+162
to
+165
| if (string.IsNullOrWhiteSpace(input)) | ||
| { | ||
| return defaultValue; | ||
| } |
Comment on lines
+229
to
+234
| if (result.RevisionNumber >= ResearchState.MaxRevisions) | ||
| { | ||
| // The revision cap terminates the loop even if the reviewer never approved — | ||
| // call that out so the draft above isn't mistaken for a reviewer-approved one. | ||
| Console.WriteLine("Note: Maximum revision limit reached; draft above printed as-is."); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.