Skip to content

Commit 7d4f19e

Browse files
author
Matthew Harris
committed
Page
1 parent f5cdb6f commit 7d4f19e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Azure.AISearch.WebApp/Services/AzureOpenAISearchService.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,23 @@ public async Task<SearchResponse> SearchAsync(SearchRequest request)
8282
throw new InvalidOperationException("Azure OpenAI didn't return a meaningful response.");
8383
}
8484

85-
if (answerMessage.AzureExtensionsContext != null)
86-
{
85+
//if (answerMessage.AzureExtensionsContext != null)
86+
//{
8787
// Process citations within the answer, which take the form "[doc1][doc2]..." and refer to the (1-based) index of
8888
// the citations in the tool message.
89-
var citationIndex = 0;
90-
foreach (var citation in answerMessage.AzureExtensionsContext.Citations)
91-
{
92-
answerText = answerText.Replace($"[doc{++citationIndex}]", $"<cite>{citation.Title}{citation.Url}{citation.Filepath}</cite> XXX", StringComparison.OrdinalIgnoreCase);
93-
searchResponse.SearchResults.Add(new SearchResult
94-
{
95-
DocumentId = citation.Filepath,
96-
DocumentTitle = citation.Title,
97-
DocumentSourceUrl = citation.Url,
98-
Captions = string.IsNullOrWhiteSpace(citation.Content) ? Array.Empty<string>() : new[] { citation.Content }
99-
});
100-
}
101-
}
89+
//var citationIndex = 0;
90+
//foreach (var citation in answerMessage.AzureExtensionsContext.Citations)
91+
//{
92+
// answerText = answerText.Replace($"[doc{++citationIndex}]", $"<cite>{citation.Title}{citation.Url}{citation.Filepath}</cite> XXX", StringComparison.OrdinalIgnoreCase);
93+
// searchResponse.SearchResults.Add(new SearchResult
94+
// {
95+
// DocumentId = citation.Filepath,
96+
// DocumentTitle = citation.Title,
97+
// DocumentSourceUrl = citation.Url,
98+
// Captions = string.IsNullOrWhiteSpace(citation.Content) ? Array.Empty<string>() : new[] { citation.Content }
99+
// });
100+
//}
101+
//}
102102

103103
searchResponse.Answers = new[] { new SearchAnswer { Text = answerText } };
104104
searchResponse.History.Add(answerText);

0 commit comments

Comments
 (0)