aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/HomeController.cs8
-rw-r--r--Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/planner_prompt.txt1
-rw-r--r--Software/Visual_Studio_22/Tango.Portal.Chat.Web/Kusot Tango Creds.txt5
-rw-r--r--Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/LlmClient.cs28
-rw-r--r--Software/Visual_Studio_22/Tango.Portal.Chat.Web/Views/Home/Index.cshtml2
5 files changed, 32 insertions, 12 deletions
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/HomeController.cs b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/HomeController.cs
index f83749f46..6f1aa5dfa 100644
--- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/HomeController.cs
+++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Controllers/HomeController.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
+using System.Diagnostics;
using System.Text.Json;
using Tango.Portal.Chat.Web.ViewModels;
@@ -8,6 +9,13 @@ namespace Tango.Portal.Chat.Web.Controllers
{
public IActionResult Index(String session)
{
+ if (Debugger.IsAttached)
+ {
+ HomeViewVM v = new HomeViewVM();
+ v.UserName = "debug-user";
+ return View(v);
+ }
+
String loginUrl = "https://twine-srv.com/login";
if (String.IsNullOrWhiteSpace(session)) return new RedirectResult(loginUrl);
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/planner_prompt.txt b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/planner_prompt.txt
index b68b05755..40a5b2ed3 100644
--- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/planner_prompt.txt
+++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/planner_prompt.txt
@@ -34,6 +34,7 @@ ROUTING
- "docs": architectural/how-to/design/definitions; no live data needed.
- "none": small-talk (“thanks”, “hi”), meta-questions about how you chose a query, or requests to rephrase without needing data.
- Use conversational context from prior turns. If the current question refers to a previous result (“that”, “the same one”, “which organization is that?”), KEEP the same assistant as the previous turn unless the user clearly asks for documentation.
+- If you feel like the user is vague about the data they want or that you don't have enough information to construct a KQL query, try to guide them to be more specific in your conversation response while taking into account the conversation history. (e.g user says: "Organization" or "Machine" or "Specific machine". response: "Is there anything specific you would like to know about some organization?" Maybe provide an example question.)
OUTPUT FORMAT — RAW JSON ONLY (no code fences)
Return a single JSON object with these fields:
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Kusot Tango Creds.txt b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Kusot Tango Creds.txt
new file mode 100644
index 000000000..cc3233635
--- /dev/null
+++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Kusot Tango Creds.txt
@@ -0,0 +1,5 @@
+Kusot Tango Creds:
+
+Client Secret: C6n8Q~-NgsAQ6yYJwoNABkcVUNSm2~8-8xNgaa32
+Client ID: f3f96a84-6f0d-4afc-bcf7-6d60d5e5b6a1
+Tenant: 2ebd63a5-bc2f-41dc-9066-4409ed5e5dd4 \ No newline at end of file
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/LlmClient.cs b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/LlmClient.cs
index fb34c183b..fb742d455 100644
--- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/LlmClient.cs
+++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/LlmClient.cs
@@ -10,6 +10,7 @@ namespace Tango.Portal.Chat.Web.Services
{
public sealed class LlmClient
{
+ private static int MAX_HISTORY = 10;
private readonly HttpClient _http;
private readonly LlmOptions _opt;
@@ -52,7 +53,9 @@ namespace Tango.Portal.Chat.Web.Services
if (history != null)
{
- foreach (var m in history.TakeLast(6))
+ history = history.DistinctBy(x => x.Content);
+
+ foreach (var m in history.TakeLast(MAX_HISTORY))
messages.Add(new { role = m.Role, content = CapString(m.Content, 1000), usedKql = m.UsedKql });
}
@@ -94,11 +97,14 @@ namespace Tango.Portal.Chat.Web.Services
if (history != null)
{
- foreach (var m in history.TakeLast(6))
+ history = history.DistinctBy(x => x.Content);
+
+ foreach (var m in history.TakeLast(MAX_HISTORY))
{
- messages.Add(new {
- role = m.Role == "assistant" ? "assistant" : "user",
- content = CapString(m.Content, 1000)
+ messages.Add(new
+ {
+ role = m.Role == "assistant" ? "assistant" : "user",
+ content = CapString(m.Content, 1000)
});
}
}
@@ -321,12 +327,12 @@ namespace Tango.Portal.Chat.Web.Services
}
public async Task<AssistantRunResult> AnswerWithAssistantAsync(
- AssistantType assistant,
- string question,
- string factsJson,
- string kql,
- string? threadId,
- CancellationToken ct = default)
+ AssistantType assistant,
+ string question,
+ string factsJson,
+ string kql,
+ string? threadId,
+ CancellationToken ct = default)
{
// 1) Use existing thread or create a new one
if (string.IsNullOrEmpty(threadId))
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Views/Home/Index.cshtml b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Views/Home/Index.cshtml
index a9fcb402d..95a8a0ddb 100644
--- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Views/Home/Index.cshtml
+++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Views/Home/Index.cshtml
@@ -284,7 +284,7 @@
question: text,
threadId: threadId,
// include short history to help routing follow-ups
- history: messages.slice(-6).map(m => ({ role: m.role, content: m.content, usedKql: m.usedKql }))
+ history: messages.slice(-10).map(m => ({ role: m.role, content: m.content, usedKql: m.usedKql }))
})
});