Skip to content

Commit

Permalink
Refactor PowerPagesChatParticipantConstants and CreateSiteCommand
Browse files Browse the repository at this point in the history
- Add NL2SITE_GENERATING_SITE constant for generating a new Power Pages site
- Update progress message in CreateSiteCommand to use NL2SITE_GENERATING_SITE constant
- Remove unnecessary markdown formatting in CreateSiteHelper error handling
  • Loading branch information
amitjoshi committed Nov 13, 2024
1 parent 3ea5734 commit 0689502
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ export const NL2PAGE_SCOPE = 'Page';
export const NL2SITE_REQUEST_FAILED = vscode.l10n.t('Failed to get site content from NL2Site service');
export const NL2PAGE_GENERATING_WEBPAGES = vscode.l10n.t("Generating webpages...");
export const NL2PAGE_RESPONSE_FAILED = 'Failed to get page content from NL2Page service';
export const NL2SITE_GENERATING_SITE = vscode.l10n.t("Generating a new Power Pages site...");
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import { Command } from "../../../CommandRegistry";
import * as vscode from 'vscode';
import { createSite } from "./CreateSiteHelper";
import { NL2SITE_GENERATING_SITE } from "../../PowerPagesChatParticipantConstants";

export class CreateSiteCommand implements Command {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async execute(request: any, stream: vscode.ChatResponseStream): Promise<any> {
const { prompt, intelligenceAPIEndpointInfo, intelligenceApiToken, powerPagesAgentSessionId, telemetry } = request;

stream.progress('Generating a new Power Pages site...');
stream.progress(NL2SITE_GENERATING_SITE);
try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const result = await createSite(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const createSite = async (intelligenceEndpoint: string, intelligenceApiTo
};

} catch (error) {
stream.markdown(`Error: ${(error as Error).message}`);
stream.markdown(`${(error as Error).message}`);
throw error;
}
};
Expand Down

0 comments on commit 0689502

Please sign in to comment.