Skip to content

Add custom writing instructions for report generation#1610

Open
SiriusYou wants to merge 4 commits intoassafelovic:mainfrom
SiriusYou:feat/custom-writing-instructions
Open

Add custom writing instructions for report generation#1610
SiriusYou wants to merge 4 commits intoassafelovic:mainfrom
SiriusYou:feat/custom-writing-instructions

Conversation

@SiriusYou
Copy link

Summary

  • Adds a Custom Writing Instructions textarea to the frontend UI, allowing users to specify style, tone, and formatting directives for generated reports
  • Instructions are threaded through the full stack (frontend → WebSocket → server → report handlers → writer → prompt injection) and only affect report writing, not research/retrieval
  • Supports Summary and Detailed report types with a guard that skips unsupported types gracefully

Changes

File Change
frontend/index.html Added textarea after Query Domains input
frontend/scripts.js Sends custom_instructions field in WebSocket request
backend/server/server_utils.py Extracts and passes custom_instructions from request data
backend/server/websocket_manager.py Threads custom_instructions through to report handlers with type guard
backend/report_type/basic_report/basic_report.py Accepts and forwards custom_instructions to write_report()
backend/report_type/detailed_report/detailed_report.py Accepts and forwards to intro, subtopic, and conclusion writers
gpt_researcher/agent.py Adds custom_instructions parameter to 3 write methods
gpt_researcher/skills/writer.py Forwards custom_instructions to action functions
gpt_researcher/actions/report_generation.py Core prompt injection — appends instructions to system prompt

Test plan

  • Start backend with python -m uvicorn main:app --reload
  • Open frontend, enter a query with custom instructions (e.g., "Write in bullet points, use formal tone")
  • Run a Summary report — verify instructions appear in generated output style
  • Run a Detailed report — verify instructions affect intro, subtopics, and conclusion
  • Run a report type other than Summary/Detailed — verify it works normally without error
  • Leave custom instructions empty — verify default behavior unchanged

🤖 Generated with Claude Code

Jiayou and others added 4 commits January 18, 2026 23:12
- Document common commands (server, tests, docker, frontend)
- Explain core architecture (GPTResearcher, skills, retrievers)
- Document multi-agent LangGraph system
- Include key configuration and environment variables

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a textarea in the frontend UI that lets users provide custom writing
instructions (style, tone, format directives) which are injected into
report generation prompts. Supports Summary and Detailed report types.

The instructions flow through the full stack: frontend → WebSocket →
server utils → report type handlers → writer skill → report generation
actions, where they are appended to the system prompt only during report
writing (not research/retrieval).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant