Skip to content

Commit

Permalink
perf(ai-generator): update csharp ai generator template (#12460)
Browse files Browse the repository at this point in the history
Co-authored-by: rentu <rentu>
  • Loading branch information
SLdragon authored Sep 26, 2024
1 parent de0fdaa commit 1c36fb9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions templates/csharp/custom-copilot-rag-custom-api/APIBot.cs.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace {{SafeProjectName}}
{
public class APIBot : Application<TurnState>
{
public APIBot(ApplicationOptions<TurnState> options, string specPath) : base(options)
public APIBot(ApplicationOptions<TurnState> options) : base(options)
{
// Registering action handlers that will be hooked up to the planner.
AI.ImportActions(new APIActions(specPath));
AI.ImportActions(new APIActions());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ builder.Services.AddTransient<IBot>(sp =>
Storage = sp.GetService<IStorage>(),
AI = new(planner),
LoggerFactory = loggerFactory,
},
"./apiSpecificationFile/openapi.yaml");
});

bot.OnConversationUpdate("membersAdded", async (turnContext, turnState, cancellationToken) =>
{
Expand Down

0 comments on commit 1c36fb9

Please sign in to comment.