diff options
Diffstat (limited to 'Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/ChatController.cs')
| -rw-r--r-- | Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/ChatController.cs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/ChatController.cs b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/ChatController.cs index 35b170347..c204df7c7 100644 --- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/ChatController.cs +++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/ChatController.cs @@ -1,11 +1,11 @@ using System.Data; using System.Text.Json; -using ChatADX.Web.Models; -using ChatADX.Web.Services; +using Tango.Portal.Chat.Web.Models; +using Tango.Portal.Chat.Web.Services; using Kusto.Data.Data; using Microsoft.AspNetCore.Mvc; -namespace ChatADX.Web.Controllers +namespace Tango.Portal.Chat.Web.Controllers { [ApiController] [Route("api/[controller]")] @@ -31,9 +31,10 @@ namespace ChatADX.Web.Controllers try { var schemaJson = _schema.GetSchemaJson(); + var plannerPrompt = _schema.GetPlannerPrompt(); // 1) Ask the model for KQL - var plan = await _llm.ProposeKqlAsync(req.Question, schemaJson, req.History, ct); + var plan = await _llm.ProposeKqlAsync(plannerPrompt, req.Question, schemaJson, req.History, ct); if (plan.Assistant == "data") { @@ -81,7 +82,7 @@ namespace ChatADX.Web.Controllers ThreadId = run.ThreadId // <-- echo back the thread id used/created }; } - else + else if (plan.Assistant == "docs") { // AFTER var run = await _llm.AnswerWithAssistantAsync( @@ -98,6 +99,14 @@ namespace ChatADX.Web.Controllers ThreadId = run.ThreadId }; } + else + { + return new ChatResponse + { + Answer = plan.ConversationAnswer, + ThreadId = req.ThreadId + }; + } } catch (Exception ex) { |
