Skip to content

Commit 4d46ec9

Browse files
author
Matthew Harris
committed
Page
1 parent 8f36b06 commit 4d46ec9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ public async Task<SearchResponse> SearchAsync(SearchRequest request)
8989
var citationIndex = 0;
9090
foreach (var citation in answerMessage.AzureExtensionsContext.Citations)
9191
{
92-
answerText = answerText.Replace($"[doc{++citationIndex}]", $"<cite>{citation.Title}{citation.DocumentSourceUrl}</cite>", StringComparison.OrdinalIgnoreCase);
92+
answerText = answerText.Replace($"[doc{++citationIndex}]", $"<cite>{citation.Title}{citation.Url}</cite>", StringComparison.OrdinalIgnoreCase);
9393
searchResponse.SearchResults.Add(new SearchResult
9494
{
9595
DocumentId = citation.Filepath,
9696
DocumentTitle = citation.Title,
97+
SocumentSourceUrl = citation.Url,
9798
Captions = string.IsNullOrWhiteSpace(citation.Content) ? Array.Empty<string>() : new[] { citation.Content }
9899
});
99100
}
@@ -120,7 +121,7 @@ private AzureSearchChatExtensionConfiguration GetAzureCognitiveSearchDataSource(
120121
{
121122
ContentFieldNames = { useDocumentsIndex ? nameof(Document.Content) : nameof(DocumentChunk.Content) },
122123
TitleFieldName = useDocumentsIndex ? nameof(Document.Title) : nameof(DocumentChunk.SourceDocumentTitle),
123-
UrlFieldName = useDocumentsIndex ? nameof(Document.FilePath) : nameof(DocumentChunk.SourceDocumentFilePath),
124+
UrlFieldName = useDocumentsIndex ? nameof(Document.SourceUrl) : nameof(DocumentChunk.SourceDocumentSourceUrl),
124125
FilepathFieldName = useDocumentsIndex ? nameof(Document.FilePath) : nameof(DocumentChunk.SourceDocumentFilePath),
125126
VectorFieldNames = { useDocumentsIndex ? null : nameof(DocumentChunk.ContentVector) }
126127
},

0 commit comments

Comments
 (0)