Skip to content

Add writing description input to AI Writing Assistant#340

Open
kcarnold wants to merge 1 commit into
mainfrom
claude/add-writing-description-input-pFECI
Open

Add writing description input to AI Writing Assistant#340
kcarnold wants to merge 1 commit into
mainfrom
claude/add-writing-description-input-pFECI

Conversation

@kcarnold

Copy link
Copy Markdown
Contributor

Summary

This PR adds a new optional "writing description" feature to the AI Writing Assistant that allows users to provide context about what they're trying to write. This description is then included in the prompt sent to the AI model to improve the quality and relevance of suggestions.

Key Changes

  • Frontend (AIPanel.tsx)

    • Added writingDescription state to track user input
    • Added a new textarea input field with label "What are you trying to write?" for users to describe their writing intent
    • Updated the API request to include the writing description in the request body
    • Updated logging to capture the writing description in both request and response events
    • Added writingDescription to the dependency array of the handleAIRequest callback
  • Backend (route.ts)

    • Extract writingDescription from the request body
    • Append the writer's intent to the prompt template when a description is provided, formatted as a "Writer's Intent" section
    • The description is inserted before the document content in the prompt
  • Types (index.ts)

    • Added optional writingDescription field to WritingSupportRequest interface

Implementation Details

  • The writing description is optional and only included in the API request if provided
  • Empty descriptions are trimmed and treated as undefined to avoid sending unnecessary data
  • The description is logged in study mode for research purposes
  • The prompt enhancement is done server-side, keeping the implementation clean and maintainable

https://claude.ai/code/session_01BeEBSzBFysATTNMFbRtPWq

…ntext

Adds a textarea at the top of the AIPanel where participants can describe
what they're trying to write (e.g., "telling him we need to move the panel
we'd scheduled for tomorrow"). This description is sent to the API and
injected into all AI condition prompts as a "Writer's Intent" section,
giving the model better context for generating suggestions. The description
is also included in study event logs.

https://claude.ai/code/session_01BeEBSzBFysATTNMFbRtPWq
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.

2 participants