Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions App/kernel-memory/service/Service.AspNetCore/WebAPIEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async Task<IResult> (
ILogger<KernelMemoryWebAPI> log,
CancellationToken cancellationToken) =>
{
log.LogTrace("New delete document HTTP request, index '{0}'", index);
log.LogTrace("New delete document HTTP request, index {Index}", index?.Replace("\r", string.Empty).Replace("\n", string.Empty));
await service.DeleteIndexAsync(index: index, cancellationToken)
.ConfigureAwait(false);
// There's no API to check the index deletion progress, so the URL is empty
Expand Down Expand Up @@ -180,7 +180,7 @@ async Task<IResult> (
ILogger<KernelMemoryWebAPI> log,
CancellationToken cancellationToken) =>
{
log.LogTrace("New delete document HTTP request, index '{0}'", index);
log.LogTrace("New delete document HTTP request, index {Index}", index?.Replace("\r", string.Empty).Replace("\n", string.Empty));
await service.DeleteDocumentAsync(documentId: documentId, index: index, cancellationToken)
.ConfigureAwait(false);
var url = Constants.HttpUploadStatusEndpointWithParams
Expand Down Expand Up @@ -217,7 +217,7 @@ async Task<IResult> (
// Allow internal classes to access custom arguments via IContextProvider
contextProvider.InitContextArgs(query.ContextArguments);

log.LogTrace("New search request, index '{0}', minRelevance {1}", query.Index, query.MinRelevance);
log.LogTrace("New search request, index {Index}, minRelevance {MinRelevance}", query.Index?.Replace("\r", string.Empty).Replace("\n", string.Empty), query.MinRelevance);
MemoryAnswer answer = await service.AskAsync(
question: query.Question,
index: query.Index,
Expand Down Expand Up @@ -252,7 +252,7 @@ async Task<IResult> (
// Allow internal classes to access custom arguments via IContextProvider
contextProvider.InitContextArgs(query.ContextArguments);

log.LogTrace("New search HTTP request, index '{0}', minRelevance {1}", query.Index, query.MinRelevance);
log.LogTrace("New search HTTP request, index {Index}, minRelevance {MinRelevance}", query.Index?.Replace("\r", string.Empty).Replace("\n", string.Empty), query.MinRelevance);
SearchResult answer = await service.SearchAsync(
query: query.Query,
index: query.Index,
Expand Down Expand Up @@ -338,7 +338,10 @@ public static void AddGetDownloadEndpoint(this IEndpointRouteBuilder builder, st
string.IsNullOrWhiteSpace(filename));
var errMsg = "Missing required parameter";

log.LogTrace("New download file HTTP request, index {0}, documentId {1}, fileName {3}", index, documentId, filename);
log.LogTrace("New download file HTTP request, index {Index}, documentId {DocumentId}, fileName {FileName}",
index?.Replace("\r", string.Empty).Replace("\n", string.Empty),
documentId?.Replace("\r", string.Empty).Replace("\n", string.Empty),
filename?.Replace("\r", string.Empty).Replace("\n", string.Empty));

if (!isValid)
{
Expand All @@ -362,7 +365,10 @@ public static void AddGetDownloadEndpoint(this IEndpointRouteBuilder builder, st
return Results.Problem(title: "File not found", statusCode: 404);
}

log.LogTrace("Downloading file '{0}', size '{1}', type '{2}'", filename, file.FileSize, file.FileType);
log.LogTrace("Downloading file {FileName}, size {FileSize}, type {FileType}",
filename?.Replace("\r", string.Empty).Replace("\n", string.Empty),
file.FileSize,
file.FileType?.Replace("\r", string.Empty).Replace("\n", string.Empty));
Stream resultingFileStream = await file.GetStreamAsync().WaitAsync(cancellationToken).ConfigureAwait(false);
var response = Results.Stream(
resultingFileStream,
Expand Down
Loading