feat: Full code review, bug fixes, and philosophy book generation
This commit includes: - A full code review and bug fixes for language drift, package loading, and CLI crashes. - The generated 15,000-word philosophy manuscript. - CODE_REVIEW.md and CHANGELOG.md documenting the process.
This commit is contained in:
@@ -105,11 +105,12 @@ Return your critique as a JSON with: {"score": 0.0-1.0, "strengths": [], "weakne
|
||||
system_message="""You are a Professional Writer.
|
||||
|
||||
After receiving critique from the Literary Critic, Genre Expert, and Story Editor:
|
||||
1. Consider each feedback point
|
||||
2. Identify what to revise
|
||||
3. Output your revision plan
|
||||
1. Consider each feedback point.
|
||||
2. Rewrite the chapter to incorporate the suggestions while maintaining the original strengths.
|
||||
3. Ensure the prose is high-quality, engaging, and follows the story context.
|
||||
4. IMPORTANT: You must respond ONLY in English. Do not use Chinese characters.
|
||||
|
||||
You do NOT rewrite - you plan revisions. Return: {"revision_plan": [], "priorities": []}""",
|
||||
Output the complete revised chapter text.""",
|
||||
llm_config={
|
||||
"model": self.model,
|
||||
"api_key": self.api_key,
|
||||
@@ -264,23 +265,18 @@ End with a final verdict: APPROVED, MINOR_REVISIONS, or MAJOR_REVISIONS.
|
||||
## Your Task:
|
||||
Revise the chapter to address the weaknesses identified in the critique.
|
||||
Preserve the strengths. Improve the story, pacing, and prose.
|
||||
Output ONLY the full, revised chapter text.
|
||||
"""
|
||||
# Use the writer agent to revise
|
||||
revision_result = self.agents["writer"].initiate_chat(
|
||||
self.manager,
|
||||
message=revision_request,
|
||||
summary_method="reflection_with_llm",
|
||||
# Use the writer agent to generate the revision
|
||||
revised = self.agents["writer"].generate_reply(
|
||||
messages=[{"role": "user", "content": revision_request}],
|
||||
)
|
||||
|
||||
# Extract revised content from the chat
|
||||
if hasattr(revision_result, 'chat_history'):
|
||||
# Get the last response as revised content
|
||||
revised = revision_result.chat_history[-1].get('content', '') if revision_result.chat_history else current_content
|
||||
if revised and len(revised) > 100:
|
||||
current_content = revised
|
||||
print(f" ✏️ Revision applied, new length: {len(current_content)} chars")
|
||||
else:
|
||||
print(f" ⚠️ No valid revision received, keeping current content")
|
||||
if isinstance(revised, str) and len(revised) > 100:
|
||||
current_content = revised
|
||||
print(f" ✏️ Revision applied, new length: {len(current_content)} chars")
|
||||
else:
|
||||
print(f" ⚠️ No valid revision received, keeping current content. Response: {revised}")
|
||||
|
||||
except Exception as e:
|
||||
print(f" ⚠️ Revision failed: {e}, continuing with current content")
|
||||
|
||||
Reference in New Issue
Block a user