Skip to content

Add mode to conversation model messages #517

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
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/extension/prompt/node/chatParticipantTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ export abstract class ChatTelemetry<C extends IDocumentContext | undefined = IDo
response,
this.telemetryMessageId, // That's the message id of the user message
this._documentContext?.document,
this._userTelemetry.extendedBy({ replyType: interactionOutcome.kind })
this._userTelemetry.extendedBy({ replyType: interactionOutcome.kind }),
this._getModeName()
);
}

Expand Down
10 changes: 9 additions & 1 deletion src/extension/prompt/node/defaultIntentRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,20 @@ export class DefaultIntentRequestHandler {
appliedText,
requestId,
this.documentContext?.document,
baseModelTelemetry
baseModelTelemetry,
this.getModeName()
);

return chatResult;
}

private getModeName(): string {
return this.request.modeInstructions ? 'custom' :
this.intent.id === 'editAgent' ? 'agent' :
(this.intent.id === 'edit' || this.intent.id === 'edit2') ? 'edit' :
'ask';
}

private processOffTopicFetchResult(baseModelTelemetry: ConversationalBaseTelemetryData): ChatResult {
// Create starting off topic telemetry and mark event as issued and displayed
this.stream.markdown(this.options.rejectionMessage);
Expand Down
4 changes: 3 additions & 1 deletion src/extension/prompt/node/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export function sendModelMessageTelemetry(
appliedText: string,
requestId: string,
doc: TextDocumentSnapshot | undefined,
baseTelemetry: ConversationalBaseTelemetryData
baseTelemetry: ConversationalBaseTelemetryData,
modeName: string,
): void {
// Get the languages of code blocks within the message
const codeBlockLanguages = getCodeBlocks(appliedText);
Expand All @@ -108,6 +109,7 @@ export function sendModelMessageTelemetry(
headerRequestId: requestId,
uiKind: ChatLocation.toString(location),
codeBlockLanguages: JSON.stringify({ ...codeBlockLanguages }),
mode: modeName,
},
{ messageCharLen: appliedText.length, numCodeBlocks: codeBlockLanguages.length },
baseTelemetry
Expand Down
Loading