From 1c36fb93807a9c12715890c4e1e85879460ed5f9 Mon Sep 17 00:00:00 2001 From: rentu <5545529+SLdragon@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:59:09 +0800 Subject: [PATCH] perf(ai-generator): update csharp ai generator template (#12460) Co-authored-by: rentu --- .../custom-copilot-rag-custom-api/APIActions.cs.tpl | 8 +++++--- .../csharp/custom-copilot-rag-custom-api/APIBot.cs.tpl | 4 ++-- .../csharp/custom-copilot-rag-custom-api/Program.cs.tpl | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/templates/csharp/custom-copilot-rag-custom-api/APIActions.cs.tpl b/templates/csharp/custom-copilot-rag-custom-api/APIActions.cs.tpl index 6bd130b0c6..ce93d594af 100644 --- a/templates/csharp/custom-copilot-rag-custom-api/APIActions.cs.tpl +++ b/templates/csharp/custom-copilot-rag-custom-api/APIActions.cs.tpl @@ -15,11 +15,13 @@ namespace {{SafeProjectName}} { private APIClient Client; - public APIActions(string specPath) + public APIActions() { - Client = new APIClient(specPath); + Client = new APIClient("{{OPENAPI_SPEC_PATH}}"); } + // Replace with action code + private static IMessageActivity RenderCardToMessage(string cardTemplatePath, string data) { try @@ -48,7 +50,7 @@ namespace {{SafeProjectName}} PathObject = args.ContainsKey("path") ? args["path"] : null, HeaderObject = args.ContainsKey("header") ? args["header"] : null, QueryObject = args.ContainsKey("query") ? args["query"] : null, - RequestBody = args.ContainsKey("requestBody") ? args["requestBody"] : null + RequestBody = args.ContainsKey("body") ? args["body"] : null }; return requestParam; } diff --git a/templates/csharp/custom-copilot-rag-custom-api/APIBot.cs.tpl b/templates/csharp/custom-copilot-rag-custom-api/APIBot.cs.tpl index 012a24dc4d..53f4ba31e2 100644 --- a/templates/csharp/custom-copilot-rag-custom-api/APIBot.cs.tpl +++ b/templates/csharp/custom-copilot-rag-custom-api/APIBot.cs.tpl @@ -5,10 +5,10 @@ namespace {{SafeProjectName}} { public class APIBot : Application { - public APIBot(ApplicationOptions options, string specPath) : base(options) + public APIBot(ApplicationOptions options) : base(options) { // Registering action handlers that will be hooked up to the planner. - AI.ImportActions(new APIActions(specPath)); + AI.ImportActions(new APIActions()); } } } \ No newline at end of file diff --git a/templates/csharp/custom-copilot-rag-custom-api/Program.cs.tpl b/templates/csharp/custom-copilot-rag-custom-api/Program.cs.tpl index 75b018e932..10c3d0009f 100644 --- a/templates/csharp/custom-copilot-rag-custom-api/Program.cs.tpl +++ b/templates/csharp/custom-copilot-rag-custom-api/Program.cs.tpl @@ -94,8 +94,7 @@ builder.Services.AddTransient(sp => Storage = sp.GetService(), AI = new(planner), LoggerFactory = loggerFactory, - }, - "./apiSpecificationFile/openapi.yaml"); + }); bot.OnConversationUpdate("membersAdded", async (turnContext, turnState, cancellationToken) => {