Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement edit/insert prompts #5958

Merged
merged 3 commits into from
Oct 22, 2024
Merged

Conversation

thenamankumar
Copy link
Member

closes: https://linear.app/sourcegraph/issue/SRCH-1172/prompts-can-output-into-3-places

This PR integrates with the prompt mode (chat | edit | insert) from the SG API. Prompts with edit or insert mode are executed using the executeEdit, the same way the commands are executed. The prompt is used as the instruction text for executeEdit. First the chat transcript is created, context is fetched and then the executeEdit is called. The FixupTask from the execution is used to construct the response in chat. The response for now shows the diff only.

In BG, the state for interactions mode is saved as intent. The dropdown and icon indicator for to allow users to manually change the mode and to see which mode is set, is only available behind the OneBox feature flag and will not be released yet.

CleanShot 2024-10-21 at 18 28 08@2x

Test plan

  • create a edit/insert prompt
  • execute it from Cody
  • it should work as expected.

Changelog

  • Add ability to execute prompts to perform edits or insert code.

Copy link

‼️ Hey @sourcegraph/cody-security, please review this PR carefully as it introduces the usage of an unsafe_ function or abuses PromptString.

@@ -177,7 +177,9 @@ function iconForContextItem(contextItem: SerializedContextItem): React.Component
? SYMBOL_CONTEXT_MENTION_PROVIDER.id
: contextItem.type === 'repository' || contextItem.type === 'tree'
? REMOTE_REPOSITORY_PROVIDER_URI
: contextItem.providerUri
: contextItem.type === 'openctx'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated improvement.

@@ -415,6 +415,7 @@ export interface Prompt {
description?: string
draft: boolean
autoSubmit?: boolean
mode?: PromptMode
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the version for the api change is already handled in the code for the oct relase

@thenamankumar thenamankumar merged commit 07a44d3 into main Oct 22, 2024
19 of 20 checks passed
@thenamankumar thenamankumar deleted the naman/edit-prompts-command branch October 22, 2024 07:19
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