-
Notifications
You must be signed in to change notification settings - Fork 34k
add basic regex auto-reply support #257691
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
Open
meganrogge
wants to merge
16
commits into
main
Choose a base branch
from
merogge/auto-reply
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+272
−38
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
530f9ce
add basic regex auto-reply support
meganrogge 9a8b646
improve
meganrogge 26578b6
consolidate
meganrogge ad86a2d
fix issues
meganrogge bb7eb1e
continue polling after yes is answered
meganrogge 7993d8a
fix something
meganrogge 97515c4
tweak
meganrogge a8e2198
add for create and run task
meganrogge b3c0fca
consolidate
meganrogge 6432446
fix bug
meganrogge e61a23e
provide real response in message
meganrogge 6caaf79
Add comments , make more generic
meganrogge c7ef7a2
move to elicitation.ts
meganrogge 1725dd1
consolidate further
meganrogge 7a61403
Add telemetry event
meganrogge 98e45b3
Update telemetry events with detail we want
Tyriar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
src/vs/workbench/contrib/elicitation/browser/elicitation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { MarkdownString } from '../../../../base/common/htmlContent.js'; | ||
import { localize } from '../../../../nls.js'; | ||
import { ChatElicitationRequestPart } from '../../chat/browser/chatElicitationRequestPart.js'; | ||
import { ChatModel } from '../../chat/common/chatModel.js'; | ||
import { IChatService } from '../../chat/common/chatService.js'; | ||
import { IToolInvocationContext } from '../../chat/common/languageModelToolsService.js'; | ||
|
||
function createYesNoPrompt( | ||
context: IToolInvocationContext, | ||
chatService: IChatService, | ||
title: string | MarkdownString, | ||
description: string | MarkdownString | ||
): { promise: Promise<boolean>; part?: ChatElicitationRequestPart } { | ||
const chatModel = chatService.getSession(context.sessionId); | ||
if (chatModel instanceof ChatModel) { | ||
const request = chatModel.getRequests().at(-1); | ||
if (request) { | ||
let part: ChatElicitationRequestPart | undefined = undefined; | ||
const promise = new Promise<boolean>(resolve => { | ||
const thePart = part = new ChatElicitationRequestPart( | ||
title, | ||
description, | ||
'', | ||
localize('poll.terminal.accept', 'Yes'), | ||
localize('poll.terminal.reject', 'No'), | ||
async () => { | ||
thePart.state = 'accepted'; | ||
thePart.hide(); | ||
resolve(true); | ||
}, | ||
async () => { | ||
thePart.state = 'rejected'; | ||
thePart.hide(); | ||
resolve(false); | ||
} | ||
); | ||
chatModel.acceptResponseProgress(request, thePart); | ||
}); | ||
return { promise, part }; | ||
} | ||
} | ||
return { promise: Promise.resolve(false) }; | ||
} | ||
|
||
export function promptForMorePolling(title: string, message: string, context: IToolInvocationContext, chatService: IChatService): { promise: Promise<boolean>; part?: ChatElicitationRequestPart } { | ||
return createYesNoPrompt( | ||
context, | ||
chatService, | ||
title, | ||
message | ||
); | ||
} | ||
|
||
export function promptForYesNo(title: string | MarkdownString, message: string | MarkdownString, context: IToolInvocationContext, chatService: IChatService): { promise: Promise<boolean>; part?: ChatElicitationRequestPart } { | ||
return createYesNoPrompt( | ||
context, | ||
chatService, | ||
title, | ||
message | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.