Merge pull request #645 from iceljc/features/add-knowledge-docs
add web url in file meta
This commit is contained in:
commit
6c9ba170f7
|
|
@ -23,6 +23,9 @@ public class KnowledgeDocMetaData
|
|||
[JsonPropertyName("vector_data_ids")]
|
||||
public IEnumerable<string> VectorDataIds { get; set; } = new List<string>();
|
||||
|
||||
[JsonPropertyName("web_url")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? WebUrl { get; set; }
|
||||
|
||||
[JsonPropertyName("create_date")]
|
||||
public DateTime CreateDate { get; set; } = DateTime.UtcNow;
|
||||
|
|
|
|||
|
|
@ -150,13 +150,19 @@ public partial class KnowledgeService
|
|||
Size = filter.Size
|
||||
});
|
||||
|
||||
var files = pagedData.Items?.Select(x => new KnowledgeFileModel
|
||||
var files = pagedData.Items?.Select(x =>
|
||||
{
|
||||
FileId = x.FileId,
|
||||
FileName = x.FileName,
|
||||
FileExtension = Path.GetExtension(x.FileName),
|
||||
ContentType = x.ContentType,
|
||||
FileUrl = fileStorage.GetKnowledgeBaseFileUrl(collectionName, vectorStoreProvider, x.FileId, x.FileName)
|
||||
var fileUrl = x.ContentType == MediaTypeNames.Text.Html ?
|
||||
x.WebUrl : fileStorage.GetKnowledgeBaseFileUrl(collectionName, vectorStoreProvider, x.FileId, x.FileName);
|
||||
|
||||
return new KnowledgeFileModel
|
||||
{
|
||||
FileId = x.FileId,
|
||||
FileName = x.FileName,
|
||||
FileExtension = Path.GetExtension(x.FileName),
|
||||
ContentType = x.ContentType,
|
||||
FileUrl = fileUrl
|
||||
};
|
||||
})?.ToList() ?? new List<KnowledgeFileModel>();
|
||||
|
||||
return new PagedItems<KnowledgeFileModel>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ public class KnowledgeCollectionFileMetaDocument : MongoBase
|
|||
public string ContentType { get; set; }
|
||||
public string VectorStoreProvider { get; set; }
|
||||
public IEnumerable<string> VectorDataIds { get; set; } = new List<string>();
|
||||
public string? WebUrl { get; set; }
|
||||
public DateTime CreateDate { get; set; }
|
||||
public string CreateUserId { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ public partial class MongoRepository
|
|||
ContentType = metaData.ContentType,
|
||||
VectorStoreProvider = metaData.VectorStoreProvider,
|
||||
VectorDataIds = metaData.VectorDataIds,
|
||||
WebUrl = metaData.WebUrl,
|
||||
CreateDate = metaData.CreateDate,
|
||||
CreateUserId = metaData.CreateUserId
|
||||
};
|
||||
|
|
@ -202,6 +203,7 @@ public partial class MongoRepository
|
|||
ContentType = x.ContentType,
|
||||
VectorStoreProvider = x.VectorStoreProvider,
|
||||
VectorDataIds = x.VectorDataIds,
|
||||
WebUrl = x.WebUrl,
|
||||
CreateDate = x.CreateDate,
|
||||
CreateUserId = x.CreateUserId
|
||||
})?.ToList() ?? new List<KnowledgeDocMetaData>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue