Skip to content

chore: add insert below action for ask ai anything - #23

Draft
richardshiue wants to merge 1 commit into
mainfrom
chore/add-insert-below-for-ask-ai
Draft

richardshiue wants to merge 1 commit into
mainfrom
chore/add-insert-below-for-ask-ai

Conversation

@richardshiue

@richardshiue richardshiue commented Jul 24, 2025 •

Copy link
Copy Markdown
Contributor

Description


Checklist

General

  • I've included relevant documentation or comments for the changes introduced.
  • I've tested the changes in multiple environments (e.g., different browsers, operating systems).

Testing

  • I've added or updated tests to validate the changes introduced for AppFlowy Web.

Feature-Specific

  • For feature additions, I've added a preview (video, screenshot, or demo) in the "Feature Preview" section.
  • I've verified that this feature integrates seamlessly with existing functionality.

Summary by Sourcery

Add "Insert Below" action to Ask Anything tool for existing content, expose initialContent in writer context, introduce separate accept handler, and pin pnpm version.

New Features:

  • Add "Insert Below" action to Ask Anything component when editing existing content.

Enhancements:

  • Expose initialContent function and separate accept method in WriterContext and provider.

Build:

  • Pin pnpm package manager version in package.json.

@sourcery-ai

sourcery-ai Bot commented Jul 24, 2025 •

Copy link
Copy Markdown

Reviewer's Guide

This PR implements a new “Insert Below” action for the AskAnything tool by introducing an initialContent retrieval hook in the writer context and conditionally augmenting the action set based on whether there’s existing input, plus adding a package manager field in package.json.

Class diagram for AIAssistantProvider context value changes

classDiagram
  class AIAssistantProvider {
    +initialContent(): string | undefined
    +provides WriterContextTypes
  }
  class WriterContextTypes {
    +initialContent(): string | undefined
  }
  AIAssistantProvider --|> WriterContextTypes : provides
Loading

File-Level Changes

Change Details Files
Enhanced AskAnything actions with conditional Insert Below option
  • Imported InsertBelowIcon asset
  • Extended actions array to include “insert-below” when initialContent exists
  • Swapped keep/accept callbacks based on content presence
src/components/ai-writer/tools/ask-anything.tsx
Added initialContent hook to WriterContext and provider
  • Defined initialContent callback in ai-assistant-provider
  • Provided initialContent via WriterContext.Provider value
  • Augmented context interface in src/writer/context.ts
src/provider/ai-assistant-provider.tsx
src/writer/context.ts
Declared package manager in package.json
  • Added pnpm@8.11.0+sha1 spec under packageManager field
package.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@richardshiue
richardshiue force-pushed the chore/add-insert-below-for-ask-ai branch from 2afcc26 to d8aaed5 Compare July 25, 2025 07:25
@richardshiue
richardshiue force-pushed the chore/add-insert-below-for-ask-ai branch from d8aaed5 to 630663e Compare July 28, 2025 06:48
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