Skip to content

Commit

Permalink
force kestrel to use http - fix for docker local runs
Browse files Browse the repository at this point in the history
  • Loading branch information
thegovind committed Nov 6, 2023
1 parent cdd5d53 commit 9f4ab50
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task<IActionResult> GetRecommendations([FromBody] MiyagiContext miy
sw.Start();
// ========= Import semantic functions as plugins =========
log.LogDebug("Path: {S}", Directory.GetCurrentDirectory());
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Plugins");
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "plugins");
var advisorPlugin = _kernel.ImportSemanticFunctionsFromDirectory(pluginsDirectory, "AdvisorPlugin");

// ========= Import native function =========
Expand Down Expand Up @@ -95,7 +95,7 @@ public async Task<IActionResult> GetRecommendations([FromBody] MiyagiContext miy
public async Task<IActionResult> GetRecommendationsRunAsync([FromBody] MiyagiContext miyagiContext)
{
// ========= Import semantic functions as plugins =========
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Plugins");
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "plugins");
var advisorPlugin = _kernel.ImportSemanticFunctionsFromDirectory(pluginsDirectory, "AdvisorPlugin");

// ========= Import native function =========
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task<IActionResult> GetRecommendationsWithPlanner([FromBody] Miyagi
log.BeginScope("InvestmentController.GetRecommendationsAsync");
// ========= Import Advisor skill from local filesystem =========
log.LogDebug("Path: {P}", Directory.GetCurrentDirectory());
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Plugins");
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "plugins");
_kernel.ImportSemanticFunctionsFromDirectory(pluginsDirectory, "AdvisorPlugin");
_kernel.ImportFunctions(new UserProfilePlugin(), "UserProfilePlugin");
var memoryCollection = _kernelSettings.CollectionName;
Expand Down Expand Up @@ -105,7 +105,7 @@ public async Task<IActionResult> GetRecommendations([FromBody] MiyagiContext miy
log.BeginScope("InvestmentController.GetRecommendationsAsync");
// ========= Import Advisor skill from local filesystem =========
log.LogDebug("Path: {P}", Directory.GetCurrentDirectory());
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Plugins");
var pluginsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "plugins");
var advisorPlugin = _kernel.ImportSemanticFunctionsFromDirectory(pluginsDirectory, "AdvisorPlugin");
var userProfilePlugin = _kernel.ImportFunctions(new UserProfilePlugin(), "UserProfilePlugin");
var memoryCollection = _kernelSettings.CollectionName;
Expand Down
7 changes: 7 additions & 0 deletions services/recommendation-service/dotnet/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
// Add Semantic Kernel services
builder.Services.AddSkServices();

// Explicitly configure Kestrel to only use HTTP
builder.WebHost.ConfigureKestrel(serverOptions =>
{
// Remove the HTTPS endpoint if it's there
serverOptions.ListenAnyIP(80); // Listen on port 80 for HTTP
});

var app = builder.Build();

// Configure the HTTP request pipeline.
Expand Down
4 changes: 2 additions & 2 deletions services/recommendation-service/dotnet/Utils/RepoUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ namespace GBB.Miyagi.RecommendationService.Utils;
public static class RepoUtils
{
/// <summary>
/// Scan the local folders from the repo, looking for "Plugins" folder.
/// Scan the local folders from the repo, looking for "plugins" folder.
/// </summary>
/// <returns>The full path to samples/skills</returns>
public static string GetSamplePluginsPath()
{
const string Parent = "";
const string Folder = "Plugins";
const string Folder = "plugins";

bool SearchPath(string pathToFind, out string result, int maxAttempts = 10)
{
Expand Down

0 comments on commit 9f4ab50

Please sign in to comment.