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

Cody Web: Log inline edit in history #5935

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vovakulikov
Copy link
Contributor

Closes SRCH-1043

It simply adds log-in history for inline edit commands/prompts

Test plan

  • Run an inline command like document code
  • Check that you can find this inline edit command/prompt in the history panel

Copy link

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

Comment on lines +210 to +215
let responseMessage = `Inline ${this.config.task.intent} change was triggered over:\n`
responseMessage += '``` \n' + `${this.config.task.original}\n` + '```\n'
responseMessage += 'Inline change response: \n'
responseMessage += '```\n' + `${responseContent}\n` + '```'
Copy link
Member

Choose a reason for hiding this comment

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

Can you get this reviewed from @taiyab?

Original content might be missing for insert intent and thus only extra \n will be added. We can make it conditional.

@vovakulikov vovakulikov force-pushed the vk/entry-any-inline-edit-in-history branch from f2db49e to 56ae168 Compare October 25, 2024 15:33
@vovakulikov vovakulikov requested review from abeatrix and a team October 25, 2024 17:13
Copy link
Contributor

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

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

I think the edit history should be done in the FixupController for each fixup step. Right now we are hard coded the interaction in provider that wouldn't handle the error in chat UI if the task failed.

I'm happy to chat more and pair on Monday if you have time!

vscode/src/edit/manager.ts Show resolved Hide resolved
@@ -97,6 +103,9 @@ export class EditProvider {
onTurnComplete: async () => {
typewriter.close()
typewriter.stop()
if (options?.saveInHistory) {
void this.saveEditAsChatEntry(text)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can add the feature flag check inside saveEditChatHistory instead? Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change isn't part of any feature flagged feature. We just want to log in history any custom command or OOTB prompts/commands actions

responseMessage += 'Inline change response: \n'
responseMessage += '```\n' + `${responseContent}\n` + '```'

const chatEntry: SerializedChatTranscript = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm I think it might be safer if we use chatBuilder for creating each message and response in different step of inline edit inside FixupController.

@abeatrix
Copy link
Contributor

I think the edit history should be done in the FixupController for each fixup step. Right now we are hard coded the interaction in provider that wouldn't handle the error in chat UI if the task has failed.

I'm happy to chat more and pair on Monday if you have time!

Cc @dominiccooney @pkukielka for advices + verify if this would affect inline edits in JB

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.

3 participants