Skip to content

Commit

Permalink
supressing erros, fixing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
s-o-w committed Oct 23, 2023
1 parent 519c143 commit 22b0690
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions webapi/POWERSkills/ModelIdentifierPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
using System.ComponentModel;
using System.Threading.Tasks;

#pragma warning disable IDE0130
namespace POWEREngineers.Bucky.Skills.POWEREngPlugins;
#pragma warning restore IDE0130

public class ModelIdentifierPlugin
{
IKernel _kernel;
private IKernel _kernel;

public ModelIdentifierPlugin(IKernel kernel)
{
_kernel = kernel;
this._kernel = kernel;
}

[SKFunction, Description("Routes the request to the appropriate data retrieval function.")]
Expand All @@ -23,7 +25,7 @@ public async Task<string> RouteRequest(SKContext context)
{
if (context.Variables["POWERSkillTarget"] == "LispForCAD")
{
var cadSkill = _kernel.Skills.GetFunction("CADPlugin", "LispForAutoCAD");
var cadSkill = this._kernel.Skills.GetFunction("CADPlugin", "LispForAutoCAD");
await cadSkill.InvokeAsync(context);
string toReturn = context.Variables["input"].Trim();
return $"CADCP data:{toReturn}";
Expand All @@ -34,23 +36,23 @@ public async Task<string> RouteRequest(SKContext context)
string request = context.Variables["input"];

// Retrieve the intent from the user request
var targetModel = _kernel.Skills.GetFunction("ModelIdentifierPlugin", "GetIntendedModel");
var targetModel = this._kernel.Skills.GetFunction("ModelIdentifierPlugin", "GetIntendedModel");
await targetModel.InvokeAsync(context);
string intent = context.Variables["input"].Trim();
string data = string.Empty;
// Call the appropriate function
switch (intent)
{
case "PDQMS":
var qmsSkill = new POWERQMSSkill(_kernel);
var qmsSkill = new POWERQMSSkill(this._kernel);
data = await qmsSkill.QueryQMSIndexAsync(request);
return $"PDQMS data:{data}";
case "POWERAUS":
var ausSkill = new POWERAUSSkill(_kernel);
var ausSkill = new POWERAUSSkill(this._kernel);
data = await ausSkill.QueryAUSModelAsync(request);
return $"POWERAUS data:{data}";
case "PDSUBKMP":
var kmpSkill = new POWERKMPSkill(_kernel);
var kmpSkill = new POWERKMPSkill(this._kernel);
data = await kmpSkill.QueryKMPModelAsync(request);
return $"PDSUBKMP data:{data}";
case "UNKNOWN":
Expand Down

0 comments on commit 22b0690

Please sign in to comment.