|
18 | 18 | </div> |
19 | 19 |
|
20 | 20 | @code { |
21 | | - private readonly string systemPrompt = @" |
| 21 | + private const string SystemPrompt = @" |
22 | 22 | You are an assistant who answers questions about information you retrieve. |
23 | 23 | Do not answer questions about anything else. |
24 | 24 | Use only simple markdown to format your responses. |
|
39 | 39 |
|
40 | 40 | protected override void OnInitialized() |
41 | 41 | { |
42 | | - messages.Add(new(ChatRole.System, systemPrompt)); |
| 42 | + messages.Add(new(ChatRole.System, SystemPrompt)); |
43 | 43 | chatOptions.Tools = [AIFunctionFactory.Create(SearchAsync)]; |
44 | 44 | } |
45 | 45 |
|
|
93 | 93 | { |
94 | 94 | CancelAnyCurrentResponse(); |
95 | 95 | messages.Clear(); |
96 | | - messages.Add(new(ChatRole.System, systemPrompt)); |
| 96 | + messages.Add(new(ChatRole.System, SystemPrompt)); |
97 | 97 | chatSuggestions?.Clear(); |
98 | 98 | await chatInput!.FocusAsync(); |
99 | 99 | } |
100 | 100 |
|
| 101 | + [Description("Searches for information using a phrase or keyword")] |
101 | 102 | private async Task<IEnumerable<string>> SearchAsync( |
102 | 103 | [Description("The phrase to search for.")] string searchPhrase, |
103 | | - [Description("Whenever possible, specify the filename to search that file only. If you leave this blank, we will search all files.")] string? filenameFilter = null) |
| 104 | + [Description("Whenever possible, specify the filename to search that file only. If not provided, the search includes all files.")] string? filenameFilter = null) |
104 | 105 | { |
105 | 106 | await InvokeAsync(StateHasChanged); |
106 | 107 | var results = await Search.SearchAsync(searchPhrase, filenameFilter, maxResults: 5); |
|
0 commit comments