mirror of
https://github.com/AIDotNet/AntSK.git
synced 2026-02-17 22:10:14 +08:00
add 增加文档详情页面
This commit is contained in:
21
AntSK.Domain/Domain/Dto/KMFile.cs
Normal file
21
AntSK.Domain/Domain/Dto/KMFile.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntSK.Domain.Domain.Dto
|
||||
{
|
||||
public class KMFile
|
||||
{
|
||||
public string Text { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
public string LastUpdate { get; set; }
|
||||
|
||||
public string Schema { get; set; }
|
||||
|
||||
public string File { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using AntSK.Domain.Domain.Dto;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,6 +9,6 @@ namespace AntSK.Domain.Domain.Interface
|
||||
{
|
||||
public interface IKMService
|
||||
{
|
||||
Task<List<string>> GetDocumentByFileID(string fileid);
|
||||
Task<List<KMFile>> GetDocumentByFileID(string fileid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
using AntSK.Domain.Domain.Interface;
|
||||
using Microsoft.KernelMemory;
|
||||
using AntSK.Domain.Utils;
|
||||
using AntSK.Domain.Domain.Dto;
|
||||
|
||||
namespace AntSK.Domain.Domain.Service
|
||||
{
|
||||
[ServiceDescription(typeof(IKMService), ServiceLifetime.Scoped)]
|
||||
public class KMService(MemoryServerless _memory) : IKMService
|
||||
{
|
||||
public async Task<List<string>> GetDocumentByFileID(string fileid)
|
||||
public async Task<List<KMFile>> GetDocumentByFileID(string fileid)
|
||||
{
|
||||
var memories = await _memory.ListIndexesAsync();
|
||||
var memoryDbs = _memory.Orchestrator.GetMemoryDbs();
|
||||
List<string> docTextList = new List<string>();
|
||||
List<KMFile> docTextList = new List<KMFile>();
|
||||
|
||||
foreach (var memoryIndex in memories)
|
||||
{
|
||||
@@ -24,8 +25,16 @@ namespace AntSK.Domain.Domain.Service
|
||||
{
|
||||
if (item.Id.Contains(fileid))
|
||||
{
|
||||
var test = item.Payload.FirstOrDefault(p => p.Key == "text");
|
||||
docTextList.Add(test.Value.ConvertToString());
|
||||
|
||||
KMFile file = new KMFile()
|
||||
{
|
||||
Text = item.Payload.FirstOrDefault(p => p.Key == "text").Value.ConvertToString(),
|
||||
Url= item.Payload.FirstOrDefault(p => p.Key == "url").Value.ConvertToString(),
|
||||
LastUpdate= item.Payload.FirstOrDefault(p => p.Key == "last_update").Value.ConvertToString(),
|
||||
Schema = item.Payload.FirstOrDefault(p => p.Key == "schema").Value.ConvertToString(),
|
||||
File = item.Payload.FirstOrDefault(p => p.Key == "file").Value.ConvertToString(),
|
||||
};
|
||||
docTextList.Add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using AntDesign;
|
||||
using AntSK.Domain.Domain.Dto;
|
||||
using AntSK.Domain.Domain.Interface;
|
||||
using AntSK.Domain.Repositories;
|
||||
using AntSK.Domain.Utils;
|
||||
@@ -80,7 +81,7 @@ namespace AntSK.Pages.Kms
|
||||
await _memory.ImportWebPageAsync(urlModel.Url, fileid, new TagCollection() { { "kmsid", KmsId } }
|
||||
, index: "kms");
|
||||
//查询文档数量
|
||||
List<string> docTextList =await iKMService.GetDocumentByFileID(fileid);
|
||||
var docTextList =await iKMService.GetDocumentByFileID(fileid);
|
||||
|
||||
KmsDetails detial = new KmsDetails()
|
||||
{
|
||||
@@ -127,7 +128,7 @@ namespace AntSK.Pages.Kms
|
||||
.AddTag("kmsid", KmsId)
|
||||
, index: "kms");
|
||||
//查询文档数量
|
||||
List<string> docTextList = await iKMService.GetDocumentByFileID(fileid);
|
||||
var docTextList = await iKMService.GetDocumentByFileID(fileid);
|
||||
|
||||
KmsDetails detial = new KmsDetails()
|
||||
{
|
||||
|
||||
19
AntSK/Pages/Kms/KmsDetailList.razor
Normal file
19
AntSK/Pages/Kms/KmsDetailList.razor
Normal file
@@ -0,0 +1,19 @@
|
||||
@namespace AntSK.Pages.Kms
|
||||
@using AntSK.Domain.Repositories
|
||||
@using AntSK.Domain.Domain.Dto
|
||||
@page "/Kms/DetailList/{FileID}"
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<AntList DataSource="@_data" TItem="KMFile">
|
||||
<ListItem >
|
||||
<ListItemMeta Description="@context.Text">
|
||||
<TitleTemplate>
|
||||
<a>@context.File</a>
|
||||
</TitleTemplate>
|
||||
</ListItemMeta>
|
||||
</ListItem>
|
||||
</AntList>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
23
AntSK/Pages/Kms/KmsDetailList.razor.cs
Normal file
23
AntSK/Pages/Kms/KmsDetailList.razor.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using AntSK.Domain.Domain.Dto;
|
||||
using AntSK.Domain.Domain.Interface;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AntSK.Pages.Kms
|
||||
{
|
||||
public partial class KmsDetailList
|
||||
{
|
||||
[Parameter]
|
||||
public string FileID { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IKMService iKMService { get; set; }
|
||||
|
||||
private List<KMFile> _data = new List<KMFile>() ;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
_data = await iKMService.GetDocumentByFileID(FileID);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user