diff --git a/packages/fx-core/src/component/generator/templates/templateNames.ts b/packages/fx-core/src/component/generator/templates/templateNames.ts index 676d5733fb..44a8b6eb2e 100644 --- a/packages/fx-core/src/component/generator/templates/templateNames.ts +++ b/packages/fx-core/src/component/generator/templates/templateNames.ts @@ -281,10 +281,6 @@ export const inputsToTemplateName: Map<{ [key: string]: any }, TemplateNames> = { [QuestionNames.Capabilities]: CapabilityOptions.aiAssistantBot().id }, TemplateNames.AIAssistantBot, ], - [ - { [QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id }, - TemplateNames.ApiPluginFromScratch, - ], [ { [QuestionNames.Capabilities]: CapabilityOptions.m365SearchMe().id, @@ -355,4 +351,26 @@ export const inputsToTemplateName: Map<{ [key: string]: any }, TemplateNames> = }, TemplateNames.CustomCopilotAssistantAssistantsApi, ], + // Copilot Plugin + [ + { + [QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id, + [QuestionNames.ApiAuth]: ApiAuthOptions.none().id, + }, + TemplateNames.ApiPluginFromScratch, + ], + [ + { + [QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id, + [QuestionNames.ApiAuth]: ApiAuthOptions.apiKey().id, + }, + TemplateNames.ApiPluginFromScratchBearer, + ], + [ + { + [QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id, + [QuestionNames.ApiAuth]: ApiAuthOptions.oauth().id, + }, + TemplateNames.ApiPluginFromScratchOAuth, + ], ]); diff --git a/packages/fx-core/tests/component/coordinator/coordinator.create.test.ts b/packages/fx-core/tests/component/coordinator/coordinator.create.test.ts index d5847ae04b..5ea3f141c2 100644 --- a/packages/fx-core/tests/component/coordinator/coordinator.create.test.ts +++ b/packages/fx-core/tests/component/coordinator/coordinator.create.test.ts @@ -934,6 +934,42 @@ const V3Version = MetadataV3.projectVersion; const res = await coordinator.create(v3ctx, inputs); assert.isTrue(res.isOk()); }); + + it("create API Plugin with api-key auth (feature flag enabled)", async () => { + const v3ctx = createContext(); + v3ctx.userInteraction = new MockedUserInteraction(); + + const inputs: Inputs = { + platform: Platform.VSCode, + folder: ".", + [QuestionNames.ProjectType]: ProjectTypeOptions.copilotPlugin().id, + [QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id, + [QuestionNames.ApiAuth]: ApiAuthOptions.apiKey().id, + [QuestionNames.ProgrammingLanguage]: "javascript", + [QuestionNames.AppName]: randomAppName(), + [QuestionNames.Scratch]: ScratchOptions.yes().id, + }; + const res = await coordinator.create(v3ctx, inputs); + assert.isTrue(res.isOk()); + }); + + it("create API Plugin with OAuth (feature flag enabled)", async () => { + const v3ctx = createContext(); + v3ctx.userInteraction = new MockedUserInteraction(); + + const inputs: Inputs = { + platform: Platform.VSCode, + folder: ".", + [QuestionNames.ProjectType]: ProjectTypeOptions.copilotPlugin().id, + [QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id, + [QuestionNames.ApiAuth]: ApiAuthOptions.oauth().id, + [QuestionNames.ProgrammingLanguage]: "javascript", + [QuestionNames.AppName]: randomAppName(), + [QuestionNames.Scratch]: ScratchOptions.yes().id, + }; + const res = await coordinator.create(v3ctx, inputs); + assert.isTrue(res.isOk()); + }); }); });