From a7c1c0ca81cc39dc4de4dda1d205488c8518a381 Mon Sep 17 00:00:00 2001 From: frankqianms Date: Sat, 12 Oct 2024 14:18:47 +0800 Subject: [PATCH 1/3] refactor: modify manifests for PY templates, add CEAEnabled consume logic and add test case --- .../src/component/generator/generator.ts | 1 + .../generator/templates/templateReplaceMap.ts | 1 + .../tests/component/generator/generator.test.ts | 16 ++++++++++++++++ .../appPackage/manifest.json.tpl | 17 +++++++++++++++++ .../teamsapp.local.yml.tpl | 4 ++++ .../teamsapp.yml.tpl | 8 ++++++++ .../appPackage/manifest.json.tpl | 15 +++++++++++++++ .../teamsapp.local.yml.tpl | 4 ++++ .../teamsapp.yml.tpl | 8 ++++++++ .../appPackage/manifest.json.tpl | 15 +++++++++++++++ .../custom-copilot-basic/teamsapp.local.yml.tpl | 4 ++++ .../custom-copilot-basic/teamsapp.yml.tpl | 8 ++++++++ .../appPackage/manifest.json.tpl | 15 +++++++++++++++ .../teamsapp.local.yml.tpl | 4 ++++ .../teamsapp.yml.tpl | 8 ++++++++ .../appPackage/manifest.json.tpl | 15 +++++++++++++++ .../teamsapp.local.yml.tpl | 4 ++++ .../teamsapp.yml.tpl | 8 ++++++++ .../appPackage/manifest.json.tpl | 15 +++++++++++++++ .../teamsapp.local.yml.tpl | 4 ++++ .../teamsapp.yml.tpl | 8 ++++++++ 21 files changed, 182 insertions(+) diff --git a/packages/fx-core/src/component/generator/generator.ts b/packages/fx-core/src/component/generator/generator.ts index 9f5089ee68..66b44186f8 100644 --- a/packages/fx-core/src/component/generator/generator.ts +++ b/packages/fx-core/src/component/generator/generator.ts @@ -93,6 +93,7 @@ export class Generator { : "", NewProjectTypeName: process.env.TEAMSFX_NEW_PROJECT_TYPE_NAME ?? "TeamsApp", NewProjectTypeExt: process.env.TEAMSFX_NEW_PROJECT_TYPE_EXTENSION ?? "ttkproj", + CEAEnabled: featureFlagManager.getBooleanValue(FeatureFlags.CEAEnabled) ? "true" : "", }; } @hooks([ diff --git a/packages/fx-core/src/component/generator/templates/templateReplaceMap.ts b/packages/fx-core/src/component/generator/templates/templateReplaceMap.ts index 05f6a6405c..36b8302a36 100644 --- a/packages/fx-core/src/component/generator/templates/templateReplaceMap.ts +++ b/packages/fx-core/src/component/generator/templates/templateReplaceMap.ts @@ -71,5 +71,6 @@ export function getTemplateReplaceMap(inputs: Inputs): { [key: string]: string } : "", NewProjectTypeName: process.env.TEAMSFX_NEW_PROJECT_TYPE_NAME ?? "TeamsApp", NewProjectTypeExt: process.env.TEAMSFX_NEW_PROJECT_TYPE_EXTENSION ?? "ttkproj", + CEAEnabled: featureFlagManager.getBooleanValue(FeatureFlags.CEAEnabled) ? "true" : "", }; } diff --git a/packages/fx-core/tests/component/generator/generator.test.ts b/packages/fx-core/tests/component/generator/generator.test.ts index 40aba2580a..8845945cb2 100644 --- a/packages/fx-core/tests/component/generator/generator.test.ts +++ b/packages/fx-core/tests/component/generator/generator.test.ts @@ -1174,6 +1174,22 @@ describe("render template", () => { `${templateName}-${commonTemplateName}` ); }); + + it("template variables when CEA enabled", async () => { + sandbox.stub(process, "env").value({ TEAMSFX_CEA_ENABLED: "true" }); + const vars = newGeneratorFlag + ? getTemplateReplaceMap(inputs) + : Generator.getDefaultVariables("test"); + assert.equal(vars.CEAEnabled, "true"); + }); + + it("template variables when CEA disabled", async () => { + sandbox.stub(process, "env").value({ TEAMSFX_CEA_ENABLED: "false" }); + const vars = newGeneratorFlag + ? getTemplateReplaceMap(inputs) + : Generator.getDefaultVariables("test"); + assert.equal(vars.CEAEnabled, ""); + }); }); }); diff --git a/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl b/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl index 523d3bc11f..a16ed28484 100644 --- a/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl @@ -1,7 +1,14 @@ { + {{#CEAEnabled}} + "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", + "version": "1.0.1", + {{/CEAEnabled}} + {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", "manifestVersion": "1.17", "version": "1.0.0", + {{/CEAEnabled}} "id": "${{TEAMS_APP_ID}}", "developer": { "name": "Teams App, Inc.", @@ -22,6 +29,16 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + {{#CEAEnabled}} + "copilotAgents": { + "customEngineAgents": [ + { + "type": "bot", + "id": "${{BOT_ID}}" + } + ] + } + {{/CEAEnabled}} "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-assistant-assistants-api/teamsapp.local.yml.tpl b/templates/python/custom-copilot-assistant-assistants-api/teamsapp.local.yml.tpl index be6835e737..06a7db7b2b 100644 --- a/templates/python/custom-copilot-assistant-assistants-api/teamsapp.local.yml.tpl +++ b/templates/python/custom-copilot-assistant-assistants-api/teamsapp.local.yml.tpl @@ -39,11 +39,13 @@ provision: channels: - name: msteams + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage @@ -52,11 +54,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. diff --git a/templates/python/custom-copilot-assistant-assistants-api/teamsapp.yml.tpl b/templates/python/custom-copilot-assistant-assistants-api/teamsapp.yml.tpl index 493c539d33..221ee313f5 100644 --- a/templates/python/custom-copilot-assistant-assistants-api/teamsapp.yml.tpl +++ b/templates/python/custom-copilot-assistant-assistants-api/teamsapp.yml.tpl @@ -57,11 +57,13 @@ provision: # will use bicep CLI in PATH if you remove this config. bicepCliVersion: v0.9.1 + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -69,11 +71,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. @@ -100,11 +104,13 @@ deploy: # Triggered when 'teamsapp publish' is executed publish: + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -112,11 +118,13 @@ publish: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. diff --git a/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl b/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl index ee2c11b39f..f2324a4bf6 100644 --- a/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl @@ -1,7 +1,14 @@ { + {{#CEAEnabled}} + "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", + "version": "1.0.1", + {{/CEAEnabled}} + {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", "manifestVersion": "1.17", "version": "1.0.0", + {{/CEAEnabled}} "id": "${{TEAMS_APP_ID}}", "developer": { "name": "Teams App, Inc.", @@ -22,6 +29,14 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + "copilotAgents": { + "customEngineAgents": [ + { + "type": "bot", + "id": "${{BOT_ID}}" + } + ] + } "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-assistant-new/teamsapp.local.yml.tpl b/templates/python/custom-copilot-assistant-new/teamsapp.local.yml.tpl index 7b6c4ba3b5..a8bb76ea28 100644 --- a/templates/python/custom-copilot-assistant-new/teamsapp.local.yml.tpl +++ b/templates/python/custom-copilot-assistant-new/teamsapp.local.yml.tpl @@ -39,11 +39,13 @@ provision: channels: - name: msteams + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage @@ -52,11 +54,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. diff --git a/templates/python/custom-copilot-assistant-new/teamsapp.yml.tpl b/templates/python/custom-copilot-assistant-new/teamsapp.yml.tpl index ded62fa350..b0433b5e73 100644 --- a/templates/python/custom-copilot-assistant-new/teamsapp.yml.tpl +++ b/templates/python/custom-copilot-assistant-new/teamsapp.yml.tpl @@ -57,11 +57,13 @@ provision: # will use bicep CLI in PATH if you remove this config. bicepCliVersion: v0.9.1 + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -69,11 +71,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. @@ -100,11 +104,13 @@ deploy: # Triggered when 'teamsapp publish' is executed publish: + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -112,11 +118,13 @@ publish: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. diff --git a/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl b/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl index bd84c2cacf..f15e8cfc24 100644 --- a/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl @@ -1,7 +1,14 @@ { + {{#CEAEnabled}} + "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", + "version": "1.0.1", + {{/CEAEnabled}} + {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", "manifestVersion": "1.17", "version": "1.0.0", + {{/CEAEnabled}} "id": "${{TEAMS_APP_ID}}", "developer": { "name": "Teams App, Inc.", @@ -22,6 +29,14 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + "copilotAgents": { + "customEngineAgents": [ + { + "type": "bot", + "id": "${{BOT_ID}}" + } + ] + } "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-basic/teamsapp.local.yml.tpl b/templates/python/custom-copilot-basic/teamsapp.local.yml.tpl index 7b6c4ba3b5..a8bb76ea28 100644 --- a/templates/python/custom-copilot-basic/teamsapp.local.yml.tpl +++ b/templates/python/custom-copilot-basic/teamsapp.local.yml.tpl @@ -39,11 +39,13 @@ provision: channels: - name: msteams + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage @@ -52,11 +54,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. diff --git a/templates/python/custom-copilot-basic/teamsapp.yml.tpl b/templates/python/custom-copilot-basic/teamsapp.yml.tpl index ded62fa350..b0433b5e73 100644 --- a/templates/python/custom-copilot-basic/teamsapp.yml.tpl +++ b/templates/python/custom-copilot-basic/teamsapp.yml.tpl @@ -57,11 +57,13 @@ provision: # will use bicep CLI in PATH if you remove this config. bicepCliVersion: v0.9.1 + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -69,11 +71,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. @@ -100,11 +104,13 @@ deploy: # Triggered when 'teamsapp publish' is executed publish: + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -112,11 +118,13 @@ publish: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. diff --git a/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl index 24691b562f..9c30316c0f 100644 --- a/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl @@ -1,7 +1,14 @@ { + {{#CEAEnabled}} + "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", + "version": "1.0.1", + {{/CEAEnabled}} + {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", "manifestVersion": "1.17", "version": "1.0.0", + {{/CEAEnabled}} "id": "${{TEAMS_APP_ID}}", "developer": { "name": "Teams App, Inc.", @@ -22,6 +29,14 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + "copilotAgents": { + "customEngineAgents": [ + { + "type": "bot", + "id": "${{BOT_ID}}" + } + ] + } "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.local.yml.tpl b/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.local.yml.tpl index d186323670..ba636f7c17 100644 --- a/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.local.yml.tpl +++ b/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.local.yml.tpl @@ -39,11 +39,13 @@ provision: channels: - name: msteams + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage @@ -52,11 +54,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. diff --git a/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.yml.tpl b/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.yml.tpl index 34b81201e5..363ccb7482 100644 --- a/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.yml.tpl +++ b/templates/python/custom-copilot-rag-azure-ai-search/teamsapp.yml.tpl @@ -57,11 +57,13 @@ provision: # will use bicep CLI in PATH if you remove this config. bicepCliVersion: v0.9.1 + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -69,11 +71,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. @@ -100,11 +104,13 @@ deploy: # Triggered when 'teamsapp publish' is executed publish: + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -112,11 +118,13 @@ publish: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. diff --git a/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl index 24691b562f..9c30316c0f 100644 --- a/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl @@ -1,7 +1,14 @@ { + {{#CEAEnabled}} + "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", + "version": "1.0.1", + {{/CEAEnabled}} + {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", "manifestVersion": "1.17", "version": "1.0.0", + {{/CEAEnabled}} "id": "${{TEAMS_APP_ID}}", "developer": { "name": "Teams App, Inc.", @@ -22,6 +29,14 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + "copilotAgents": { + "customEngineAgents": [ + { + "type": "bot", + "id": "${{BOT_ID}}" + } + ] + } "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-rag-custom-api/teamsapp.local.yml.tpl b/templates/python/custom-copilot-rag-custom-api/teamsapp.local.yml.tpl index 4ce626f09a..090e8674aa 100644 --- a/templates/python/custom-copilot-rag-custom-api/teamsapp.local.yml.tpl +++ b/templates/python/custom-copilot-rag-custom-api/teamsapp.local.yml.tpl @@ -39,11 +39,13 @@ provision: channels: - name: msteams + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage @@ -52,11 +54,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. diff --git a/templates/python/custom-copilot-rag-custom-api/teamsapp.yml.tpl b/templates/python/custom-copilot-rag-custom-api/teamsapp.yml.tpl index dd0c167375..fefa1c4b6f 100644 --- a/templates/python/custom-copilot-rag-custom-api/teamsapp.yml.tpl +++ b/templates/python/custom-copilot-rag-custom-api/teamsapp.yml.tpl @@ -57,11 +57,13 @@ provision: # will use bicep CLI in PATH if you remove this config. bicepCliVersion: v0.9.1 + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -69,11 +71,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. @@ -100,11 +104,13 @@ deploy: # Triggered when 'teamsapp publish' is executed publish: + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -112,11 +118,13 @@ publish: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. diff --git a/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl index 24691b562f..9c30316c0f 100644 --- a/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl @@ -1,7 +1,14 @@ { + {{#CEAEnabled}} + "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", + "version": "1.0.1", + {{/CEAEnabled}} + {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", "manifestVersion": "1.17", "version": "1.0.0", + {{/CEAEnabled}} "id": "${{TEAMS_APP_ID}}", "developer": { "name": "Teams App, Inc.", @@ -22,6 +29,14 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + "copilotAgents": { + "customEngineAgents": [ + { + "type": "bot", + "id": "${{BOT_ID}}" + } + ] + } "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-rag-customize/teamsapp.local.yml.tpl b/templates/python/custom-copilot-rag-customize/teamsapp.local.yml.tpl index 7af9c63f5c..c0543e5a6e 100644 --- a/templates/python/custom-copilot-rag-customize/teamsapp.local.yml.tpl +++ b/templates/python/custom-copilot-rag-customize/teamsapp.local.yml.tpl @@ -39,11 +39,13 @@ provision: channels: - name: msteams + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage @@ -52,11 +54,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. diff --git a/templates/python/custom-copilot-rag-customize/teamsapp.yml.tpl b/templates/python/custom-copilot-rag-customize/teamsapp.yml.tpl index 34b81201e5..363ccb7482 100644 --- a/templates/python/custom-copilot-rag-customize/teamsapp.yml.tpl +++ b/templates/python/custom-copilot-rag-customize/teamsapp.yml.tpl @@ -57,11 +57,13 @@ provision: # will use bicep CLI in PATH if you remove this config. bicepCliVersion: v0.9.1 + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -69,11 +71,13 @@ provision: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. @@ -100,11 +104,13 @@ deploy: # Triggered when 'teamsapp publish' is executed publish: + {{^CEAEnabled}} # Validate using manifest schema - uses: teamsApp/validateManifest with: # Path to manifest template manifestPath: ./appPackage/manifest.json + {{/CEAEnabled}} # Build Teams app package with latest env value - uses: teamsApp/zipAppPackage with: @@ -112,11 +118,13 @@ publish: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputFolder: ./appPackage/build + {{^CEAEnabled}} # Validate app package using validation rules - uses: teamsApp/validateAppPackage with: # Relative path to this file. This is the path for built zip file. appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip + {{/CEAEnabled}} # Apply the Teams app manifest to an existing Teams app in # Teams Developer Portal. # Will use the app id in manifest file to determine which Teams app to update. From 19c96233623009befca5fc9f17b5e625354cbf76 Mon Sep 17 00:00:00 2001 From: frankqianms Date: Sat, 12 Oct 2024 14:34:11 +0800 Subject: [PATCH 2/3] fix: bad manifest --- .../appPackage/manifest.json.tpl | 2 +- .../custom-copilot-assistant-new/appPackage/manifest.json.tpl | 4 +++- .../python/custom-copilot-basic/appPackage/manifest.json.tpl | 4 +++- .../appPackage/manifest.json.tpl | 4 +++- .../appPackage/manifest.json.tpl | 4 +++- .../custom-copilot-rag-customize/appPackage/manifest.json.tpl | 4 +++- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl b/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl index a16ed28484..8580556c02 100644 --- a/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl @@ -37,7 +37,7 @@ "id": "${{BOT_ID}}" } ] - } + }, {{/CEAEnabled}} "bots": [ { diff --git a/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl b/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl index f2324a4bf6..83d3bd2cd5 100644 --- a/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl @@ -29,6 +29,7 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + {{#CEAEnabled}} "copilotAgents": { "customEngineAgents": [ { @@ -36,7 +37,8 @@ "id": "${{BOT_ID}}" } ] - } + }, + {{/CEAEnabled}} "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl b/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl index f15e8cfc24..9f940f151b 100644 --- a/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl @@ -29,6 +29,7 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + {{#CEAEnabled}} "copilotAgents": { "customEngineAgents": [ { @@ -36,7 +37,8 @@ "id": "${{BOT_ID}}" } ] - } + }, + {{/CEAEnabled}} "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl index 9c30316c0f..60b5931a2f 100644 --- a/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl @@ -29,6 +29,7 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + {{#CEAEnabled}} "copilotAgents": { "customEngineAgents": [ { @@ -36,7 +37,8 @@ "id": "${{BOT_ID}}" } ] - } + }, + {{/CEAEnabled}} "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl index 9c30316c0f..60b5931a2f 100644 --- a/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl @@ -29,6 +29,7 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + {{#CEAEnabled}} "copilotAgents": { "customEngineAgents": [ { @@ -36,7 +37,8 @@ "id": "${{BOT_ID}}" } ] - } + }, + {{/CEAEnabled}} "bots": [ { "botId": "${{BOT_ID}}", diff --git a/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl index 9c30316c0f..60b5931a2f 100644 --- a/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl @@ -29,6 +29,7 @@ "full": "full description for {{appName}}" }, "accentColor": "#FFFFFF", + {{#CEAEnabled}} "copilotAgents": { "customEngineAgents": [ { @@ -36,7 +37,8 @@ "id": "${{BOT_ID}}" } ] - } + }, + {{/CEAEnabled}} "bots": [ { "botId": "${{BOT_ID}}", From 815b0396f461274123aa56841275988845ebce75 Mon Sep 17 00:00:00 2001 From: frankqianms Date: Fri, 25 Oct 2024 09:54:43 +0800 Subject: [PATCH 3/3] refactor: modify schema url and version --- .../appPackage/manifest.json.tpl | 4 ++-- .../custom-copilot-assistant-new/appPackage/manifest.json.tpl | 4 ++-- .../python/custom-copilot-basic/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../custom-copilot-rag-customize/appPackage/manifest.json.tpl | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl b/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl index 8580556c02..bf01f45c9e 100644 --- a/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-assistant-assistants-api/appPackage/manifest.json.tpl @@ -1,8 +1,8 @@ { {{#CEAEnabled}} - "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json", "manifestVersion": "devPreview", - "version": "1.0.1", + "version": "1.0.0", {{/CEAEnabled}} {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", diff --git a/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl b/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl index 83d3bd2cd5..ec89f8e9ef 100644 --- a/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-assistant-new/appPackage/manifest.json.tpl @@ -1,8 +1,8 @@ { {{#CEAEnabled}} - "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json", "manifestVersion": "devPreview", - "version": "1.0.1", + "version": "1.0.0", {{/CEAEnabled}} {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", diff --git a/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl b/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl index 9f940f151b..b9f994d74c 100644 --- a/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-basic/appPackage/manifest.json.tpl @@ -1,8 +1,8 @@ { {{#CEAEnabled}} - "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json", "manifestVersion": "devPreview", - "version": "1.0.1", + "version": "1.0.0", {{/CEAEnabled}} {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", diff --git a/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl index 60b5931a2f..b2a6d31709 100644 --- a/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-azure-ai-search/appPackage/manifest.json.tpl @@ -1,8 +1,8 @@ { {{#CEAEnabled}} - "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json", "manifestVersion": "devPreview", - "version": "1.0.1", + "version": "1.0.0", {{/CEAEnabled}} {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", diff --git a/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl index 60b5931a2f..b2a6d31709 100644 --- a/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-custom-api/appPackage/manifest.json.tpl @@ -1,8 +1,8 @@ { {{#CEAEnabled}} - "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json", "manifestVersion": "devPreview", - "version": "1.0.1", + "version": "1.0.0", {{/CEAEnabled}} {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json", diff --git a/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl b/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl index 60b5931a2f..b2a6d31709 100644 --- a/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl +++ b/templates/python/custom-copilot-rag-customize/appPackage/manifest.json.tpl @@ -1,8 +1,8 @@ { {{#CEAEnabled}} - "$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json", + "$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json", "manifestVersion": "devPreview", - "version": "1.0.1", + "version": "1.0.0", {{/CEAEnabled}} {{^CEAEnabled}} "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json",