diff options
Diffstat (limited to 'Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/SchemaRegistry.cs')
| -rw-r--r-- | Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/SchemaRegistry.cs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/SchemaRegistry.cs b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/SchemaRegistry.cs index 1c48b93a2..88612f33b 100644 --- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/SchemaRegistry.cs +++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Services/SchemaRegistry.cs @@ -6,11 +6,14 @@ namespace Tango.Portal.Chat.Web.Services { private readonly IWebHostEnvironment _env; private readonly ILogger<SchemaRegistry> _log; + private readonly AIInstructionService _instructionService; private string? _cached; - public SchemaRegistry(IWebHostEnvironment env, ILogger<SchemaRegistry> log) + public SchemaRegistry(IWebHostEnvironment env, ILogger<SchemaRegistry> log, AIInstructionService instructionService) { - _env = env; _log = log; + _env = env; + _log = log; + _instructionService = instructionService; } public string GetSchemaJson() @@ -29,8 +32,29 @@ namespace Tango.Portal.Chat.Web.Services return _cached!; } + public async Task<string> GetPlannerPromptAsync() + { + var path = Path.Combine(_env.ContentRootPath, "Data", "planner_prompt.txt"); + if (!File.Exists(path)) + { + _log.LogWarning("Planner prompt file not found at {Path}. Returning empty prompt.", path); + return string.Empty; + } + + var basePrompt = File.ReadAllText(path); + var aiInstructions = await _instructionService.GetInstructionsTextAsync(); + + if (!string.IsNullOrWhiteSpace(aiInstructions)) + { + return $"{basePrompt}\n\nAdditional Instructions:\n{aiInstructions}"; + } + + return basePrompt; + } + public string GetPlannerPrompt() { + // Keep synchronous version for backward compatibility var path = Path.Combine(_env.ContentRootPath, "Data", "planner_prompt.txt"); if (!File.Exists(path)) { |
