diff --git a/src/AntSK.Domain/Domain/Model/Enum/AIModelType.cs b/src/AntSK.Domain/Domain/Model/Enum/AIModelType.cs index 8edf2a5..d7247c4 100644 --- a/src/AntSK.Domain/Domain/Model/Enum/AIModelType.cs +++ b/src/AntSK.Domain/Domain/Model/Enum/AIModelType.cs @@ -25,8 +25,6 @@ namespace AntSK.Domain.Domain.Model.Enum BgeEmbedding = 7, [Display(Name = "Bge Rerank")] BgeRerank = 8, - [Display(Name = "StableDiffusion")] - StableDiffusion = 9, [Display(Name = "Ollama")] Ollama = 10, @@ -44,7 +42,6 @@ namespace AntSK.Domain.Domain.Model.Enum { Chat = 1, Embedding = 2, - Image=3, Rerank=4 } } diff --git a/src/AntSK/Pages/AppPage/AddApp.razor b/src/AntSK/Pages/AppPage/AddApp.razor index 637197e..5bfb44c 100644 --- a/src/AntSK/Pages/AppPage/AddApp.razor +++ b/src/AntSK/Pages/AppPage/AddApp.razor @@ -61,18 +61,6 @@ 更发散 } - - else - { - - - - - } @if (@context.Type == AppType.chat.ToString()) { diff --git a/src/AntSK/Pages/AppPage/AddApp.razor.cs b/src/AntSK/Pages/AppPage/AddApp.razor.cs index 6a438ad..4aa0132 100644 --- a/src/AntSK/Pages/AppPage/AddApp.razor.cs +++ b/src/AntSK/Pages/AppPage/AddApp.razor.cs @@ -48,7 +48,6 @@ namespace AntSK.Pages.AppPage private List _chatList; private List _embedingList; private List _rerankList; - private List _imageList; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); @@ -58,7 +57,7 @@ namespace AntSK.Pages.AppPage _chatList = models.Where(p => p.AIModelType == AIModelType.Chat).ToList(); _embedingList = models.Where(p => p.AIModelType == AIModelType.Embedding).ToList(); _rerankList = models.Where(p => p.AIModelType == AIModelType.Rerank).ToList(); - _imageList = models.Where(p => p.AIModelType == AIModelType.Image).ToList(); + _functionService.SearchMarkedMethods(); foreach (var func in _functionService.Functions) diff --git a/src/AntSK/Pages/Setting/AIModel/AddModel.razor b/src/AntSK/Pages/Setting/AIModel/AddModel.razor index 1b14907..9ce1943 100644 --- a/src/AntSK/Pages/Setting/AIModel/AddModel.razor +++ b/src/AntSK/Pages/Setting/AIModel/AddModel.razor @@ -29,7 +29,6 @@ 会话模型 向量模型 Rerank重排模型 - 图片模型 @@ -56,10 +55,6 @@ { BgeRerank } - else if (context.AIModelType == AIModelType.Image) - { - StableDiffusion - } @@ -119,15 +114,6 @@ } - @if (context.AIType == AIType.StableDiffusion) - { - - - - - - - } @if (context.AIType == AIType.LLamaFactory) { diff --git a/src/AntSK/Pages/Setting/AIModel/AddModel.razor.cs b/src/AntSK/Pages/Setting/AIModel/AddModel.razor.cs index a3136b3..81acd28 100644 --- a/src/AntSK/Pages/Setting/AIModel/AddModel.razor.cs +++ b/src/AntSK/Pages/Setting/AIModel/AddModel.razor.cs @@ -21,8 +21,6 @@ namespace AntSK.Pages.Setting.AIModel { [Parameter] public string ModelId { get; set; } - [Parameter] - public string ModelPath { get; set; } [Inject] protected IAIModels_Repositories _aimodels_Repositories { get; set; } [Inject] protected MessageService? Message { get; set; } [Inject] public HttpClient HttpClient { get; set; } @@ -94,27 +92,6 @@ namespace AntSK.Pages.Setting.AIModel { llamaFactoryIsStart = llamaFactoryDic.Value == "false" ? false : true; } - - - //目前只支持gguf的 所以筛选一下 - _modelFiles = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), FileDirOption.DirectoryPath)).Where(p => p.Contains(".gguf") || p.Contains(".ckpt") || p.Contains(".safetensors")).ToArray(); - if (!string.IsNullOrEmpty(ModelPath)) - { - string extension = Path.GetExtension(ModelPath); - switch (extension) - { - case ".safetensors": - case ".ckpt": - _aiModel.AIType = AIType.StableDiffusion; - break; - - } - //下载页跳入 - - _downloadModalVisible = true; - - _downloadUrl = $"https://hf-mirror.com{ModelPath.Replace("---", "/")}"; - } } catch (System.Exception ex) { @@ -461,9 +438,6 @@ namespace AntSK.Pages.Setting.AIModel _aiModel.EndPoint = "http://localhost:11434/"; _aiModel.AIModelType = AIModelType.Embedding; break; - case AIType.StableDiffusion: - _aiModel.AIModelType = AIModelType.Image; - break; case AIType.Mock: _aiModel.AIModelType = AIModelType.Chat; break; @@ -494,9 +468,6 @@ namespace AntSK.Pages.Setting.AIModel case AIModelType.Rerank: _aiModel.AIType = AIType.BgeRerank; break; - case AIModelType.Image: - _aiModel.AIType = AIType.StableDiffusion; - break; } } } diff --git a/src/AntSK/Pages/Setting/AIModel/ModelDown.razor b/src/AntSK/Pages/Setting/AIModel/ModelDown.razor deleted file mode 100644 index 405d2d9..0000000 --- a/src/AntSK/Pages/Setting/AIModel/ModelDown.razor +++ /dev/null @@ -1,71 +0,0 @@ -@namespace AntSK.Pages.Setting.AIModel -@page "/modelmanager/modeldown" -@using AntSK.Services.Auth -@inherits AuthComponentBase -@using Microsoft.AspNetCore.Authorization -@using AntSK.Domain.Domain.Model.hfmirror -@attribute [Authorize(Roles = "AntSKAdmin")] - -
- - - - StableDiffusion2(ckpt) - StableDiffusion(safetensors) - -
- - - -
-
- -
- - - - - - - @context.Id - - - - - -
-
-
-

Downloads

-

@context.Downloads.ToString("0,0")

-
-
-

Likes

-

@context.Likes.ToString("0,0")

-
-
-
-
-
-
-
-
-
-
-
-@code -{ - RenderFragment down(Action clickAction) =>@下载; - -} - diff --git a/src/AntSK/Pages/Setting/AIModel/ModelDown.razor.cs b/src/AntSK/Pages/Setting/AIModel/ModelDown.razor.cs deleted file mode 100644 index a1a89e1..0000000 --- a/src/AntSK/Pages/Setting/AIModel/ModelDown.razor.cs +++ /dev/null @@ -1,82 +0,0 @@ -using AntSK.Domain.Domain.Model.hfmirror; -using AntSK.Domain.Utils; -using AntSK.Models; -using Microsoft.AspNetCore.Components; -using Newtonsoft.Json; -using RestSharp; - -namespace AntSK.Pages.Setting.AIModel -{ - public partial class ModelDown - { - private readonly ListFormModel _model = new ListFormModel(); - private readonly IList _selectCategories = new List(); - - private List _modelList = new List(); - private string _modelType="gguf"; - private bool loaddding = false; - protected override async Task OnInitializedAsync() - { - await base.OnInitializedAsync(); - InitData(""); - } - - private async Task InitData(string searchKey) - { - loaddding = true; - if (_modelType.Contains("safetensors")) - { - _modelList.Clear(); - var param = searchKey.ConvertToString().Split(" "); - string[] lines = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "StableDiffusionModelList.txt")); - foreach (string line in lines) - { - string urlBase = $"https://hf-mirror.com/models-json?sort=trending&search={line}"; - if (param.Count() > 0) - { - urlBase += "+" + string.Join("+", param); - } - RestClient client = new RestClient(); - RestRequest request = new RestRequest(urlBase, Method.Get); - var response = await client.ExecuteAsync(request); - var model = JsonConvert.DeserializeObject(response.Content); - _modelList.AddRange(model.models); - } - - } - else - { - var param = searchKey.ConvertToString().Split(" "); - - string urlBase = $"https://hf-mirror.com/models-json?sort=trending&search={_modelType}"; - if (param.Count() > 0) - { - urlBase += "+" + string.Join("+", param); - } - RestClient client = new RestClient(); - RestRequest request = new RestRequest(urlBase, Method.Get); - var response = await client.ExecuteAsync(request); - var model = JsonConvert.DeserializeObject(response.Content); - _modelList = model.models; - } - - loaddding = false; - InvokeAsync(StateHasChanged); - } - - private async Task Search(string searchKey) - { - InitData(searchKey); - } - - private void Down(string modelPath) - { - NavigationManager.NavigateTo($"/modelmanager/modeldown/detail/{modelPath}"); - } - - private void OnModelTypeChange(string value) - { - InitData(""); - } - } -} diff --git a/src/AntSK/Pages/Setting/AIModel/ModelDown.razor.css b/src/AntSK/Pages/Setting/AIModel/ModelDown.razor.css deleted file mode 100644 index 9293eee..0000000 --- a/src/AntSK/Pages/Setting/AIModel/ModelDown.razor.css +++ /dev/null @@ -1,46 +0,0 @@ -/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */ -/* stylelint-disable no-duplicate-selectors */ -/* stylelint-disable */ -/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */ -.filterCardList .ant-card-meta-content { - margin-top: 0; -} -.filterCardList .ant-card-meta-avatar { - font-size: 0; -} -.filterCardList .ant-list .ant-list-item-content-single { - max-width: 100%; -} -.filterCardList .cardInfo { - margin-top: 16px; - margin-left: 40px; - zoom: 1; -} -.filterCardList .cardInfo::before, -.filterCardList .cardInfo::after { - display: table; - content: ' '; -} -.filterCardList .cardInfo::after { - clear: both; - height: 0; - font-size: 0; - visibility: hidden; -} -.filterCardList .cardInfo > div { - position: relative; - float: left; - width: 50%; - text-align: left; -} -.filterCardList .cardInfo > div p { - margin: 0; - font-size: 24px; - line-height: 32px; -} -.filterCardList .cardInfo > div p:first-child { - margin-bottom: 4px; - color: rgba(0, 0, 0, 0.45); - font-size: 12px; - line-height: 20px; -} diff --git a/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor b/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor deleted file mode 100644 index 6a831cd..0000000 --- a/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor +++ /dev/null @@ -1,55 +0,0 @@ -@namespace AntSK.Pages.Setting.AIModel -@page "/modelmanager/modeldown/detail/{ModelName}/{ModelPath}" -@using AntSK.Services.Auth -@inherits AuthComponentBase -@using Microsoft.AspNetCore.Authorization -@using AntSK.Domain.Domain.Model.hfmirror; - using AntSK.Domain.Domain.Model.hfmirror -@attribute [Authorize(Roles = "AntSKAdmin")] - - -
- - -
- - - - - - - -
-
- 名称 -

@context.Name

-
-
- 文件大小 -

@context.Size

-
-
- 更新时间 -

@context.Time

-
-
-
-
-
-
-
-
-
-
- -@code -{ - RenderFragment down(Action clickAction) =>@下载; -} \ No newline at end of file diff --git a/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor.cs b/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor.cs deleted file mode 100644 index 08eaf4e..0000000 --- a/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor.cs +++ /dev/null @@ -1,56 +0,0 @@ -using AntSK.Domain.Domain.Model.hfmirror; -using DocumentFormat.OpenXml.EMMA; -using DocumentFormat.OpenXml.Spreadsheet; -using HtmlAgilityPack; -using Microsoft.AspNetCore.Components; -using RestSharp; - -namespace AntSK.Pages.Setting.AIModel -{ - public partial class ModelDownDetail - { - [Parameter] - public string ModelName { get; set; } - [Parameter] - public string ModelPath { get; set; } - - List modelList = new List(); - protected override async Task OnInitializedAsync() - { - await base.OnInitializedAsync(); - InitData(); - } - - private void InitData() - { - string urlBase = $"https://hf-mirror.com/{ModelName}/{ModelPath}/tree/main"; - RestClient client = new RestClient(); - RestRequest request = new RestRequest(urlBase, Method.Get); - var response = client.Execute(request); - var htmlDocument = new HtmlDocument(); - htmlDocument.LoadHtml(response.Content); - - foreach (var listItem in htmlDocument.DocumentNode.SelectNodes("//li[contains(@class,'grid')]")) - { - var modelNameNode = listItem.SelectSingleNode(".//span[contains(@class,'truncate')]"); - var fileSizeNode = listItem.SelectSingleNode(".//a[contains(@class,'text-[0.8rem]')]"); - var downloadNode = listItem.SelectSingleNode(".//a[@title='Download file']"); - var timeNode = listItem.SelectSingleNode(".//time"); - - var modelName = modelNameNode?.InnerText.Trim(); - var fileSizeInfo = fileSizeNode?.InnerText.Trim().Split(' '); - var fileSize = fileSizeInfo?.Length > 1 ? fileSizeInfo[fileSizeInfo.Length - 2] : null; - var downloadUrl = downloadNode?.GetAttributeValue("href", null)?.Trim(); - var time= timeNode?.InnerText.Trim(); - - modelList.Add(new HfModelDetail() { Name = modelName, Size = string.Join(" ",fileSizeInfo), Path = downloadUrl,Time=time }); - } - - } - - private void Down(string path) - { - NavigationManager.NavigateTo($"/modelmanager/model/addbypath/{path.Replace("?download=true", "").Replace("/", "---")}"); - } - } -} diff --git a/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor.css b/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor.css deleted file mode 100644 index 1d9eeed..0000000 --- a/src/AntSK/Pages/Setting/AIModel/ModelDownDetail.razor.css +++ /dev/null @@ -1,186 +0,0 @@ -/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */ -/* stylelint-disable no-duplicate-selectors */ -/* stylelint-disable */ -/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */ -.standardList .ant-card-head { - border-bottom: none; -} - -.standardList .ant-card-head-title { - padding: 24px 0; - line-height: 32px; -} - -.standardList .ant-card-extra { - padding: 24px 0; -} - -.standardList .ant-list-pagination { - margin-top: 24px; - text-align: right; -} - -.standardList .ant-avatar-lg { - width: 48px; - height: 48px; - line-height: 48px; -} - -.standardList .headerInfo { - position: relative; - text-align: center; -} - - .standardList .headerInfo > span { - display: inline-block; - margin-bottom: 4px; - color: rgba(0, 0, 0, 0.45); - font-size: 14px; - line-height: 22px; - } - - .standardList .headerInfo > p { - margin: 0; - color: rgba(0, 0, 0, 0.85); - font-size: 24px; - line-height: 32px; - } - - .standardList .headerInfo > em { - position: absolute; - top: 0; - right: 0; - width: 1px; - height: 56px; - background-color: #f0f0f0; - } - -.standardList .listContent { - font-size: 0; -} - - .standardList .listContent .listContentItem { - display: inline-block; - margin-left: 40px; - color: rgba(0, 0, 0, 0.45); - font-size: 14px; - vertical-align: middle; - } - - .standardList .listContent .listContentItem > span { - line-height: 20px; - } - - .standardList .listContent .listContentItem > p { - margin-top: 4px; - margin-bottom: 0; - line-height: 22px; - } - -.standardList .extraContentSearch { - width: 272px; - margin-left: 16px; -} - -@media screen and (max-width: 480px) { - .standardList .ant-list-item-content { - display: block; - flex: none; - width: 100%; - } - - .standardList .ant-list-item-action { - margin-left: 0; - } - - .standardList .listContent { - margin-left: 0; - } - - .standardList .listContent > div { - margin-left: 0; - } - - .standardList .listCard .ant-card-head-title { - overflow: visible; - } -} - -@media screen and (max-width: 576px) { - .standardList .extraContentSearch { - width: 100%; - margin-left: 0; - } - - .standardList .headerInfo { - margin-bottom: 16px; - } - - .standardList .headerInfo > em { - display: none; - } -} - -@media screen and (max-width: 768px) { - .standardList .listContent > div { - display: block; - } - - .standardList .listContent > div:last-child { - top: 0; - width: 100%; - } - - .listCard .ant-radio-group { - display: block; - margin-bottom: 8px; - } -} - -@media screen and (max-width: 992px) and (min-width: 768px) { - .standardList .listContent > div { - display: block; - } - - .standardList .listContent > div:last-child { - top: 0; - width: 100%; - } -} - -@media screen and (max-width: 1200px) { - .standardList .listContent > div { - margin-left: 24px; - } - - .standardList .listContent > div:last-child { - top: 0; - } -} - -@media screen and (max-width: 1400px) { - .standardList .listContent { - text-align: right; - } - - .standardList .listContent > div:last-child { - top: 0; - } -} - -.standardListForm .ant-form-item { - margin-bottom: 12px; -} - - .standardListForm .ant-form-item:last-child { - margin-bottom: 32px; - padding-top: 4px; - } - -.formResult { - width: 100%; -} - - .formResult [class^='title'] { - margin-bottom: 8px; - } diff --git a/src/AntSK/Pages/Setting/AIModel/ModelList.razor b/src/AntSK/Pages/Setting/AIModel/ModelList.razor index 319b13f..62915ab 100644 --- a/src/AntSK/Pages/Setting/AIModel/ModelList.razor +++ b/src/AntSK/Pages/Setting/AIModel/ModelList.razor @@ -74,10 +74,6 @@ { BgeRerank } - else if (context.AIType == AIType.StableDiffusion) - { - StableDiffusion - } else if (context.AIType == AIType.Ollama || context.AIType == AIType.OllamaEmbedding) { Ollama @@ -97,10 +93,6 @@ { 向量模型 } - else if (context.AIModelType == AIModelType.Image) - { - 图片模型 - } else if (context.AIModelType == AIModelType.Rerank) { Rerank重排模型 diff --git a/src/AntSK/wwwroot/data/menu.json b/src/AntSK/wwwroot/data/menu.json index 221ccc0..1f2a1fe 100644 --- a/src/AntSK/wwwroot/data/menu.json +++ b/src/AntSK/wwwroot/data/menu.json @@ -45,11 +45,6 @@ "path": "/modelmanager/modellist", "name": "模型管理", "key": "modelmanager.modellist" - }, - { - "path": "/modelmanager/modeldown", - "name": "作图模型下载", - "key": "modelmanager.modeldown" } ] },