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

Users/amitjoshi/GitHub copilot string updates #997

Merged
merged 24 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2ec0bbc
Users/nityagi/update feature branch (#933)
tyaginidhi May 7, 2024
39c4799
Merge branch 'main' into features/PowerPagesAgent
tyaginidhi May 13, 2024
5945ef7
GitHub copilot chat - @powerpages contribution (#927)
amitjoshi438 May 13, 2024
67dc648
[@powerpages] GitHub copilot auth handling for AIB and PAC (#947)
amitjoshi438 May 17, 2024
386ee28
Merge branch 'main' into features/PowerPagesAgent
tyaginidhi May 20, 2024
2f8af77
Resolve merge conflicts
tyaginidhi May 20, 2024
b1b1145
Merge branch 'main' into features/PowerPagesAgent
tyaginidhi May 21, 2024
4432eb2
[@Powerpages]GitHub copilot request handling (#957)
amitjoshi438 May 22, 2024
9cf51f8
Merge branch 'main' into features/PowerPagesAgent
tyaginidhi May 22, 2024
c587f60
[PowerPages] Copilot Availability Check for @powerpages (#962)
amitjoshi438 May 23, 2024
5b0b9c2
Merge branch 'main' into features/PowerPagesAgent
tyaginidhi May 29, 2024
5305e89
feat: Add telemetry event names for GitHub Power Pages agent (#969)
amitjoshi438 May 31, 2024
18c6c39
chore: Update PowerPagesChatParticipantConstants with disclaimer message
Jun 27, 2024
c6449f9
chore: Update DISCLAIMER_MESSAGE in PowerPagesChatParticipantConstant…
Jun 28, 2024
757286a
Added link to @powerpages in existing copilot
Jul 1, 2024
8f79478
refactor: Update fullName and description in powerpages package.json
Jul 1, 2024
789d0a7
feat: Remove unnecessary code and update GitHub Copilot link in Power…
Jul 2, 2024
b5ac9d8
Merge branch 'main' into users/amitjoshi/githubCopilotStringUpdates
Jul 11, 2024
eb3d162
feat: Add environment message to PowerPagesCopilot.ts
Jul 11, 2024
ad58665
Remove unused enabledApiProposals from package.json
Jul 11, 2024
4bd8dd2
chore: Update PowerPagesCopilot.ts to include sample request in GitHu…
Jul 12, 2024
1ae6c39
chore: string updates for cost
Jul 15, 2024
42d2d94
Merge branch 'main' into users/amitjoshi/githubCopilotStringUpdates
Aug 8, 2024
82a6165
Merge branch 'main' into users/amitjoshi/githubCopilotStringUpdates
tyaginidhi Aug 9, 2024
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
11 changes: 9 additions & 2 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,30 @@
"In your own words, describe what you need. You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages.": "In your own words, describe what you need. You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages.",
"To know more, see <a href=\"https://go.microsoft.com/fwlink/?linkid=2206366\">Copilot in Power Pages documentation.": "To know more, see <a href=\"https://go.microsoft.com/fwlink/?linkid=2206366\">Copilot in Power Pages documentation.",
"Working on it...": "Working on it...",
"You can use this in <a href=\"#\" id=\"github-copilot-link\">GitHub Copilot with @powerpages</a> and leverage best of both world.": "You can use this in <a href=\"#\" id=\"github-copilot-link\">GitHub Copilot with @powerpages</a> and leverage best of both world.",
"NEW": "NEW",
"Copied to clipboard!": "Copied to clipboard!",
"What do you need help with?": "What do you need help with?",
"Make sure AI-generated content is accurate and appropriate before using. <a href=\"https://go.microsoft.com/fwlink/?linkid=2240145\">Learn more</a> | <a href=\"https://go.microsoft.com/fwlink/?linkid=2189520\">View\n terms</a>": "Make sure AI-generated content is accurate and appropriate before using. <a href=\"https://go.microsoft.com/fwlink/?linkid=2240145\">Learn more</a> | <a href=\"https://go.microsoft.com/fwlink/?linkid=2189520\">View\n terms</a>",
"Try @powerpages with GitHub Copilot": "Try @powerpages with GitHub Copilot",
"Get GitHub Copilot to try @powerpages": "Get GitHub Copilot to try @powerpages",
"Let Copilot help you code": "Let Copilot help you code",
"Whether it’s HTML, CSS, JS, or Liquid code, just describe what you need and let AI build it for you. ": "Whether it’s HTML, CSS, JS, or Liquid code, just describe what you need and let AI build it for you. ",
"Try Copilot for Power Pages": "Try Copilot for Power Pages",
"Continue with Copilot for Power Pages": "Continue with Copilot for Power Pages",
"Do not show again": "Do not show again",
"Like something? Tell us more.": "Like something? Tell us more.",
"Dislike something? Tell us more.": "Dislike something? Tell us more.",
"Feedback": "Feedback",
"Tell us more.": "Tell us more.",
"Try and be as specific as possible. Your feedback will be used to improve Copilot. <a href=\"https://privacy.microsoft.com/en-US/data-privacy-notice\"> View privacy details </a>": "Try and be as specific as possible. Your feedback will be used to improve Copilot. <a href=\"https://privacy.microsoft.com/en-US/data-privacy-notice\"> View privacy details </a>",
"Submit": "Submit",
"Please provide a prompt to get started.\n You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages.": "Please provide a prompt to get started.\n You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages.",
"Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.\n\nTo create your website, visit the [Power Pages](https://powerpages.microsoft.com/).\nReturn to this chat and @powerpages can help you write and edit your website code.": "Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.\n\nTo create your website, visit the [Power Pages](https://powerpages.microsoft.com/).\nReturn to this chat and @powerpages can help you write and edit your website code.",
"Authentication failed. Please try again.": "Authentication failed. Please try again.",
"Copilot is not available. Please contact your administrator.": "Copilot is not available. Please contact your administrator.",
"Active auth profile is not found or has expired. Please try again.": "Active auth profile is not found or has expired. Please try again.",
"Make sure AI-generated content is accurate and appropriate before using. [Learn more](https://go.microsoft.com/fwlink/?linkid=2240145) | [View terms](https://go.microsoft.com/fwlink/?linkid=2189520)": "Make sure AI-generated content is accurate and appropriate before using. [Learn more](https://go.microsoft.com/fwlink/?linkid=2240145) | [View terms](https://go.microsoft.com/fwlink/?linkid=2189520)",
"Explain the following code {% include 'Page Copy'%}": "Explain the following code {% include 'Page Copy'%}",
"Hi! @powerpages can help you write, edit, and even summarize your website code.": "Hi! @powerpages can help you write, edit, and even summarize your website code.",
"Select Folder for new PCF Control/Do not translate 'PCF' as it is a product name.": {
"message": "Select Folder for new PCF Control",
"comment": [
Expand Down
35 changes: 29 additions & 6 deletions loc/translations-export/vscode-powerplatform.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
<trans-unit id="++CODE++eebdd24a77d9ad32222660c07777163bf5f6732df2b172351f3f8d5783e4f529">
<source xml:lang="en">Confirm</source>
</trans-unit>
<trans-unit id="++CODE++02c3c88b02a43e1818bf427f60d8e58b84d40c0990e09d01c75fff4a934221d0">
<source xml:lang="en">Continue with Copilot for Power Pages</source>
</trans-unit>
<trans-unit id="++CODE++916fa4a51e4d90e09a42289aa7961a6aff3401424f633240c630ac47f58a6d30">
<source xml:lang="en">Copied to clipboard!</source>
</trans-unit>
Expand Down Expand Up @@ -134,6 +137,9 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++5a2391041cb1f6f5ab0cce07946dbf4222358fbd947768d94ac12ef5329485d3">
<source xml:lang="en">Explain the following code snippet:</source>
</trans-unit>
<trans-unit id="++CODE++f9e17ed11037dab93f8820c30db63b2ff2a045b5761f71818b7291afae60f199">
<source xml:lang="en">Explain the following code {% include 'Page Copy'%}</source>
</trans-unit>
<trans-unit id="++CODE++2310c6b7e5953cab877859ba1fcfa98e58e1508677df9412010e9b578ea237f4">
<source xml:lang="en">Failed to create: {0}.</source>
<note>{0} will be replaced by the error message.</note>
Expand Down Expand Up @@ -169,15 +175,27 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++7184a5edf42e6fc9ef8f53fc1dd73f10b3f6196a23f6d340c4f434e60c366e45">
<source xml:lang="en">GETTING STARTED</source>
</trans-unit>
<trans-unit id="++CODE++ee1d3100df4b00eabd74481b92106e42cce956213372a914082f82702f56470d">
<source xml:lang="en">Get GitHub Copilot to try @powerpages</source>
</trans-unit>
<trans-unit id="++CODE++b9f4adbdfa2deef1eaa415a914f63329ee06c604b5a1bf34645175b9e28a9712">
<source xml:lang="en">Here are a few suggestions to get you started</source>
</trans-unit>
<trans-unit id="++CODE++3639efcd08abb273b1619e82e78c29a7df02c1051b1820e99fc395dcaa3326b8">
<source xml:lang="en">Hi</source>
</trans-unit>
<trans-unit id="++CODE++f307e9947391e3b9ba6e7a7da781c995fcfc8647e780127a4c475b67fccd4d0c">
<source xml:lang="en">Hi! @powerpages can help you write, edit, and even summarize your website code.</source>
</trans-unit>
<trans-unit id="++CODE++57fa6bc42ff8a73f5c9271ebe8a92febd9ec652aea94798eb9023c5512b9dab1">
<source xml:lang="en">Hi! Instantly generate code for Power Pages sites by typing in what you need. To start using Copilot, log in to your Microsoft account.</source>
</trans-unit>
<trans-unit id="++CODE++61dd014ff85ae4c042dbfd3b581668ee350e515d4abbf0d682df335b22bf703a">
<source xml:lang="en">Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.

To create your website, visit the [Power Pages](https://powerpages.microsoft.com/).
Return to this chat and @powerpages can help you write and edit your website code.</source>
</trans-unit>
<trans-unit id="++CODE++1d9bc50f05b58d430726840f771cd25056be57873eb33a5d6aeedfff2ca7e2db">
<source xml:lang="en">Hi! Your Microsoft account doesn’t currently support Copilot. Contact your admin for details.</source>
</trans-unit>
Expand Down Expand Up @@ -207,6 +225,9 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<source xml:lang="en">Make sure AI-generated content is accurate and appropriate before using. &lt;a href=&quot;https://go.microsoft.com/fwlink/?linkid=2240145&quot;&gt;Learn more&lt;/a&gt; | &lt;a href=&quot;https://go.microsoft.com/fwlink/?linkid=2189520&quot;&gt;View
terms&lt;/a&gt;</source>
</trans-unit>
<trans-unit id="++CODE++74f89e02b8d346f38df55113eee5dcbb0c0f31471876c67a9c13a3ff7caeebf9">
<source xml:lang="en">Make sure AI-generated content is accurate and appropriate before using. [Learn more](https://go.microsoft.com/fwlink/?linkid=2240145) | [View terms](https://go.microsoft.com/fwlink/?linkid=2189520)</source>
</trans-unit>
<trans-unit id="++CODE++8f2de600bf940a26c63a7ac23984a12ca8970fcf1a85947aa5566c34e23eea07">
<source xml:lang="en">Managed</source>
</trans-unit>
Expand All @@ -216,6 +237,9 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++7fcd8b1c5225f7d9a771a4a02ca3e4795c3c9202cf2b3c3c879c625abb8b43e4">
<source xml:lang="en">Microsoft wants your feeback</source>
</trans-unit>
<trans-unit id="++CODE++a253ff09c5a8678e1fd1962b2c329245e139e45f9cc6ced4e5d7ad42c4108fc0">
<source xml:lang="en">NEW</source>
</trans-unit>
<trans-unit id="++CODE++9ecf722faa0944de54826f72fe9d734c59300a093bcce9cc47b507460ac80710">
<source xml:lang="en">Name/Rename Auth Profile</source>
</trans-unit>
Expand Down Expand Up @@ -294,10 +318,6 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++7f6276dc63b573d177b7d6e17f787b108e3c8c7d449324ac13a6d06b1be59d8e">
<source xml:lang="en">Please enter a name for the webpage.</source>
</trans-unit>
<trans-unit id="++CODE++f39f65c4f7d519a37b66a00d02a6def9e3721080363dae761b907793330333cd">
<source xml:lang="en">Please provide a prompt to get started.
You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages.</source>
</trans-unit>
<trans-unit id="++CODE++1bac158cc07a75506df3774db0ad7c188c19ccad4943c4cf03da8b6700ef9ce4">
<source xml:lang="en">Power Pages Copilot is now connected to the environment: {0} : {1}</source>
<note>{0} represents the environment name</note>
Expand Down Expand Up @@ -380,8 +400,8 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++4f8c4d58a87feaaff06fd5f9cb84370ab4a42220bf1e8cbedbca716f8f21c9ee">
<source xml:lang="en">To know more, see &lt;a href=&quot;https://go.microsoft.com/fwlink/?linkid=2206366&quot;&gt;Copilot in Power Pages documentation.</source>
</trans-unit>
<trans-unit id="++CODE++8d6329ce370e7f2cf3a5b77a73e0100c08550628408f2763deafe57dce769719">
<source xml:lang="en">Try Copilot for Power Pages</source>
<trans-unit id="++CODE++4a7c431a6572c68bba17c3a5d858adbf5112462574953baf4d7d2fd0619807fe">
<source xml:lang="en">Try @powerpages with GitHub Copilot</source>
</trans-unit>
<trans-unit id="++CODE++d8b8392e2c542950ca64867168e4ef87d4ad606882d5898f826b51c6d553988f">
<source xml:lang="en">Try again</source>
Expand Down Expand Up @@ -435,6 +455,9 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<trans-unit id="++CODE++3c65297a1fc0860c6993f5c8beb4341dd13b71d7f3957daba611adf04a6c971b">
<source xml:lang="en">You are editing a live, public site </source>
</trans-unit>
<trans-unit id="++CODE++beb45bfdd4c3f6da9bb3687e4d9275790d086c1dffaec84839fa9ec9ce4e9ee2">
<source xml:lang="en">You can use this in &lt;a href=&quot;#&quot; id=&quot;github-copilot-link&quot;&gt;GitHub Copilot with @powerpages&lt;/a&gt; and leverage best of both world.</source>
</trans-unit>
<trans-unit id="++CODE++3a928d0a6dd0e0c6b56eb3bf08b20e6361e876fd6b2eeca59f718cbfdc310472">
<source xml:lang="en">dotnet sdk 6.0 or greater must be installed</source>
<note>Do not translate 'dotnet' or 'sdk'</note>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { sendApiRequest } from '../../copilot/IntelligenceApiService';
import { PacWrapper } from '../../../client/pac/PacWrapper';
import { intelligenceAPIAuthentication } from '../../services/AuthenticationProvider';
import { ActiveOrgOutput } from '../../../client/pac/PacTypes';
import { AUTHENTICATION_FAILED_MSG, COPILOT_NOT_AVAILABLE_MSG, NO_PROMPT_MESSAGE, PAC_AUTH_NOT_FOUND, POWERPAGES_CHAT_PARTICIPANT_ID, RESPONSE_AWAITED_MSG, SKIP_CODES, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_INVOKED, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_ORG_DETAILS, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_ORG_DETAILS_NOT_FOUND, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_SCENARIO } from './PowerPagesChatParticipantConstants';
import { AUTHENTICATION_FAILED_MSG, COPILOT_NOT_AVAILABLE_MSG, DISCLAIMER_MESSAGE, NO_PROMPT_MESSAGE, PAC_AUTH_NOT_FOUND, POWERPAGES_CHAT_PARTICIPANT_ID, RESPONSE_AWAITED_MSG, SKIP_CODES, STATER_PROMPTS, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_INVOKED, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_ORG_DETAILS, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_ORG_DETAILS_NOT_FOUND, VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_SCENARIO, WELCOME_MESSAGE, WELCOME_PROMPT } from './PowerPagesChatParticipantConstants';
import { ORG_DETAILS_KEY, handleOrgChangeSuccess, initializeOrgDetails } from '../../utilities/OrgHandlerUtils';
import { getComponentInfo, getEndpoint } from './PowerPagesChatParticipantUtils';
import { getComponentInfo, getEndpoint, provideChatParticipantFollowups } from './PowerPagesChatParticipantUtils';
import { checkCopilotAvailability, getActiveEditorContent } from '../../utilities/Utils';
import { IIntelligenceAPIEndpointInformation } from '../../services/Interfaces';
import { v4 as uuidv4 } from 'uuid';
Expand Down Expand Up @@ -42,6 +42,10 @@ export class PowerPagesChatParticipant {
//TODO: Check the icon image
this.chatParticipant.iconPath = vscode.Uri.joinPath(context.extensionUri, 'src', 'common', 'chat-participants', 'powerpages', 'assets', 'copilot.png');

this.chatParticipant.followupProvider = {
provideFollowups: provideChatParticipantFollowups
};

this.powerPagesAgentSessionId = uuidv4();

this.telemetry = telemetry;
Expand All @@ -57,7 +61,6 @@ export class PowerPagesChatParticipant {
this._disposables.push(orgChangeErrorEvent(async () => {
this.extensionContext.globalState.update(ORG_DETAILS_KEY, { orgID: undefined, orgUrl: undefined });
}));

}

public static getInstance(context: vscode.ExtensionContext, telemetry: ITelemetry | TelemetryReporter, pacWrapper?: PacWrapper) {
Expand Down Expand Up @@ -124,25 +127,32 @@ export class PowerPagesChatParticipant {
};
}

if (request.command) {
//TODO: Handle command scenarios
const userPrompt = request.prompt;

} else {
if (userPrompt === WELCOME_PROMPT) {
stream.markdown(WELCOME_MESSAGE);
return{
metadata: {
command: STATER_PROMPTS
}
}
}

const userPrompt = request.prompt;
if (!userPrompt) {

if (!userPrompt) {
stream.markdown(NO_PROMPT_MESSAGE);

//TODO: String approval is required
stream.markdown(NO_PROMPT_MESSAGE);
return {
metadata: {
command: STATER_PROMPTS
}
};
}

return {
metadata: {
command: ''
}
};
}
if (request.command) {
//TODO: Handle command scenarios

} else {
const { activeFileParams } = getActiveEditorContent();

const { componentInfo, entityName }: IComponentInfo = await getComponentInfo(this.telemetry, this.orgUrl, activeFileParams, this.powerPagesAgentSessionId);
Expand All @@ -162,7 +172,7 @@ export class PowerPagesChatParticipant {
}
stream.markdown('\n');
});

stream.markdown(DISCLAIMER_MESSAGE);
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,26 @@
import * as vscode from 'vscode';
import { ADX_ENTITYFORM, ADX_ENTITYLIST } from '../../copilot/constants';

export const NO_PROMPT_MESSAGE = vscode.l10n.t('Please provide a prompt to get started.\n You can get help with writing code for Power Pages sites in HTML, CSS, and JS languages.');
export const NO_PROMPT_MESSAGE = vscode.l10n.t('Hi! Power Pages lets you build secure, professional websites that you can quickly configure and publish across web browsers and devices.\n\nTo create your website, visit the [Power Pages](https://powerpages.microsoft.com/).\nReturn to this chat and @powerpages can help you write and edit your website code.');
export const POWERPAGES_CHAT_PARTICIPANT_ID = 'powerpages';
export const RESPONSE_AWAITED_MSG = vscode.l10n.t('Working on it...');
export const AUTHENTICATION_FAILED_MSG = vscode.l10n.t('Authentication failed. Please try again.');
export const COPILOT_NOT_AVAILABLE_MSG = vscode.l10n.t('Copilot is not available. Please contact your administrator.');
export const PAC_AUTH_NOT_FOUND = vscode.l10n.t('Active auth profile is not found or has expired. Please try again.');
export const DISCLAIMER_MESSAGE = vscode.l10n.t('Make sure AI-generated content is accurate and appropriate before using. [Learn more](https://go.microsoft.com/fwlink/?linkid=2240145) | [View terms](https://go.microsoft.com/fwlink/?linkid=2189520)');
export const SUPPORTED_ENTITIES = [ADX_ENTITYFORM, ADX_ENTITYLIST];
// Telemetry Event Names
export const VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_INVOKED = 'GitHubPowerPagesAgentInvoked';
export const VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_ORG_DETAILS = 'GitHubPowerPagesAgentOrgDetails';
export const VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_ORG_DETAILS_NOT_FOUND = 'GitHubPowerPagesAgentOrgDetailsNotFound';
export const VSCODE_EXTENSION_GITHUB_POWER_PAGES_AGENT_SCENARIO = 'GitHubPowerPagesAgentScenario';
export const SKIP_CODES = ["", null, undefined, "violation", "unclear", "explain"];
export const EXPLAIN_CODE_PROMPT = vscode.l10n.t('Explain the following code {% include \'Page Copy\'%}');
export const WEB_API_PROMPT = vscode.l10n.t('Write web API code to query active contact records.');
export const FORM_PROMPT = vscode.l10n.t('Write JavaScript code for form field validation to check phone field value is in the valid format.');
export const LIST_PROMPT = vscode.l10n.t('Write JavaScript code to highlight the row where email field is empty in table list.');
export const STATER_PROMPTS = "starterPrompts"
export const WELCOME_PROMPT = 'how can you help with coding for my website?'
export const WELCOME_MESSAGE = vscode.l10n.t('Hi! @powerpages can help you write, edit, and even summarize your website code.')


Loading
Loading