Skip to content

Commit

Permalink
Chat template CR feedback (#5845)
Browse files Browse the repository at this point in the history
* Change system prompt to be const

* Improve metadata on SearchAsync
  • Loading branch information
SteveSandersonMS authored Feb 4, 2025
1 parent 221db90 commit a0fdbfd
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>

@code {
private readonly string systemPrompt = @"
private const string SystemPrompt = @"
You are an assistant who answers questions about information you retrieve.
Do not answer questions about anything else.
Use only simple markdown to format your responses.
Expand All @@ -39,7 +39,7 @@

protected override void OnInitialized()
{
messages.Add(new(ChatRole.System, systemPrompt));
messages.Add(new(ChatRole.System, SystemPrompt));
chatOptions.Tools = [AIFunctionFactory.Create(SearchAsync)];
}

Expand Down Expand Up @@ -93,14 +93,15 @@
{
CancelAnyCurrentResponse();
messages.Clear();
messages.Add(new(ChatRole.System, systemPrompt));
messages.Add(new(ChatRole.System, SystemPrompt));
chatSuggestions?.Clear();
await chatInput!.FocusAsync();
}

[Description("Searches for information using a phrase or keyword")]
private async Task<IEnumerable<string>> SearchAsync(
[Description("The phrase to search for.")] string searchPhrase,
[Description("Whenever possible, specify the filename to search that file only. If you leave this blank, we will search all files.")] string? filenameFilter = null)
[Description("Whenever possible, specify the filename to search that file only. If not provided, the search includes all files.")] string? filenameFilter = null)
{
await InvokeAsync(StateHasChanged);
var results = await Search.SearchAsync(searchPhrase, filenameFilter, maxResults: 5);
Expand Down

0 comments on commit a0fdbfd

Please sign in to comment.