Skip to content

Commit

Permalink
chore: Update PowerPagesCopilot.ts to include sample request in GitHu…
Browse files Browse the repository at this point in the history
…b Copilot chat
  • Loading branch information
amitjoshi committed Jul 12, 2024
1 parent ad58665 commit 4bd8dd2
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 116 deletions.
10 changes: 7 additions & 3 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,25 @@
"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 Expand Up @@ -249,4 +253,4 @@
"The {0} represents profile's Azure Cloud Instances"
]
}
}
}
58 changes: 38 additions & 20 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 All @@ -203,6 +221,10 @@ The {3} represents Solution's Type (Managed or Unmanaged), but that test is loca
<trans-unit id="++CODE++9d6322c1f4d9d3f38aed8bfbe0b2bcadf66ad82c008476fa62541fa069138e94">
<source xml:lang="en">Login</source>
</trans-unit>
<trans-unit id="++CODE++1be32f89a3d1d98bb7011850e83b5753124d58f684bae063674bfdb106026e6d">
<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>
Expand Down Expand Up @@ -296,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 @@ -379,8 +397,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 @@ -454,8 +472,8 @@ The {3} represents Dataverse Environment's Organization ID (GUID)</note>
<source xml:lang="en">Auth Profiles</source>
</trans-unit>
<trans-unit id="microsoft-powerapps-portals.walkthrough.saveConflict.description">
<source xml:lang="en">Avoid accidental overwrites when you try to save outdated code in VS Code for the Web. You can compare the changes side-by-side and decide to accept or revert the changes.

<source xml:lang="en">Avoid accidental overwrites when you try to save outdated code in VS Code for the Web. You can compare the changes side-by-side and decide to accept or revert the changes.
To learn more, visit [Prevent accidental overwrites](command:powerplatform-walkthrough.saveConflict-learn-more).</source>
<note>This is a Markdown formatted string, and the formatting must persist across translations.
The fifth line should be '[TRANSLATION HERE](command:powerplatform-walkthrough.saveConflict-learn-more).', keeping brackets and the text in the parentheses unmodified</note>
Expand Down Expand Up @@ -518,12 +536,12 @@ The fifth line should be '[TRANSLATION HERE](command:powerplatform-walkthrough.s
<source xml:lang="en">File explorer</source>
</trans-unit>
<trans-unit id="microsoft-powerapps-portals.walkthrough.fileSystem.description">
<source xml:lang="en">Find your page files organized in folders under your site name. All your pages are arranged into HTML, CSS, and JS files within the respective site component folders.

You can find site components like forms, content snippets, lists, and more to edit.

To learn more, visit [Power Pages file structure in VS Code](command:powerplatform-walkthrough.fileSystem-documentation).

<source xml:lang="en">Find your page files organized in folders under your site name. All your pages are arranged into HTML, CSS, and JS files within the respective site component folders.
You can find site components like forms, content snippets, lists, and more to edit.
To learn more, visit [Power Pages file structure in VS Code](command:powerplatform-walkthrough.fileSystem-documentation).
[Visit site folder](command:powerplatform-walkthrough.fileSystem-open-folder)</source>
<note>This is a Markdown formatted string, and the formatting must persist across translations.
The seventh line should be '[TRANSLATION HERE](command:powerplatform-walkthrough.fileSystem-documentation).', keeping brackets and the text in the parentheses unmodified
Expand Down Expand Up @@ -557,7 +575,7 @@ The second line should be '[TRANSLATION HERE](command:pacCLI.authPanel.newAuthPr
</trans-unit>
<trans-unit id="microsoft-powerapps-portals.walkthrough.overview.description">
<source xml:lang="en">Now easily edit code of your Power Pages site. Access code from supported site components like forms, content snippets, lists, and more from within Visual Studio Code.

To learn more, visit [Edit Power Pages code in VS Code](command:powerplatform-walkthrough.overview-learn-more).</source>
<note>This is a Markdown formatted string, and the formatting must persist across translations.
The second line should be '[TRANSLATION HERE](command:powerplatform-walkthrough.overview-learn-more)', keeping brackets and the text in the parentheses unmodified</note>
Expand Down Expand Up @@ -613,11 +631,11 @@ The second line should be '[TRANSLATION HERE](command:powerplatform-walkthrough.
</trans-unit>
<trans-unit id="microsoft-powerapps-portals.walkthrough.advancedCapabilities.description">
<source xml:lang="en">Visual Studio Code for Web enables editing and publishing of web pages on your website.

For a command line interface and more advanced capabilities, install the Power Platform Extension for VS Code, available in the VS Code Marketplace for desktop.

For a command line interface and more advanced capabilities, install the Power Platform Extension for VS Code, available in the VS Code Marketplace for desktop.
[Learn More](command:powerplatform-walkthrough.advancedCapabilities-learn-more) about the difference between Visual Studio Code for desktop and web.

[Start coding](command:powerplatform-walkthrough.advancedCapabilities-start-coding)</source>
<note>This is a Markdown formatted string, and the formatting must persist across translations.
The fifth line should be '[TRANSLATION HERE](command:powerplatform-walkthrough.advancedCapabilities-learn-more) TRANSLATION', keeping brackets and the text in the parentheses unmodified
Expand All @@ -627,4 +645,4 @@ The seventh line should be '[TRANSLATION HERE](command:powerplatform-walkthrough
<source xml:lang="en">Which Azure Cloud Power Platform Tools should use for authentication.</source>
</trans-unit>
</body></file>
</xliff>
</xliff>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
"fullName": "Copilot for Power Pages",
"description": "Copilot for Power Pages",
"isSticky": true,
"when": "config.powerPlatform.experimental.powerPagesInGitHubCopilotChat"
"when": "config.powerPlatform.experimental.powerPagesInGitHubCopilotChat",
"sampleRequest": "How can you help with coding for my website?"
}
],
"problemMatchers": [
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, DISCLAIMER_MESSAGE, 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 Down
Loading

0 comments on commit 4bd8dd2

Please sign in to comment.