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

refactor: update string for declarative copilot #11522

Merged
merged 4 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/fx-core/resource/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@
"core.createProjectQuestion.projectType.copilotHelp.detail": "Chat with Github Copilot and get step-by-step instructions to develop your Teams app",
"core.createProjectQuestion.projectType.copilotGroup.title": "Use Copilot",
"core.createProjectQuestion.projectType.createGroup.title": "Create",
"core.createProjectQuestion.projectType.declarativeCopilot.label": "Declarative Copilot",
"core.createProjectQuestion.projectType.declarativeCopilot.title": "Author a Declarative Copilot",
"core.createProjectQuestion.title": "New Project",
"core.createProjectQuestion.capability.botMessageExtension.label": "Start with a Bot",
"core.createProjectQuestion.capability.botMessageExtension.detail": "Create a message extension using Bot Framework",
Expand Down Expand Up @@ -345,6 +347,11 @@
"core.createProjectQuestion.capability.customCopilotAssistantAssistantsApiOption.detail": "Build an AI agent with OpenAI Assistants API and Teams AI Library",
"core.createProjectQuestion.capability.customCopilotAssistant.title": "AI Agent",
"core.createProjectQuestion.capability.customCopilotAssistant.placeholder": "Choose how you want to manage your AI tasks",
"core.createProjectQuestion.capability.declarativeCopilotBasic.title": "Basic Declarative Copilot",
"core.createProjectQuestion.capability.declarativeCopilotBasic.detail": "A declarative Copilot skeleton you can author without any plugin",
"core.createProjectQuestion.capability.declarativeCopilotWithPlugin.title": "Declarative Copilot with a plugin using Azure Functions",
"core.createProjectQuestion.capability.declarativeCopilotWithPlugin.detail": "A declarative Copilot containing a Copilot plugin with a new API from Azure Functions",
"core.createProjectQuestion.declarativeCopilotType.title": "Choose Declarative Copilot Type",
"core.createProjectQuestion.llmService.title": "Service for Large Language Model (LLM)",
"core.createProjectQuestion.llmService.placeholder": "Select a service to access LLMs",
"core.createProjectQuestion.llmServiceOpenAIOption.label": "OpenAI",
Expand Down Expand Up @@ -457,6 +464,13 @@
"core.SampleSelect.title": "Start from a sample",
"core.SampleSelect.placeholder": "Select a sample",
"core.SampleSelect.buttons.viewSamples": "View samples",
"core.question.pluginAvailability.title": "Select Plugin Availability",
"core.pluginAvailability.declarativeCopilot": "Declarative Copilot",
"core.pluginAvailability.copilotForM365": "Copilot for Microsoft 365",
"core.pluginAvailability.declarativeCopilotAndM365": "Both declarative Copilot and Copilot for Microsoft 365",
"core.addPlugin.success": "Plugin \"%s\" added to the project successfully.",
"core.addAction.success": "Action \"%s\" added to the project successfully.",
"core.addActionAndPlugin.success": "Action \"%s\" and plugin \"%s\" added to the project successfully.",
"core.updateBotIdsQuestion.title": "Create new bot(s) for debugging",
"core.updateBotIdsQuestion.placeholder": "Deselect to keep the original botId value",
"_core.updateBotIdsQuestion.placeholder.comment": "'botId' is the field name that shouldn't be localized.",
Expand Down
7 changes: 3 additions & 4 deletions packages/fx-core/src/core/FxCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1712,14 +1712,13 @@ export class FxCore {
}
}

// TODO: localize string below.
let successMessage = "";
if (needAddAction && needAddCopilotPlugin) {
successMessage = `Action \"${actionId}\" and plugin "plugin_1" have been successfully added to the project.`;
successMessage = getLocalizedString("core.addActionAndPlugin.success", actionId, "plugin_1");
} else if (needAddAction) {
successMessage = `Action \"${actionId}\" has been successfully added to the project.`;
successMessage = getLocalizedString("core.addAction.success", actionId);
} else if (needAddCopilotPlugin) {
successMessage = `Plugin \"plugin_1\" has been successfully added to the project.`;
successMessage = getLocalizedString("core.addPlugin.success", "plugin_1");
}

void context.userInteraction.showMessage("info", successMessage, false);
Expand Down
23 changes: 15 additions & 8 deletions packages/fx-core/src/question/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ export class ProjectTypeOptions {
static customizeGpt(): OptionItem {
return {
id: "customize-gpt-type",
label: "Declarative Copilot", // TODO: localize until we have an idea for naming
detail: "Author a Declarative Copilot",
label: getLocalizedString("core.createProjectQuestion.projectType.declarativeCopilot.label"),
detail: getLocalizedString("core.createProjectQuestion.projectType.declarativeCopilot.title"),
groupName: getLocalizedString("core.createProjectQuestion.projectType.createGroup.title"),
};
}
Expand Down Expand Up @@ -864,17 +864,24 @@ export class CapabilityOptions {
static customizeGptBasic(): OptionItem {
return {
id: "basic-declarative-copilot",
label: "Basic Declarative Copilot",
detail: "A declarative Copilot skeleton you can author without any plugin",
label: getLocalizedString(
"core.createProjectQuestion.capability.declarativeCopilotBasic.title"
),
detail: getLocalizedString(
"core.createProjectQuestion.capability.declarativeCopilotBasic.detail"
),
};
}

static customizeGptWithPlugin(): OptionItem {
return {
id: "declarative-copilot-with-plugin-from-scratch",
label: "Declarative Copilot with a plugin using Azure Functions",
detail:
"A declarative Copilot containing a Copilot plugin with a new API from Azure Functions",
label: getLocalizedString(
"core.createProjectQuestion.capability.declarativeCopilotWithPlugin.title"
),
detail: getLocalizedString(
"core.createProjectQuestion.capability.declarativeCopilotWithPlugin.detail"
),
};
}
}
Expand Down Expand Up @@ -921,7 +928,7 @@ export function capabilityQuestion(): SingleSelectQuestion {
case ProjectTypeOptions.customCopilot().id:
return getLocalizedString("core.createProjectQuestion.projectType.customCopilot.title");
case ProjectTypeOptions.customizeGpt().id:
return "Choose Declarative Copilot type";
return getLocalizedString("core.createProjectQuestion.declarativeCopilotType.title");
default:
return getLocalizedString("core.createCapabilityQuestion.titleNew");
}
Expand Down
9 changes: 4 additions & 5 deletions packages/fx-core/src/question/other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,23 +946,22 @@ export function resourceGroupQuestionNode(
}

export class PluginAvailabilityOptions {
// TODO: localize the label
static action(): OptionItem {
return {
id: "action",
label: "Declarative Copilot",
label: getLocalizedString("core.pluginAvailability.declarativeCopilot"),
};
}
static copilotPlugin(): OptionItem {
return {
id: "copilot-plugin",
label: "Copilot for Microsoft 365",
label: getLocalizedString("core.pluginAvailability.copilotForM365"),
};
}
static copilotPluginAndAction(): OptionItem {
return {
id: "copilot-plugin-and-action",
label: "Both declarative Copilot and Copilot for Microsoft 365",
label: getLocalizedString("core.pluginAvailability.declarativeCopilotAndM365"),
};
}

Expand All @@ -978,7 +977,7 @@ export class PluginAvailabilityOptions {
export function selectPluginAvailabilityQuestion(): SingleSelectQuestion {
return {
name: QuestionNames.PluginAvailability,
title: "Select Plugin Availability",
title: getLocalizedString("core.question.pluginAvailability.title"),
cliDescription: "Select plugin availability.",
type: "singleSelect",
staticOptions: PluginAvailabilityOptions.all(),
Expand Down
5 changes: 4 additions & 1 deletion packages/fx-core/tests/question/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3248,7 +3248,10 @@ describe("scaffold question", () => {
assert.isTrue(options.length === 2);
const title =
typeof question.title === "function" ? await question.title(inputs) : question.title;
assert.equal(title, "Choose Declarative Copilot type");
assert.equal(
title,
getLocalizedString("core.createProjectQuestion.declarativeCopilotType.title")
);
return ok({ type: "success", result: CapabilityOptions.customizeGptBasic().id });
} else if (question.name === QuestionNames.AppName) {
return ok({ type: "success", result: "test001" });
Expand Down