Skip to content

Commit

Permalink
Merge branch 'main' into users/ramukaritik/treeview-for-copresence
Browse files Browse the repository at this point in the history
  • Loading branch information
ritikramuka authored Oct 19, 2023
2 parents b397ddf + 2b63c62 commit 64f087b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
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

0 comments on commit 64f087b

Please sign in to comment.