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

[Power pages Copilo] Updated user prompt telemetry event to include flag for suggested prompt #744

Merged
merged 32 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b0b83f0
getting info about selected code
Sep 27, 2023
59cb3b5
showing label for selected lines of code
Sep 29, 2023
a48f1c8
add flag to disable feature
Sep 29, 2023
8d96a0c
updated responsiveness
Sep 29, 2023
321030b
code formatting fix
Sep 29, 2023
9c3dcd7
Merge branch 'main' into users/amitjoshi/labelForSelectedCode
tyaginidhi Sep 29, 2023
49a6de4
removed log statement
Sep 29, 2023
fbc324b
Merge branch 'users/amitjoshi/labelForSelectedCode' of https://github…
Sep 29, 2023
d9bef02
handles empty selections
Sep 29, 2023
662cc05
passing and showing user selected code to copilot
Sep 29, 2023
4fa0dad
setting fixed vertical height for user code
Oct 4, 2023
4317781
Merge branch 'main' into users/amitjoshi/showingSelectedCodeInCopilot…
Oct 4, 2023
fd28310
removed redundant code
Oct 4, 2023
8b9ce0d
added comment
Oct 4, 2023
7455aa9
Merge branch 'main' into users/amitjoshi/showingSelectedCodeInCopilot…
Oct 5, 2023
2d78054
added const for explainCode msg
Oct 5, 2023
b8774a6
sending localized string to copilot webview
Oct 6, 2023
de8b869
gpt-tokenizer integration
Oct 6, 2023
07fc8d1
user prompt with selected code and 'explain' check
Oct 12, 2023
2b5efe2
showing context cmd only when copilot registered
Oct 13, 2023
810176c
update handling of empty snippet
Oct 13, 2023
288b11c
Merge branch 'main' of https://github.com/microsoft/powerplatform-vsc…
Oct 16, 2023
51da821
updated when clause
Oct 16, 2023
6ba0b1f
moved code to skip in a const
Oct 17, 2023
02cca4e
Merge branch 'main' into users/amitjoshi/gptTokenizerIntegration
amitjoshi438 Oct 17, 2023
df0149c
Added telemetry
Oct 17, 2023
5a7f080
Merge branch 'users/amitjoshi/gptTokenizerIntegration' of https://git…
Oct 17, 2023
ca205f4
flag for suggested prompt and user icon update
Oct 17, 2023
fc84036
Merge branch 'main' into users/amitjoshi/suggestedPromptTelemetry
Oct 18, 2023
163c085
suggested telemetry
Oct 18, 2023
a9b49b7
removed comment
Oct 18, 2023
f78f385
Merge branch 'main' into users/amitjoshi/suggestedPromptTelemetry
amitjoshi438 Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/common/copilot/PowerPagesCopilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {
break;
}
case "newUserPrompt": {
sendTelemetryEvent(this.telemetry, { eventName: CopilotUserPromptedEvent, copilotSessionId: sessionID, aibEndpoint: this.aibEndpoint ?? '', orgId: orgID }); //TODO: Add active Editor info
sendTelemetryEvent(this.telemetry, { eventName: CopilotUserPromptedEvent, copilotSessionId: sessionID, aibEndpoint: this.aibEndpoint ?? '', orgId: orgID, isSuggestedPrompt: String(data.value.isSuggestedPrompt) }); //TODO: Add active Editor info
orgID
? (async () => {
const { activeFileParams } = this.getActiveEditorContent();
await this.authenticateAndSendAPIRequest(data.value, activeFileParams, orgID, this.telemetry);
await this.authenticateAndSendAPIRequest(data.value.userPrompt, activeFileParams, orgID, this.telemetry);
})()
: (() => {
this.sendMessageToWebview({ type: 'apiResponse', value: AuthProfileNotFound });
Expand Down
10 changes: 5 additions & 5 deletions src/common/copilot/assets/scripts/copilot.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,10 @@
vscode.postMessage({ type: "login" });
}

function getApiResponse(userPrompt) {
function getApiResponse(userPrompt, isSuggestedPrompt) {
apiResponseHandler = handleAPIResponse();
apiResponseHandler.updateThinking("Working on it...");
vscode.postMessage({ type: "newUserPrompt", value: userPrompt });
vscode.postMessage({ type: "newUserPrompt", value: {userPrompt: userPrompt, isSuggestedPrompt: isSuggestedPrompt} });
}

function insertCode(code) {
Expand All @@ -517,7 +517,7 @@
vscode.postMessage({ type: "walkthrough" });
}

function processUserInput(input) {
function processUserInput(input, isSuggestedPrompt = false) {
if (apiResponseInProgress) {
return;
}
Expand All @@ -527,7 +527,7 @@
chatInput.disabled = true;
saveInputToHistory(input);
apiResponseInProgress = true;
getApiResponse(userPrompt); //TODO: userPrompt object should be passed
getApiResponse(userPrompt, isSuggestedPrompt);
chatInput.value = "";
chatInput.focus();
}
Expand Down Expand Up @@ -592,7 +592,7 @@

function handleSuggestionsClick() {
const suggestedPrompt = this.innerText.trim();
processUserInput(suggestedPrompt);
processUserInput(suggestedPrompt, true);
}

chatInput.addEventListener('keydown', handleArrowKeys);
Expand Down
1 change: 1 addition & 0 deletions src/common/copilot/telemetry/ITelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export interface IProDevCopilotTelemetryData {
aibEndpoint?: string,
orgUrl?: string,
tokenSize?: string
isSuggestedPrompt?: string;
}
1 change: 1 addition & 0 deletions src/common/copilot/telemetry/copilotTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function sendTelemetryEvent(telemetry: ITelemetry, telemetryData: IProDev
telemetryDataProperties.dataverseEntity = telemetryData.dataverseEntity ? telemetryData.dataverseEntity : '';
telemetryDataProperties.responseStatus = telemetryData.responseStatus ? telemetryData.responseStatus : '';
telemetryDataProperties.tokenSize = telemetryData.tokenSize ? telemetryData.tokenSize : '';
telemetryDataProperties.isSuggestedPrompt = telemetryData.isSuggestedPrompt ? telemetryData.isSuggestedPrompt : '';

if (telemetryData.error) {
telemetryDataProperties.eventName = telemetryData.eventName;
Expand Down