mirror of
https://github.com/AIDotNet/AntSK.git
synced 2026-02-19 23:49:13 +08:00
Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6700b75684 | ||
|
|
ab15dd6e99 | ||
|
|
13a4419705 | ||
|
|
cf03465e23 | ||
|
|
a441730508 | ||
|
|
6e30886bd2 | ||
|
|
bc2af42724 | ||
|
|
919fc5dea7 | ||
|
|
9ab287fabd | ||
|
|
cf02efc2da | ||
|
|
1c34ad5987 | ||
|
|
4e8039703e | ||
|
|
c2b97c7f82 | ||
|
|
1a621f5cbc | ||
|
|
836f898ffe | ||
|
|
0a9a737709 | ||
|
|
0df8c74ec2 | ||
|
|
5e3ff74eaa | ||
|
|
7c49ff0a6c | ||
|
|
63f5267bca | ||
|
|
e0c35aac06 | ||
|
|
27d52d3331 | ||
|
|
e7b2c6e193 | ||
|
|
7600397b79 | ||
|
|
874b8e5d7f | ||
|
|
3ac18086a1 | ||
|
|
16049c7413 | ||
|
|
7bb7a41bb3 | ||
|
|
6c37ed66b2 | ||
|
|
bc86f96159 | ||
|
|
8eb09fb783 | ||
|
|
eff5f69f0f | ||
|
|
e3f966d4f2 | ||
|
|
015f51b99c | ||
|
|
cd66b61014 | ||
|
|
f0bef7d2fa | ||
|
|
de051b047d | ||
|
|
ed6f5dada2 | ||
|
|
d2e3fde829 | ||
|
|
195551e9c1 | ||
|
|
855103c2a4 | ||
|
|
6150d543d3 | ||
|
|
d968d78982 | ||
|
|
0ec5d1f1cf | ||
|
|
31f44c1758 | ||
|
|
e5f63d605d | ||
|
|
7db62e3dc6 | ||
|
|
4408fa4345 | ||
|
|
c5e952b98e | ||
|
|
bedfeaf53d | ||
|
|
d605fd6685 | ||
|
|
e5e3f7cd8f | ||
|
|
657949694c | ||
|
|
10b6035f84 | ||
|
|
3f9fe27456 | ||
|
|
da3a0681e5 | ||
|
|
57b7948d86 | ||
|
|
40b8bd0439 | ||
|
|
6ed9cc9b70 | ||
|
|
e51bf35217 | ||
|
|
28f88438e7 |
10
LICENSE
10
LICENSE
@@ -1,9 +1,17 @@
|
||||
Apache License
|
||||
AntSK License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
This project follows the Apache 2.0 agreement, in addition to the following additional terms
|
||||
1.This project can be used for commercial purposes, but it has the right to prohibit you from using it if it violates the following provisions
|
||||
2. Without authorization, you are not allowed to modify AntSK's logo and title information
|
||||
3. Without authorization, you are not allowed to modify the copyright information at the bottom of the page
|
||||
4. If you need authorization, you can contact WeChat: xuzeyu91 or Email:antskpro@qq.com
|
||||
|
||||
|
||||
Apache 2.0 License
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
|
||||
60
README.md
60
README.md
@@ -42,6 +42,8 @@ AntSK is suitable for various business scenarios, such as:
|
||||
[document](http://antsk.cn/)
|
||||
|
||||
[demo](https://demo.antsk.cn/)
|
||||
and
|
||||
[demo1](https://antsk.ai-dotnet.com/)
|
||||
|
||||
```
|
||||
Default account: test
|
||||
@@ -84,7 +86,8 @@ version: '3.8'
|
||||
services:
|
||||
antsk:
|
||||
container_name: antsk
|
||||
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.1.5ports:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.5.0
|
||||
ports:
|
||||
- 5000:5000
|
||||
networks:
|
||||
- antsk
|
||||
@@ -100,9 +103,15 @@ networks:
|
||||
antsk:
|
||||
```
|
||||
Taking this as an example, it means mounting the local D://model folder of Windows into the container /app/model. If so, the model address in your appsettings.json should be configured as
|
||||
```
|
||||
model/xxx.gguf
|
||||
```
|
||||
|
||||
[LiteDockerCompose](https://github.com/AIDotNet/AntSK/blob/main/docker-compose.simple.yml)
|
||||
|
||||
The compact version is deployed with sqlite-disk by one click
|
||||
|
||||
[FullDockerCompose](https://github.com/AIDotNet/AntSK/blob/main/docker-compose.yml)
|
||||
|
||||
The full version uses pg+aspire
|
||||
|
||||
|
||||
## 3️⃣Some meanings of configuration file
|
||||
```
|
||||
@@ -119,11 +128,6 @@ model/xxx.gguf
|
||||
"FileDir": {
|
||||
"DirectoryPath": "D:\\git\\AntBlazor\\model"
|
||||
},
|
||||
"LLamaSharp": {
|
||||
"RunType": "GPU",
|
||||
"ContextSize": 2048,
|
||||
"GpuLayerCount": 20
|
||||
},
|
||||
"Login": {
|
||||
"User": "admin",
|
||||
"Password": "xuzeyu"
|
||||
@@ -147,11 +151,8 @@ DBConnection.ConnectionStrings
|
||||
//The ConnectionString of Qdrant and AzureAISearch uses Endpoint | APIKey
|
||||
KernelMemory.VectorDb
|
||||
|
||||
//Local model execution options: GPU and CPU. When using the online API, any option can be used.
|
||||
LLamaSharp.RunType
|
||||
|
||||
//Local model path, used for quick selection of models under llama, as well as saving downloaded models.
|
||||
LLamaSharp.FileDirectory
|
||||
FileDir.DirectoryPath
|
||||
|
||||
//Default admin account password
|
||||
Login
|
||||
@@ -188,13 +189,6 @@ I'm using CodeFirst mode for the database, so as long as the database connection
|
||||
8. Many people ask about the difference between LLamaSharp and llamafactory. In fact, LLamaSharp is a .NET implementation of llama.cpp, but only supports local gguf models, while llamafactory supports a wider variety of models and uses Python implementation. The main difference lies here. Additionally, llamafactory has the ability to fine-tune models, which is an area we will focus on integrating in the future.
|
||||
```
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
[PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)
|
||||
|
||||
If you would like to contribute, feel free to create a [Pull Request](https://github.com/AIDotNet/AntSK/pulls), or give us [Bug Report](https://github.com/AIDotNet/AntSK/issues/new).
|
||||
|
||||
|
||||
## 💕 Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute.
|
||||
@@ -204,15 +198,35 @@ This project exists thanks to all the people who contribute.
|
||||
</a>
|
||||
|
||||
## 🚨 Use Protocol
|
||||
This warehouse follows the [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) open source protocol.
|
||||
The Apache open source license allows the use of AntSK in commercial environments, provided that the license terms are followed. One of the main terms is to retain the copyright and license statements.
|
||||
|
||||
This warehouse follows the [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) open source protocol.
|
||||
|
||||
This project follows the Apache 2.0 agreement, in addition to the following additional terms
|
||||
|
||||
1. This project can be used for commercial purposes, but it has the right to prohibit you from using it if it violates the following provisions
|
||||
|
||||
2. Without authorization, you are not allowed to modify AntSK's logo and title information
|
||||
|
||||
4. Without authorization, you are not allowed to modify the copyright information at the bottom of the page
|
||||
|
||||
6. If you need authorization, you can contact WeChat: **xuzeyu91**
|
||||
|
||||
If you plan to use AntSK in commercial projects, you need to ensure that you follow the following steps:
|
||||
1. Copyright statement containing Apache license. [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file).
|
||||
|
||||
1. Copyright statement containing AntSK license. [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file).
|
||||
|
||||
2. If you modify the software source code, you need to clearly indicate these modifications in the source code.
|
||||
|
||||
3. Meet the above requirements
|
||||
|
||||
## 💕 Special thanks
|
||||
Helping enterprise AI application development, we recommend [AntBlazor](https://antblazor.com)
|
||||
|
||||
## ☎️Contact Me
|
||||
If you have any questions or suggestions, please contact me through my official WeChat account. We also have a discussion group where you can send a message to join, and then I will add you to the group.
|
||||
|
||||
Additionally, you can also contact me via email: antskpro@qq.com
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
59
README.zh.md
59
README.zh.md
@@ -43,10 +43,11 @@ AntSK 适用于多种业务场景,例如:
|
||||
## ✏️功能示例
|
||||
### 在线演示
|
||||
|
||||
[文档地址](http://antsk.cn/)
|
||||
[体验地址1](https://demo.antsk.cn/)
|
||||
|
||||
[体验地址](https://demo.antsk.cn/)
|
||||
和
|
||||
|
||||
[体验地址2](https://antsk.ai-dotnet.com/)
|
||||
```
|
||||
默认账号:test
|
||||
|
||||
@@ -111,9 +112,15 @@ networks:
|
||||
antsk:
|
||||
```
|
||||
以这个为示例,意思是把windows本地D://model的文件夹挂载进 容器内/app/model 如果是这样你的appsettings.json中的模型地址应该配置为
|
||||
```
|
||||
model/xxx.gguf
|
||||
```
|
||||
|
||||
[LiteDockerCompose](https://github.com/AIDotNet/AntSK/blob/main/docker-compose.simple.yml)
|
||||
|
||||
精简版使用sqlite+disk向量模式,简化部署配置
|
||||
|
||||
[FullDockerCompose](https://github.com/AIDotNet/AntSK/blob/main/docker-compose.yml)
|
||||
|
||||
完整版使用pg+aspire 功能更完整,配置文件需要参考如下配置含义进行配置
|
||||
|
||||
|
||||
## 3️⃣配置文件的一些含义
|
||||
```
|
||||
@@ -130,11 +137,6 @@ model/xxx.gguf
|
||||
"FileDir": {
|
||||
"DirectoryPath": "D:\\git\\AntBlazor\\model"
|
||||
},
|
||||
"LLamaSharp": {
|
||||
"RunType": "GPU",
|
||||
"ContextSize": 2048,
|
||||
"GpuLayerCount": 20
|
||||
},
|
||||
"Login": {
|
||||
"User": "admin",
|
||||
"Password": "xuzeyu"
|
||||
@@ -157,11 +159,8 @@ DBConnection.ConnectionStrings
|
||||
//Qdrant 和AzureAISearch 的 ConnectionString 使用 Endpoint|APIKey
|
||||
KernelMemory.VectorDb
|
||||
|
||||
//本地模型使用的运行方式 GUP CPU ,如果用在线API 这个随意使用一个即可
|
||||
LLamaSharp.RunType
|
||||
|
||||
//本地模型路径,用于在选择llama时可以快速选择目录下的模型,以及保存下载的模型
|
||||
LLamaSharp.FileDirectory
|
||||
FileDir.DirectoryPath
|
||||
|
||||
//默认管理员账号密码
|
||||
Login
|
||||
@@ -195,13 +194,6 @@ DB我使用的是CodeFirst模式,只要配置好数据库链接,表结构是
|
||||
7、点击保存,然后就可以开始聊天了
|
||||
8、很多人会问 LLamaSharp与llamafactory有什么区别?其实这两者LLamaSharp是llama.cpp的 dotnet实现,但是只支持本地gguf模型, 而llamafactory 支持的模型种类更多,但使用的是python的实现,其主要差异在这里,另外llamafactory具有模型微调的能力,这也是我们下一步需要重点集成的部分。
|
||||
```
|
||||
|
||||
## 🤝 贡献
|
||||
|
||||
[](https://github.com/AIDotNet/AntSK/pulls)
|
||||
|
||||
如果你想贡献,可以创建一个[拉取请求](https://github.com/AIDotNet/AntSK/pulls), 或给我们[错误报告](https://github.com/AIDotNet/AntSK/issues/new).
|
||||
|
||||
|
||||
## 💕 贡献者
|
||||
|
||||
@@ -213,18 +205,35 @@ DB我使用的是CodeFirst模式,只要配置好数据库链接,表结构是
|
||||
|
||||
## 🚨 使用协议
|
||||
|
||||
本仓库遵循 [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 开源协议。
|
||||
Apache开源许可证允许在商业环境中使用AntSK,前提是需要遵守许可证的条款。主要条款之一是要保留版权声明和许可证声明。
|
||||
本仓库遵循 [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 开源协议。
|
||||
|
||||
除以下附加条款外,该项目遵循Apache 2.0协议
|
||||
|
||||
1. 本项目可以用于商业目的,但如果违反以下规定,它有权禁止您使用
|
||||
|
||||
2. 未经授权,您不允许修改AntSK的徽标和标题信息
|
||||
|
||||
3. 未经授权,您不能修改页面底部的版权信息
|
||||
|
||||
4. 如果您需要授权,可以联系微信:xuzeyu91
|
||||
|
||||
如果您打算在商业项目中使用AntSK,您需要确保遵守以下步骤:
|
||||
|
||||
1、包含Apache许可证的版权声明。 [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 。
|
||||
1. 包含AntSK许可证的版权声明。 [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 。
|
||||
|
||||
2、如果您修改了软件源代码,您需要在源代码中明确标明这些修改。
|
||||
2. 如果您修改了软件源代码,您需要在源代码中明确标明这些修改。
|
||||
|
||||
3. 满足以上要求
|
||||
|
||||
## 💕 特别感谢
|
||||
助力企业级AI应用开发,推荐使用 [AntBlazor](https://antblazor.com)
|
||||
|
||||
|
||||
## ☎️联系我
|
||||
如有任何问题或建议,请通过以下方式关注我的公众号《许泽宇的技术分享》,发消息与我联系,我们也有AIDotnet交流群,可以发送进群等消息,然后我会拉你进交流群
|
||||
|
||||
另外您也可以通过邮箱与我联系:antskpro@qq.com
|
||||
|
||||

|
||||
|
||||
## 🌟 Star History
|
||||
|
||||
@@ -3,9 +3,9 @@ version: '3.8'
|
||||
services:
|
||||
antsk:
|
||||
container_name: antsk
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.4.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.2
|
||||
# 如果需要pytorch环境需要使用下面这个镜像,镜像比较大
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.4.3
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.2
|
||||
ports:
|
||||
- 5000:5000
|
||||
networks:
|
||||
|
||||
@@ -32,9 +32,9 @@ services:
|
||||
- ./pg/data:/var/lib/postgresql/data
|
||||
antsk:
|
||||
container_name: antsk
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.4.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.2
|
||||
# 如果需要pytorch环境需要使用下面这个镜像,镜像比较大
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.4.3
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.2
|
||||
ports:
|
||||
- 5000:5000
|
||||
networks:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AntDesign.Charts" Version="0.5.5" />
|
||||
<PackageReference Include="AntDesign.ProLayout" Version="0.19.7" />
|
||||
<PackageReference Include="AntDesign.ProLayout" Version="0.20.3" />
|
||||
<PackageReference Include="BlazorComponents.Terminal" Version="0.6.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
|
||||
@@ -35,12 +35,6 @@
|
||||
<PackageReference Include="Microsoft.KernelMemory.MemoryDb.Redis" Version="$(KMVersion)" />
|
||||
<PackageReference Include="Microsoft.KernelMemory.MemoryDb.AzureAISearch" Version="$(KMVersion)" />
|
||||
|
||||
<PackageReference Include="LLamaSharp" Version="$(LLamaSharpVersion)" />
|
||||
<PackageReference Include="LLamaSharp.Backend.Cpu" Version="$(LLamaSharpVersion)" />
|
||||
<PackageReference Include="LLamaSharp.Backend.Cuda12" Version="$(LLamaSharpVersion)" />
|
||||
<PackageReference Include="LLamaSharp.kernel-memory" Version="$(LLamaSharpVersion)" />
|
||||
<PackageReference Include="LLamaSharp.semantic-kernel" Version="$(LLamaSharpVersion)" />
|
||||
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
|
||||
@@ -188,11 +188,6 @@
|
||||
<member name="M:AntSK.Domain.Domain.Other.KMExcelHandler.InvokeAsync(Microsoft.KernelMemory.Pipeline.DataPipeline,System.Threading.CancellationToken)">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
<member name="F:AntSK.Domain.Domain.Other.LLamaConfig.dicLLamaWeights">
|
||||
<summary>
|
||||
避免模型重复加载,本地缓存
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:AntSK.Domain.Domain.Other.QAHandler.StepName">
|
||||
<inheritdoc />
|
||||
</member>
|
||||
@@ -924,6 +919,20 @@
|
||||
<param name="value"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:AntSK.Domain.Utils.ConvertUtils.Unescape(System.String)">
|
||||
<summary>
|
||||
\uxxxx转中文,保留换行符号
|
||||
</summary>
|
||||
<param name="unicodeString"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:AntSK.Domain.Utils.ConvertUtils.IsStream(System.String)">
|
||||
<summary>
|
||||
是否为流式请求
|
||||
</summary>
|
||||
<param name="value"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:AntSK.Domain.Utils.RepoFiles.SamplePluginsPath">
|
||||
<summary>
|
||||
Scan the local folders from the repo, looking for "samples/plugins" folder.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using LLamaSharp.KernelMemory;
|
||||
using Microsoft.KernelMemory.AI;
|
||||
using Microsoft.KernelMemory.AI;
|
||||
using Microsoft.KernelMemory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
using LLama.Common;
|
||||
using LLama;
|
||||
using LLamaSharp.KernelMemory;
|
||||
using Microsoft.KernelMemory.AI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.KernelMemory.AI;
|
||||
using AntSK.Domain.Domain.Other.Bge;
|
||||
|
||||
namespace AntSK.Domain.Common.Embedding
|
||||
|
||||
@@ -12,7 +12,9 @@ namespace AntSK.Domain.Domain.Interface
|
||||
{
|
||||
public event LogMessageHandler LogMessageReceived;
|
||||
Task PipInstall();
|
||||
Task StartLLamaFactory(string modelName, string templateName);
|
||||
|
||||
Task PipInstallName(string name);
|
||||
Task StartLLamaFactory(string modelName);
|
||||
|
||||
void KillProcess();
|
||||
|
||||
|
||||
@@ -13,9 +13,6 @@ namespace AntSK.Domain.Domain.Model.Enum
|
||||
[Display(Name = "Azure Open AI")]
|
||||
AzureOpenAI = 2,
|
||||
|
||||
[Display(Name = "LLama本地模型")]
|
||||
LLamaSharp = 3,
|
||||
|
||||
[Display(Name = "星火大模型")]
|
||||
SparkDesk = 4,
|
||||
|
||||
@@ -28,11 +25,11 @@ namespace AntSK.Domain.Domain.Model.Enum
|
||||
BgeEmbedding = 7,
|
||||
[Display(Name = "Bge Rerank")]
|
||||
BgeRerank = 8,
|
||||
[Display(Name = "StableDiffusion")]
|
||||
StableDiffusion = 9,
|
||||
|
||||
[Display(Name = "Ollama")]
|
||||
Ollama = 10,
|
||||
[Display(Name = "OllamaEmbedding")]
|
||||
OllamaEmbedding = 11,
|
||||
[Display(Name = "模拟输出")]
|
||||
Mock = 100,
|
||||
|
||||
@@ -45,7 +42,6 @@ namespace AntSK.Domain.Domain.Model.Enum
|
||||
{
|
||||
Chat = 1,
|
||||
Embedding = 2,
|
||||
Image=3,
|
||||
Rerank=4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Python.Runtime.Py;
|
||||
using AntSK.Domain.Utils;
|
||||
|
||||
namespace AntSK.Domain.Domain.Other.Bge
|
||||
{
|
||||
@@ -65,7 +66,7 @@ namespace AntSK.Domain.Domain.Other.Bge
|
||||
pyList.Append(item.ToPython()); // 将C# string转换为Python对象并添加到PyList中
|
||||
}
|
||||
PyObject result = model.compute_score(pyList, normalize: true);
|
||||
return result.As<double>();
|
||||
return result.ConvertToString().Trim('[').Trim(']').ConvertToDouble();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
using AntSK.Domain.Options;
|
||||
using LLama;
|
||||
using LLama.Common;
|
||||
using LLamaSharp.KernelMemory;
|
||||
|
||||
namespace AntSK.Domain.Domain.Other
|
||||
{
|
||||
public static class LLamaConfig
|
||||
{
|
||||
static object lockobj = new object();
|
||||
/// <summary>
|
||||
/// 避免模型重复加载,本地缓存
|
||||
/// </summary>
|
||||
static Dictionary<string, (LLamaWeights, ModelParams)> dicLLamaWeights = new Dictionary<string, (LLamaWeights, ModelParams)>();
|
||||
public static (LLamaWeights, ModelParams) GetLLamaConfig(string modelPath, LLamaSharpConfig config = null)
|
||||
{
|
||||
lock (lockobj)
|
||||
{
|
||||
if (dicLLamaWeights.ContainsKey(modelPath))
|
||||
{
|
||||
return dicLLamaWeights.GetValueOrDefault(modelPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
InferenceParams infParams = new() { AntiPrompts = ["\n\n"] };
|
||||
LLamaSharpConfig lsConfig = new(modelPath) { DefaultInferenceParams = infParams };
|
||||
if (config != null)
|
||||
{
|
||||
lsConfig = config;
|
||||
}
|
||||
var parameters = new ModelParams(lsConfig.ModelPath)
|
||||
{
|
||||
ContextSize = LLamaSharpOption.ContextSize ?? 2048,
|
||||
Seed = lsConfig?.Seed ?? 0,
|
||||
GpuLayerCount = LLamaSharpOption.GpuLayerCount ?? 20,
|
||||
Embeddings = true
|
||||
};
|
||||
var weights = LLamaWeights.LoadFromFile(parameters);
|
||||
dicLLamaWeights.Add(modelPath, (weights, parameters));
|
||||
return (weights, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ using AntSK.Domain.Utils;
|
||||
using AntSK.OCR;
|
||||
using DocumentFormat.OpenXml.Drawing.Diagrams;
|
||||
using LLama;
|
||||
using LLamaSharp.KernelMemory;
|
||||
using Markdig;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@@ -171,12 +170,6 @@ namespace AntSK.Domain.Domain.Service
|
||||
APIType = AzureOpenAIConfig.APITypes.EmbeddingGeneration,
|
||||
});
|
||||
break;
|
||||
|
||||
case Model.Enum.AIType.LLamaSharp:
|
||||
var (weights, parameters) = LLamaConfig.GetLLamaConfig(embedModel.ModelName);
|
||||
var embedder = new LLamaEmbedder(weights, parameters);
|
||||
memory.WithLLamaSharpTextEmbeddingGeneration(new LLamaSharpTextEmbeddingGenerator(embedder));
|
||||
break;
|
||||
case Model.Enum.AIType.BgeEmbedding:
|
||||
string pyDll = embedModel.EndPoint;
|
||||
string bgeEmbeddingModelName = embedModel.ModelName;
|
||||
@@ -185,6 +178,13 @@ namespace AntSK.Domain.Domain.Service
|
||||
case Model.Enum.AIType.DashScope:
|
||||
memory.WithDashScopeDefaults(embedModel.ModelKey);
|
||||
break;
|
||||
case Model.Enum.AIType.OllamaEmbedding:
|
||||
memory.WithOpenAITextEmbeddingGeneration(new OpenAIConfig()
|
||||
{
|
||||
APIKey = "NotNull",
|
||||
EmbeddingModel = embedModel.ModelName
|
||||
}, null, false, embeddingHttpClient);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,13 +211,6 @@ namespace AntSK.Domain.Domain.Service
|
||||
APIType = AzureOpenAIConfig.APITypes.TextCompletion,
|
||||
});
|
||||
break;
|
||||
|
||||
case Model.Enum.AIType.LLamaSharp:
|
||||
var (weights, parameters) = LLamaConfig.GetLLamaConfig(chatModel.ModelName);
|
||||
var context = weights.CreateContext(parameters);
|
||||
var executor = new StatelessExecutor(weights, parameters);
|
||||
memory.WithLLamaSharpTextGeneration(new LlamaSharpTextGenerator(weights, context, executor));
|
||||
break;
|
||||
case Model.Enum.AIType.LLamaFactory:
|
||||
|
||||
memory.WithOpenAITextGeneration(new OpenAIConfig()
|
||||
|
||||
@@ -4,25 +4,15 @@ using AntSK.Domain.Domain.Interface;
|
||||
using AntSK.Domain.Domain.Other;
|
||||
using AntSK.Domain.Repositories;
|
||||
using AntSK.Domain.Utils;
|
||||
using LLama;
|
||||
using LLamaSharp.SemanticKernel.TextCompletion;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Microsoft.SemanticKernel.Plugins.Core;
|
||||
using Microsoft.SemanticKernel.TextGeneration;
|
||||
using RestSharp;
|
||||
using System;
|
||||
using ServiceLifetime = AntSK.Domain.Common.DependencyInjection.ServiceLifetime;
|
||||
using AntSK.LLM.Mock;
|
||||
using AntSK.Domain.Domain.Model.Enum;
|
||||
using AntSK.LLM.LLamaFactory;
|
||||
using System.Reflection;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using Microsoft.KernelMemory;
|
||||
using OpenCvSharp.ML;
|
||||
using LLamaSharp.SemanticKernel.ChatCompletion;
|
||||
using Microsoft.SemanticKernel.ChatCompletion;
|
||||
using Amazon.Runtime.Internal.Util;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace AntSK.Domain.Domain.Service
|
||||
@@ -108,13 +98,6 @@ namespace AntSK.Domain.Domain.Service
|
||||
);
|
||||
break;
|
||||
|
||||
case Model.Enum.AIType.LLamaSharp:
|
||||
var (weights, parameters) = LLamaConfig.GetLLamaConfig(chatModel.ModelName);
|
||||
var ex = new StatelessExecutor(weights, parameters);
|
||||
builder.Services.AddKeyedSingleton<ITextGenerationService>("local-llama", new LLamaSharpTextCompletion(ex));
|
||||
builder.Services.AddKeyedSingleton<IChatCompletionService>("local-llama-chat", new LLamaSharpChatCompletion(ex));
|
||||
break;
|
||||
|
||||
case Model.Enum.AIType.SparkDesk:
|
||||
|
||||
var settings = chatModel.ModelKey.Split("|");
|
||||
|
||||
@@ -7,6 +7,7 @@ using AntSK.LLamaFactory.Model;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -74,8 +75,45 @@ namespace AntSK.Domain.Domain.Service
|
||||
}, TaskCreationOptions.LongRunning);
|
||||
await cmdTask;
|
||||
}
|
||||
public async Task PipInstallName(string name)
|
||||
{
|
||||
|
||||
public async Task StartLLamaFactory(string modelName, string templateName)
|
||||
var cmdTask = Task.Factory.StartNew(() =>
|
||||
{
|
||||
|
||||
var isProcessComplete = false;
|
||||
|
||||
process = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "pip",
|
||||
Arguments = $"install {name} -i https://pypi.tuna.tsinghua.edu.cn/simple",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory,
|
||||
}
|
||||
};
|
||||
process.OutputDataReceived += (sender, eventArgs) =>
|
||||
{
|
||||
Log.Information($"{eventArgs.Data}");
|
||||
OnLogMessageReceived(eventArgs.Data);
|
||||
};
|
||||
process.ErrorDataReceived += (sender, eventArgs) =>
|
||||
{
|
||||
Log.Information($"{eventArgs.Data}");
|
||||
OnLogMessageReceived(eventArgs.Data);
|
||||
};
|
||||
process.Start();
|
||||
process.BeginOutputReadLine();
|
||||
process.BeginErrorReadLine();
|
||||
process.WaitForExit();
|
||||
OnLogMessageReceived("--------------------完成--------------------");
|
||||
}, TaskCreationOptions.LongRunning);
|
||||
await cmdTask;
|
||||
}
|
||||
public async Task StartLLamaFactory(string modelName)
|
||||
{
|
||||
var cmdTask = Task.Factory.StartNew(() =>
|
||||
{
|
||||
@@ -87,7 +125,7 @@ namespace AntSK.Domain.Domain.Service
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "python",
|
||||
Arguments = "api_antsk.py --model_name_or_path " + modelName + " --template " + templateName + " ",
|
||||
Arguments = "api_antsk.py --model_name_or_path " + modelName + " --template default ",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError=true,
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace AntSK.Domain.Options
|
||||
{
|
||||
public class LLamaSharpOption
|
||||
{
|
||||
public static string RunType { get; set; }
|
||||
public static uint? ContextSize { get; set; }
|
||||
public static int? GpuLayerCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace AntSK.Domain.Repositories
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Icon { get; set; }
|
||||
public string Icon { get; set; } = "windows";
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
@@ -75,6 +75,7 @@ namespace AntSK.Domain.Repositories
|
||||
/// <summary>
|
||||
/// 知识库ID列表
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "varchar(1000)")]
|
||||
public string? KmsIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace AntSK.Domain.Repositories
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Icon { get; set; }
|
||||
public string Icon { get; set; } = "question-circle";
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="OllamaEmbeddingModelList.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="OllamaModelList.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -38,11 +38,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.AppHost", "AntSK.AppH
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.ServiceDefaults", "AntSK.ServiceDefaults\AntSK.ServiceDefaults.csproj", "{21AC6184-336E-475F-8975-80A39D59B0CC}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{76407DD9-6F9D-401C-8A8C-4B6FEC03988A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Directory.Build.props = Directory.Build.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
cursor:pointer;
|
||||
border:none;
|
||||
background-image: url('http://img.shields.io/github/stars/aidotnet/antsk?style=social');
|
||||
width:88px;
|
||||
width:90px;
|
||||
height:20px;
|
||||
}
|
||||
</style>
|
||||
@@ -26,7 +26,7 @@
|
||||
</ErrorBoundary>
|
||||
</ChildContent>
|
||||
<FooterRender>
|
||||
<FooterView Copyright="2024 许泽宇的技术分享" Links="Links"></FooterView>
|
||||
<FooterView Copyright="2024 AntSK版权所有" Links="Links"></FooterView>
|
||||
</FooterRender>
|
||||
</AntDesign.ProLayout.BasicLayout>
|
||||
<SettingDrawer />
|
||||
@@ -93,9 +93,9 @@
|
||||
{
|
||||
new LinkItem
|
||||
{
|
||||
Key = "许泽宇的技术分享",
|
||||
Title = "许泽宇的技术分享",
|
||||
Href = "./assets/gzh.jpg",
|
||||
Key = "antsk.cn",
|
||||
Title = "antsk.cn",
|
||||
Href = "https://antsk.cn",
|
||||
BlankTarget = true,
|
||||
},
|
||||
new LinkItem
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
@Body
|
||||
</div>
|
||||
<FooterView Copyright="许泽宇的技术分享" Links="Links"></FooterView>
|
||||
<FooterView Copyright="2024 AntSK版权所有" Links="Links"></FooterView>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@@ -27,9 +27,9 @@
|
||||
{
|
||||
new LinkItem
|
||||
{
|
||||
Key = "许泽宇的技术分享",
|
||||
Title = "许泽宇的技术分享",
|
||||
Href = "./assets/gzh.jpg",
|
||||
Key = "antsk.cn",
|
||||
Title = "antsk.cn",
|
||||
Href = "https://antsk.cn",
|
||||
BlankTarget = true,
|
||||
},
|
||||
new LinkItem
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
<FormItem Label="应用名称" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入应用名称" @bind-Value="@context.Name" />
|
||||
</FormItem>
|
||||
<FormItem Label="图标" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
@* <Input Placeholder="请输入图标" @bind-Value="@context.Icon" />
|
||||
<a href="https://antblazor.com/zh-CN/components/icon" target="_blank">图标库</a> *@
|
||||
@* <FormItem Label="图标" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入图标" @bind-Value="@context.Icon" />
|
||||
<a href="https://antblazor.com/zh-CN/components/icon" target="_blank">图标库</a>
|
||||
<IconPicker @bind-Value="@context.Icon"></IconPicker>
|
||||
</FormItem>
|
||||
</FormItem> *@
|
||||
<FormItem Label="类型" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<RadioGroup @bind-Value="context.Type" OnChange="OnAppTypeChange" TValue="string" ButtonStyle="RadioButtonStyle.Solid">
|
||||
<Radio RadioButton Value="@AppType.chat.ToString()">会话应用</Radio>
|
||||
@@ -61,18 +61,6 @@
|
||||
<span>更发散</span>
|
||||
</FormItem>
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
<FormItem Label="图片模型" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Select DataSource="@_imageList"
|
||||
@bind-Value="@context.ImageModelID"
|
||||
ValueProperty="c=>c.Id"
|
||||
LabelProperty="c=>'【'+c.AIType.ToString()+'】'+c.ModelDescription">
|
||||
</Select>
|
||||
<Button Type="@ButtonType.Link" OnClick="NavigateModelList">去创建</Button>
|
||||
</FormItem>
|
||||
}
|
||||
@if (@context.Type == AppType.chat.ToString())
|
||||
{
|
||||
<FormItem Label="API插件列表" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace AntSK.Pages.AppPage
|
||||
private List<AIModels> _chatList;
|
||||
private List<AIModels> _embedingList;
|
||||
private List<AIModels> _rerankList;
|
||||
private List<AIModels> _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)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
{
|
||||
<Card Hoverable Bordered Class="card" Actions="@(new[] {
|
||||
info(()=> Info(context.Id)) ,
|
||||
use(()=> Use(context.Id)),
|
||||
open(()=> Open(context.Id)),
|
||||
delete(async ()=>await Delete(context.Id)) ,
|
||||
|
||||
@@ -75,6 +76,7 @@
|
||||
@code
|
||||
{
|
||||
RenderFragment info(Action clickAction) =>@<a key="info" @onclick="@clickAction">查看</a>;
|
||||
RenderFragment use(Action clickAction) =>@<a key="use" @onclick="@clickAction">使用</a>;
|
||||
RenderFragment open(Action clickAction) =>@<a key="info" @onclick="@clickAction">外部使用</a>;
|
||||
RenderFragment delete(Action clickAction) => @<a key="delete" @onclick="@clickAction">删除</a> ;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace AntSK.Pages.AppPage
|
||||
}
|
||||
else
|
||||
{
|
||||
data = await _apps_Repositories.GetListAsync(p => p.Name.Contains(searchKey));
|
||||
data = await _apps_Repositories.GetListAsync(p => p.Name.Contains(searchKey)|| p.SecretKey==searchKey);
|
||||
}
|
||||
|
||||
list.AddRange(data);
|
||||
@@ -57,6 +57,10 @@ namespace AntSK.Pages.AppPage
|
||||
NavigationManager.NavigateTo($"/app/open/{id}");
|
||||
}
|
||||
|
||||
private void Use(string id)
|
||||
{
|
||||
NavigationManager.NavigateTo($"/chat/{id}");
|
||||
}
|
||||
|
||||
private async Task Delete(string id)
|
||||
{
|
||||
|
||||
@@ -69,6 +69,20 @@
|
||||
</Row>
|
||||
<Divider><Title Level="3">功能特性</Title></Divider>
|
||||
<Space Size=@(("10", "10" )) Wrap Align="start" Style="padding:10px">
|
||||
<SpaceItem>
|
||||
<Card Bordered="true" Title=@("👉🏻商业版") Hoverable="true" Style="height:260px;width:300px">
|
||||
<Body>
|
||||
<Text>● AntSKPro为商业版 <a href="https://antsk.cn" target="_blank">访问官网</a></Text>
|
||||
<br>
|
||||
<Text>● 开源版本请参见:</Text>
|
||||
<a href="https://github.com/AIDotNet/AntSK" target="_blank">AntSK开源版</a>
|
||||
<br>
|
||||
<Text>● 如需商业版授权,请联系微信:</Text>
|
||||
<b style="color:#1890ff">xuzeyu91</b>
|
||||
<br>
|
||||
</Body>
|
||||
</Card>
|
||||
</SpaceItem>
|
||||
<SpaceItem>
|
||||
<Card Bordered="true" Title=@("🍬语义内核") Hoverable="true" Style="height:260px;width:300px">
|
||||
<Body>
|
||||
@@ -152,20 +166,13 @@
|
||||
</Card>
|
||||
</SpaceItem>
|
||||
<SpaceItem>
|
||||
<Card Bordered="true" Title=@("❤项目最新进展") Hoverable="true" Style="height:260px;width:300px">
|
||||
<Card Bordered="true" Title=@("❤关注我的公众号") Hoverable="true" Style="height:260px;width:300px">
|
||||
<Body>
|
||||
<Image Height="170" Src="./assets/gzh.jpg" />
|
||||
</Body>
|
||||
</Card>
|
||||
</SpaceItem>
|
||||
<SpaceItem>
|
||||
<Card Bordered="true" Title=@("🥤项目赞助") Hoverable="true" Style="height:260px;width:300px">
|
||||
<Body>
|
||||
<Image Width="110" Src="./assets/zfb.png" />
|
||||
<Image Width="110" Src="./assets/wx.png" />
|
||||
</Body>
|
||||
</Card>
|
||||
</SpaceItem>
|
||||
|
||||
</Space>
|
||||
</GridContent>
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
<FormItem Label="知识库名称" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入知识库名称" @bind-Value="@context.Name" />
|
||||
</FormItem>
|
||||
<FormItem Label="图标" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
@* <Input Placeholder="请输入图标" @bind-Value="@context.Icon" />
|
||||
<a href="https://antblazor.com/zh-CN/components/icon" target="_blank">图标库</a> *@
|
||||
@* <FormItem Label="图标" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入图标" @bind-Value="@context.Icon" />
|
||||
<a href="https://antblazor.com/zh-CN/components/icon" target="_blank">图标库</a>
|
||||
<IconPicker @bind-Value="@context.Icon"></IconPicker>
|
||||
</FormItem>
|
||||
</FormItem>*@
|
||||
<FormItem Label="描述" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入描述" @bind-Value="@context.Describe" />
|
||||
</FormItem>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
@using BlazorComponents.Terminal
|
||||
@page "/modelmanager/model/add"
|
||||
@page "/modelmanager/model/add/{ModelId}"
|
||||
@page "/modelmanager/model/addbypath/{ModelPath}"
|
||||
@using AntSK.Services.Auth
|
||||
@inherits AuthComponentBase
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@@ -18,104 +17,100 @@
|
||||
<Card>
|
||||
<Form Model="@_aiModel"
|
||||
Style="margin-top: 8px;"
|
||||
OnFinish="HandleSubmit">
|
||||
OnFinish="HandleSubmit"
|
||||
Autocomplete="off">
|
||||
<FormItem Label="模型描述" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入模型描述" @bind-Value="@context.ModelDescription" />
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="AI类型" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<EnumRadioGroup @bind-Value="context.AIType" ButtonStyle="RadioButtonStyle.Solid" OnChange="AITypeChange" TEnum="AIType"> </EnumRadioGroup>
|
||||
</FormItem>
|
||||
<FormItem Label="模型类型" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<RadioGroup @bind-Value="context.AIModelType" ButtonStyle="RadioButtonStyle.Solid">
|
||||
@if (context.AIType == AIType.StableDiffusion)
|
||||
<RadioGroup @bind-Value="context.AIModelType" ButtonStyle="RadioButtonStyle.Solid" OnChange="AIModelTypeChange" TValue="AIModelType">
|
||||
<Radio RadioButton Value="@(AIModelType.Chat)">会话模型</Radio>
|
||||
<Radio RadioButton Value="@(AIModelType.Embedding)">向量模型</Radio>
|
||||
<Radio RadioButton Value="@(AIModelType.Rerank)">Rerank重排模型</Radio>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="AI类型" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<RadioGroup @bind-Value="context.AIType" ButtonStyle="RadioButtonStyle.Solid" OnChange="AITypeChange" TValue="AIType">
|
||||
@if (context.AIModelType == AIModelType.Chat)
|
||||
{
|
||||
<Radio RadioButton Value="@(AIModelType.Image)">图片模型</Radio>
|
||||
<Radio RadioButton Value="@(AIType.OpenAI)">OpenAI</Radio>
|
||||
<Radio RadioButton Value="@(AIType.AzureOpenAI)">AzureOpenAI</Radio>
|
||||
<Radio RadioButton Value="@(AIType.SparkDesk)">星火大模型</Radio>
|
||||
<Radio RadioButton Value="@(AIType.DashScope)">灵积大模型</Radio>
|
||||
<Radio RadioButton Value="@(AIType.Ollama)">Ollama本地模型</Radio>
|
||||
<Radio RadioButton Value="@(AIType.LLamaFactory)">LLamaFactory本地模型</Radio>
|
||||
<Radio RadioButton Value="@(AIType.Mock)">模拟输出</Radio>
|
||||
}
|
||||
else
|
||||
else if (context.AIModelType == AIModelType.Embedding)
|
||||
{
|
||||
@if (context.AIType != AIType.BgeEmbedding && context.AIType != AIType.BgeRerank)
|
||||
{
|
||||
<Radio RadioButton Value="@(AIModelType.Chat)">会话模型</Radio>
|
||||
}
|
||||
@if (context.AIType != AIType.LLamaFactory && context.AIType != AIType.Mock && context.AIType != AIType.SparkDesk && context.AIType != AIType.BgeRerank && context.AIType != AIType.Ollama)
|
||||
{
|
||||
<Radio RadioButton Value="@(AIModelType.Embedding)">向量模型</Radio>
|
||||
}
|
||||
@if (context.AIType == AIType.BgeRerank)
|
||||
{
|
||||
<Radio RadioButton Value="@(AIModelType.Rerank)">Rerank重排模型</Radio>
|
||||
}
|
||||
<Radio RadioButton Value="@(AIType.BgeEmbedding)">BgeEmbedding</Radio>
|
||||
<Radio RadioButton Value="@(AIType.OpenAI)">OpenAI</Radio>
|
||||
<Radio RadioButton Value="@(AIType.AzureOpenAI)">AzureOpenAI</Radio>
|
||||
<Radio RadioButton Value="@(AIType.OllamaEmbedding)">Ollama本地模型</Radio>
|
||||
}
|
||||
else if (context.AIModelType == AIModelType.Rerank)
|
||||
{
|
||||
<Radio RadioButton Value="@(AIType.BgeRerank)">BgeRerank</Radio>
|
||||
}
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
|
||||
@if (context.AIModelType == AIModelType.Embedding)
|
||||
{
|
||||
<FormItem Label="注意事项" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<span style="color:red"><b>请不要使用不同维度的向量模型,否则会导致无法向量存储</b></span>
|
||||
</FormItem>
|
||||
}
|
||||
|
||||
@if (context.AIType == AIType.AzureOpenAI)
|
||||
{
|
||||
<FormItem Label="请求地址" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入请求地址" @bind-Value="@context.EndPoint" />
|
||||
<Input Placeholder="请输入请求地址" @bind-Value="@context.EndPoint" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="部署名(模型名)" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入部署名" @bind-Value="@context.ModelName" />
|
||||
<Input Placeholder="请输入部署名" @bind-Value="@context.ModelName" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="模型秘钥" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputPassword @bind-Value="@context.ModelKey" Placeholder="请输入模型秘钥" />
|
||||
<InputPassword @bind-Value="@context.ModelKey" Placeholder="请输入模型秘钥" AutoComplete="false" />
|
||||
</FormItem>
|
||||
}
|
||||
@if (context.AIType == AIType.OpenAI)
|
||||
{
|
||||
<FormItem Label="代理API" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<a href="https://api.antsk.cn/" target="_blank">去创建</a>
|
||||
</FormItem>
|
||||
<FormItem Label="请求地址" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入请求地址 示例格式 http://ip:port/" @bind-Value="@context.EndPoint" />
|
||||
<Input Placeholder="请输入请求地址 示例格式 http://ip:port/" @bind-Value="@context.EndPoint" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="模型名称" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入模型名称" @bind-Value="@context.ModelName" />
|
||||
<Input Placeholder="请输入模型名称" @bind-Value="@context.ModelName" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="模型秘钥" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputPassword @bind-Value="@context.ModelKey" Placeholder="请输入模型秘钥" />
|
||||
<InputPassword @bind-Value="@context.ModelKey" Placeholder="请输入模型秘钥" AutoComplete="false" />
|
||||
</FormItem>
|
||||
}
|
||||
@if (context.AIType == AIType.SparkDesk)
|
||||
{
|
||||
<FormItem Label="模型版本" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<SimpleSelect DefaultValue="V3_5" @bind-Value="@context.ModelName">
|
||||
<SimpleSelect DefaultValue="Lite" @bind-Value="@context.ModelName">
|
||||
<SelectOptions>
|
||||
<SimpleSelectOption Value="V3_5" Label="V3_5"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="V3" Label="V3"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="V2" Label="V2" Disabled></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="V1_5" Label="V1_5"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="Max" Label="Max"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="Pro" Label="Pro"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="V2" Label="V2"></SimpleSelectOption>
|
||||
<SimpleSelectOption Value="Lite" Label="Lite"></SimpleSelectOption>
|
||||
</SelectOptions>
|
||||
</SimpleSelect>
|
||||
</FormItem>
|
||||
<FormItem Label="请输入模型APPID|APISecret|APIKey" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputPassword Placeholder="APPID|APISecret|APIKey" @bind-Value="@context.ModelKey" />
|
||||
<InputPassword Placeholder="APPID|APISecret|APIKey" @bind-Value="@context.ModelKey" AutoComplete="false" />
|
||||
</FormItem>
|
||||
|
||||
}
|
||||
@if (context.AIType == AIType.DashScope)
|
||||
{
|
||||
<FormItem Label="API KEY" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入API KEY" @bind-Value="@context.ModelKey" />
|
||||
<Input Placeholder="请输入API KEY" @bind-Value="@context.ModelKey" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="模型名称" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="请输入模型名称" @bind-Value="@context.ModelName" />
|
||||
</FormItem>
|
||||
}
|
||||
@if (context.AIType == AIType.LLamaSharp || context.AIType == AIType.StableDiffusion)
|
||||
{
|
||||
<FormItem Label="模型路径" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputGroup>
|
||||
<AutoComplete Options="_modelFiles" Placeholder="请输入模型路径" @bind-Value="@context.ModelName" />
|
||||
<Button OnClick="()=>_downloadModalVisible=true">从Haggingface下载</Button>
|
||||
</InputGroup>
|
||||
<Input Placeholder="请输入模型名称" @bind-Value="@context.ModelName" AutoComplete="false" />
|
||||
</FormItem>
|
||||
}
|
||||
@if (context.AIType == AIType.LLamaFactory)
|
||||
@@ -136,10 +131,14 @@
|
||||
</InputGroup>
|
||||
</FormItem>
|
||||
<FormItem Label="请求地址" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="http://localhost:8080/" @bind-Value="@context.EndPoint" />
|
||||
<Input Placeholder="http://localhost:8080/" @bind-Value="@context.EndPoint" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="环境安装" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Button Type="primary" OnClick="PipInstall">环境安装</Button>
|
||||
<FormItem Label="基础环境安装" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Button Type="primary" OnClick="PipInstall">开始安装</Button>
|
||||
</FormItem>
|
||||
|
||||
<FormItem Label="缺失依赖包安装" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Button Type="primary" OnClick="PipInstallShow">pip install</Button>
|
||||
</FormItem>
|
||||
<FormItem Label="llama factory服务" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputGroup>
|
||||
@@ -173,19 +172,46 @@
|
||||
<a href="https://ollama.com/library" target="_blank">获取更多模型</a>
|
||||
</FormItem>
|
||||
<FormItem Label="请求地址" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="http://localhost:11434/" @bind-Value="@context.EndPoint" />
|
||||
<Input Placeholder="http://localhost:11434/" @bind-Value="@context.EndPoint" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="环境安装" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<a href="https://ollama.com/download" target="_blank">下载Ollama</a>
|
||||
</FormItem>
|
||||
<FormItem Label="Ollama服务" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputGroup>
|
||||
|
||||
<Button Type="primary" OnClick="StartOllamaService" >启动</Button>
|
||||
|
||||
<Button Type="primary" OnClick="StartOllamaService">启动</Button>
|
||||
</InputGroup>
|
||||
</FormItem>
|
||||
}
|
||||
@if (context.AIType == AIType.OllamaEmbedding)
|
||||
{
|
||||
<FormItem Label="模型名称" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputGroup>
|
||||
<Select TItem="string"
|
||||
TItemValue="string"
|
||||
DataSource="@ollamaEmbeddingModelList"
|
||||
@bind-Value="@context.ModelName"
|
||||
ValueProperty="c=>c"
|
||||
LabelProperty="c=>c"
|
||||
Placeholder="选择模型"
|
||||
DefaultActiveFirstOption="false"
|
||||
EnableSearch
|
||||
OnSearch="OnOllamaEmbeddingSearch">
|
||||
</Select>
|
||||
</InputGroup>
|
||||
<a href="https://ollama.com/library" target="_blank">获取更多模型</a>
|
||||
</FormItem>
|
||||
<FormItem Label="请求地址" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Input Placeholder="http://localhost:11434/" @bind-Value="@context.EndPoint" AutoComplete="false" />
|
||||
</FormItem>
|
||||
<FormItem Label="环境安装" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<a href="https://ollama.com/download" target="_blank">下载Ollama</a>
|
||||
</FormItem>
|
||||
<FormItem Label="Ollama服务" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<InputGroup>
|
||||
<Button Type="primary" OnClick="StartOllamaService">启动</Button>
|
||||
</InputGroup>
|
||||
</FormItem>
|
||||
|
||||
}
|
||||
@if (context.AIType == AIType.BgeEmbedding)
|
||||
{
|
||||
@@ -199,7 +225,7 @@
|
||||
|
||||
<FormItem Label="Python路径" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Popover ContentTemplate="@_content" Title="提示" Style="width:100%">
|
||||
<Input Placeholder="D:\Programs\Python\Python311\python311.dll" @bind-Value="@context.EndPoint" />
|
||||
<Input Placeholder="D:\Programs\Python\Python311\python311.dll" @bind-Value="@context.EndPoint" AutoComplete="false" />
|
||||
</Popover>
|
||||
</FormItem>
|
||||
|
||||
@@ -223,7 +249,7 @@
|
||||
</FormItem>
|
||||
<FormItem Label="Python路径" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
<Popover ContentTemplate="@_content" Title="提示" Style="width:100%">
|
||||
<Input Placeholder="D:\Programs\Python\Python311\python311.dll" @bind-Value="@context.EndPoint" />
|
||||
<Input Placeholder="D:\Programs\Python\Python311\python311.dll" @bind-Value="@context.EndPoint" AutoComplete="false" />
|
||||
</Popover>
|
||||
</FormItem>
|
||||
<FormItem Label="环境安装" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
|
||||
@@ -257,7 +283,7 @@
|
||||
<Input Disabled="_downloadStarted" Placeholder="请输入下载地址" @bind-Value="_downloadUrl" Style="width:80%"></Input>
|
||||
@if (!_downloadStarted)
|
||||
{
|
||||
<Button OnClick="StartDownload">开始</Button>
|
||||
<Button OnClick="StartDownload" Style="margin-left:10px;" Type="@ButtonType.Primary">开始</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,8 +295,19 @@
|
||||
</Flex>
|
||||
</Modal>
|
||||
|
||||
<Modal @ref="_modal" Visible="_pipModalVisible" Footer="null" Closable Title="pip install" OnCancel="OnCancelPipInstall" DestroyOnClose>
|
||||
<Flex Gap="10" Vertical>
|
||||
<InputGroup>
|
||||
<Input Placeholder="请输入包名(例如 pip install torch 则只需要输入 torch)" @bind-Value="_pipName" Style="border-radius: 8px"></Input>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<Button OnClick="PipInstallName" Type="@ButtonType.Primary">pip install</Button>
|
||||
</InputGroup>
|
||||
</Flex>
|
||||
</Modal>
|
||||
|
||||
<Modal Visible="_logModalVisible" Footer="null" Closable Title="日志输出" OnCancel="OnCancelLog" DestroyOnClose Width="1000">
|
||||
<BlazorTerminal @ref="blazorTerminal" Style="height:600px;"></BlazorTerminal>
|
||||
<BlazorTerminal @ref="blazorTerminal" Style="height:600px;overflow-y: auto;"></BlazorTerminal>
|
||||
</Modal>
|
||||
|
||||
|
||||
|
||||
@@ -4,17 +4,16 @@ using AntSK.Domain.Domain.Interface;
|
||||
using AntSK.Domain.Domain.Model.Constant;
|
||||
using AntSK.Domain.Domain.Model.Enum;
|
||||
using AntSK.Domain.Domain.Other.Bge;
|
||||
using AntSK.Domain.Domain.Service;
|
||||
using AntSK.Domain.Options;
|
||||
using AntSK.Domain.Repositories;
|
||||
using AntSK.Domain.Utils;
|
||||
using AntSK.LLamaFactory.Model;
|
||||
using BlazorComponents.Terminal;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using Downloader;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NRedisStack.Search;
|
||||
using Serilog;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AntSK.Pages.Setting.AIModel
|
||||
{
|
||||
@@ -22,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; }
|
||||
@@ -45,6 +42,9 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
private bool _downloadStarted;
|
||||
private IDownload _download;
|
||||
|
||||
private bool _pipModalVisible;
|
||||
private string _pipName;
|
||||
|
||||
private Modal _modal;
|
||||
private string[] _modelFiles;
|
||||
|
||||
@@ -53,19 +53,19 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
private List<MenuDataItem> menuList = new List<MenuDataItem>();
|
||||
|
||||
//llamafactory
|
||||
private List<LLamaModel> modelList=new List<LLamaModel>();
|
||||
private List<LLamaModel> modelList = new List<LLamaModel>();
|
||||
private bool llamaFactoryIsStart = false;
|
||||
private Dics llamaFactoryDic= new Dics();
|
||||
|
||||
private Dics llamaFactoryDic = new Dics();
|
||||
//ollama
|
||||
private List<string> ollamaModelList = new List<string>();
|
||||
|
||||
private List<string> ollamaEmbeddingModelList = new List<string>();
|
||||
//日志输出
|
||||
private BlazorTerminal blazorTerminal = new BlazorTerminal();
|
||||
private BlazorTerminal blazorTerminal = new BlazorTerminal();
|
||||
private TerminalParagraph para;
|
||||
private bool _logModalVisible;
|
||||
|
||||
private List<string> bgeEmbeddingList = new List<string>() { "AI-ModelScope/bge-small-zh-v1.5", "AI-ModelScope/bge-base-zh-v1.5", "AI-ModelScope/bge-large-zh-v1.5" };
|
||||
private List<string> bgeRerankList = new List<string>() { "Xorbits/bge-reranker-base", "Xorbits/bge-reranker-large", "AI-ModelScope/bge-reranker-v2-m3", "AI-ModelScope/bge-reranker-v2-gemma"};
|
||||
private List<string> bgeRerankList = new List<string>() { "Xorbits/bge-reranker-base", "Xorbits/bge-reranker-large", "AI-ModelScope/bge-reranker-v2-m3", "AI-ModelScope/bge-reranker-v2-gemma" };
|
||||
private bool BgeEmbeddingIsStart = false;
|
||||
private string BgeEmbeddingBtnText = "初始化";
|
||||
|
||||
@@ -84,47 +84,27 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
}
|
||||
|
||||
modelList = _ILLamaFactoryService.GetLLamaFactoryModels();
|
||||
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList();
|
||||
ollamaEmbeddingModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaEmbeddingModelList.txt")).ToList();
|
||||
|
||||
llamaFactoryDic = await _IDics_Repositories.GetFirstAsync(p => p.Type == LLamaFactoryConstantcs.LLamaFactorDic && p.Key == LLamaFactoryConstantcs.IsStartKey);
|
||||
if (llamaFactoryDic != null)
|
||||
{
|
||||
llamaFactoryIsStart = llamaFactoryDic.Value == "false" ? false : true;
|
||||
}
|
||||
|
||||
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList();
|
||||
//目前只支持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 ".gguf":
|
||||
_aiModel.AIType = AIType.LLamaSharp;
|
||||
break;
|
||||
case ".safetensors":
|
||||
case ".ckpt":
|
||||
_aiModel.AIType = AIType.StableDiffusion;
|
||||
break;
|
||||
|
||||
}
|
||||
//下载页跳入
|
||||
|
||||
_downloadModalVisible = true;
|
||||
|
||||
_downloadUrl = $"https://hf-mirror.com{ModelPath.Replace("---","/")}";
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
_ = Message.Error("LLamaSharp.FileDirectory目录配置不正确!", 2);
|
||||
Log.Error(ex.Message + ex.StackTrace);
|
||||
_ = Message.Error($"{ex.Message + ex.StackTrace}", 2);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleSubmit()
|
||||
{
|
||||
if (_aimodels_Repositories.IsAny(p => p.Id!=_aiModel.Id.ConvertToString()&& p.AIModelType == _aiModel.AIModelType && p.EndPoint == _aiModel.EndPoint.ConvertToString() && p.ModelKey == _aiModel.ModelKey && p.ModelName == _aiModel.ModelName))
|
||||
if (_aiModel.ModelDescription.IsNull())
|
||||
{
|
||||
_ = Message.Error("模型已存在!", 2);
|
||||
_ = Message.Error("模型描述必须填写", 2);
|
||||
return;
|
||||
}
|
||||
if (_aiModel.AIType.IsNull())
|
||||
@@ -137,6 +117,12 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
_ = Message.Error("模型类型必须选择", 2);
|
||||
return;
|
||||
}
|
||||
if (_aimodels_Repositories.IsAny(p => p.Id != _aiModel.Id.ConvertToString() && p.AIModelType == _aiModel.AIModelType && p.EndPoint == _aiModel.EndPoint.ConvertToString() && p.ModelKey == _aiModel.ModelKey && p.ModelName == _aiModel.ModelName))
|
||||
{
|
||||
_ = Message.Error("模型已存在!", 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(ModelId))
|
||||
{
|
||||
//新增
|
||||
@@ -189,7 +175,7 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
|
||||
private void DownloadProgressChanged(object? sender, DownloadProgressChangedEventArgs e)
|
||||
{
|
||||
_downloadProgress = Math.Round( e.ProgressPercentage,2);
|
||||
_downloadProgress = Math.Round(e.ProgressPercentage, 2);
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
@@ -221,7 +207,7 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
|
||||
private void StopDownload()
|
||||
{
|
||||
_downloadStarted=false;
|
||||
_downloadStarted = false;
|
||||
_download?.Stop();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
@@ -229,8 +215,8 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
private void OnSearch(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
modelList = _ILLamaFactoryService.GetLLamaFactoryModels();
|
||||
{
|
||||
modelList = _ILLamaFactoryService.GetLLamaFactoryModels();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,19 +225,6 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
|
||||
}
|
||||
|
||||
private void OnOllamaSearch(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList().Where(p => p.ToLower().Contains(value.ToLower())).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动服务
|
||||
/// </summary>
|
||||
@@ -268,7 +241,7 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
_IDics_Repositories.Update(llamaFactoryDic);
|
||||
_ILLamaFactoryService.LogMessageReceived -= CmdLogHandler;
|
||||
_ILLamaFactoryService.LogMessageReceived += CmdLogHandler;
|
||||
_ILLamaFactoryService.StartLLamaFactory(_aiModel.ModelName, "default");
|
||||
_ILLamaFactoryService.StartLLamaFactory(_aiModel.ModelName);
|
||||
}
|
||||
|
||||
private void StopLFService()
|
||||
@@ -278,7 +251,57 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
_IDics_Repositories.Update(llamaFactoryDic);
|
||||
_ILLamaFactoryService.KillProcess();
|
||||
}
|
||||
private async Task PipInstall()
|
||||
{
|
||||
var content = "初次使用需要执行pip install,点击确认后可自动执行,是否执行";
|
||||
var title = "提示";
|
||||
var result = await _confirmService.Show(content, title, ConfirmButtons.YesNo);
|
||||
if (result == ConfirmResult.Yes)
|
||||
{
|
||||
_logModalVisible = true;
|
||||
_ILLamaFactoryService.LogMessageReceived -= CmdLogHandler;
|
||||
_ILLamaFactoryService.LogMessageReceived += CmdLogHandler;
|
||||
_ILLamaFactoryService.PipInstall();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PipInstallShow()
|
||||
{
|
||||
_pipModalVisible = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
private void OnOllamaSearch(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList().Where(p => p.ToLower().Contains(value.ToLower())).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Embedding 搜索
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
private void OnOllamaEmbeddingSearch(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
ollamaEmbeddingModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaEmbeddingModelList.txt")).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ollamaEmbeddingModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaEmbeddingModelList.txt")).ToList().Where(p => p.ToLower().Contains(value.ToLower())).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Ollama
|
||||
/// </summary>
|
||||
@@ -291,25 +314,27 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
return;
|
||||
}
|
||||
_logModalVisible = true;
|
||||
|
||||
|
||||
_ollamaService.LogMessageReceived -= CmdLogHandler;
|
||||
_ollamaService.LogMessageReceived += CmdLogHandler;
|
||||
_ollamaService.StartOllama(_aiModel.ModelName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task PipInstall()
|
||||
private void OnCancelPipInstall()
|
||||
{
|
||||
var content = "初次使用需要执行pip install,点击确认后可自动执行,是否执行";
|
||||
var title = "提示";
|
||||
var result = await _confirmService.Show(content, title, ConfirmButtons.YesNo);
|
||||
if (result == ConfirmResult.Yes)
|
||||
_pipModalVisible = false;
|
||||
}
|
||||
|
||||
private async Task PipInstallName()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_pipName))
|
||||
{
|
||||
_pipModalVisible = false;
|
||||
_logModalVisible = true;
|
||||
_ILLamaFactoryService.LogMessageReceived -= CmdLogHandler;
|
||||
_ILLamaFactoryService.LogMessageReceived += CmdLogHandler;
|
||||
_ILLamaFactoryService.PipInstall();
|
||||
_ILLamaFactoryService.PipInstallName(_pipName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +366,7 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
_ = Message.Error(ex.Message, 2);
|
||||
BgeEmbeddingIsStart = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private async Task BgeRerank()
|
||||
@@ -381,46 +406,67 @@ namespace AntSK.Pages.Setting.AIModel
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
para = blazorTerminal.RespondText("");
|
||||
para.AddTextLine(message);
|
||||
para.AddTextLine(message);
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// 停止服务
|
||||
/// </summary>
|
||||
|
||||
private void OnCancelLog() {
|
||||
|
||||
private void OnCancelLog()
|
||||
{
|
||||
_logModalVisible = false;
|
||||
}
|
||||
|
||||
private void AITypeChange(AIType aiType)
|
||||
private void AITypeChange(AIType aiType)
|
||||
{
|
||||
//切换时清空
|
||||
_aiModel.EndPoint = "";
|
||||
_aiModel.ModelKey = "";
|
||||
_aiModel.ModelName = "";
|
||||
switch (aiType)
|
||||
{
|
||||
case AIType.OpenAI:
|
||||
_aiModel.EndPoint = "https://api.antsk.cn/";
|
||||
break;
|
||||
case AIType.LLamaFactory:
|
||||
_aiModel.EndPoint = "http://localhost:8000/";
|
||||
_aiModel.AIModelType=AIModelType.Chat;
|
||||
_aiModel.AIModelType = AIModelType.Chat;
|
||||
break;
|
||||
case AIType.Ollama:
|
||||
_aiModel.EndPoint = "http://localhost:11434/";
|
||||
_aiModel.AIModelType = AIModelType.Chat;
|
||||
break;
|
||||
case AIType.StableDiffusion:
|
||||
_aiModel.AIModelType = AIModelType.Image;
|
||||
case AIType.OllamaEmbedding:
|
||||
_aiModel.EndPoint = "http://localhost:11434/";
|
||||
_aiModel.AIModelType = AIModelType.Embedding;
|
||||
break;
|
||||
case AIType.Mock:
|
||||
_aiModel.AIModelType = AIModelType.Chat;
|
||||
break ;
|
||||
break;
|
||||
case AIType.BgeEmbedding:
|
||||
_aiModel.AIModelType = AIModelType.Embedding;
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
_aiModel.EndPoint = "/opt/conda/pkgs/python-3.10.13-h955ad1f_0/lib/libpython3.10.so";
|
||||
}
|
||||
break;
|
||||
case AIType.BgeRerank:
|
||||
_aiModel.AIModelType = AIModelType.Rerank;
|
||||
|
||||
break;
|
||||
default:
|
||||
_aiModel.AIModelType = AIModelType.Chat;
|
||||
}
|
||||
}
|
||||
|
||||
private void AIModelTypeChange(AIModelType aIModelType)
|
||||
{
|
||||
switch (aIModelType)
|
||||
{
|
||||
case AIModelType.Chat:
|
||||
_aiModel.AIType = AIType.OpenAI;
|
||||
break;
|
||||
case AIModelType.Embedding:
|
||||
_aiModel.AIType = AIType.BgeEmbedding;
|
||||
break;
|
||||
case AIModelType.Rerank:
|
||||
_aiModel.AIType = AIType.BgeRerank;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +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")]
|
||||
|
||||
<div>
|
||||
<PageContainer Title="模型列表">
|
||||
<Content>
|
||||
<RadioGroup @bind-Value="@_modelType" OnChange="OnModelTypeChange" TValue="string">
|
||||
<Radio Value="@("gguf")" DefaultChecked=true>LLama本地模型(gguf)</Radio>
|
||||
<Radio Value="@("safetensors")">StableDiffusion(safetensors)</Radio>
|
||||
<Radio Value="@("ckpt")">StableDiffusion2(ckpt)</Radio>
|
||||
</RadioGroup>
|
||||
<div style="text-align: center;">
|
||||
|
||||
<Search Placeholder="输入回车"
|
||||
EnterButton="@("搜索")"
|
||||
Size="large"
|
||||
Style="max-width: 522px; width: 100%;"
|
||||
OnSearch="Search" />
|
||||
|
||||
</div>
|
||||
</Content>
|
||||
<ChildContent>
|
||||
<div class="filterCardList">
|
||||
<Spin Tip="加载中..." Spinning="@(loaddding)">
|
||||
<AntList TItem="HfModels"
|
||||
Grid="LayoutModel._listGridType"
|
||||
DataSource="_modelList">
|
||||
<ListItem NoFlex>
|
||||
<Card Hoverable
|
||||
BodyStyle="padding-bottom: 20px;"
|
||||
Actions="new[] {
|
||||
down(()=> Down(context.Id))
|
||||
}">
|
||||
<CardMeta>
|
||||
<TitleTemplate>
|
||||
@context.Id
|
||||
</TitleTemplate>
|
||||
<AvatarTemplate>
|
||||
<Avatar Size="small" Src="@context.AuthorData.AvatarUrl" />
|
||||
</AvatarTemplate>
|
||||
</CardMeta>
|
||||
<div class="cardItemContent">
|
||||
<div class="cardInfo">
|
||||
<div>
|
||||
<p>Downloads</p>
|
||||
<p>@context.Downloads.ToString("0,0")</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>Likes</p>
|
||||
<p>@context.Likes.ToString("0,0")</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</ListItem>
|
||||
</AntList>
|
||||
</Spin>
|
||||
</div>
|
||||
</ChildContent>
|
||||
</PageContainer>
|
||||
</div>
|
||||
@code
|
||||
{
|
||||
RenderFragment down(Action clickAction) =>@<a key="down" @onclick="@clickAction">下载</a>;
|
||||
|
||||
}
|
||||
|
||||
@@ -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<string> _selectCategories = new List<string>();
|
||||
|
||||
private List<HfModels> _modelList = new List<HfModels>();
|
||||
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<HfModel>(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<HfModel>(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("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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")]
|
||||
|
||||
|
||||
<div>
|
||||
<PageContainer Title="模型下载">
|
||||
<ChildContent>
|
||||
<div class="standardList">
|
||||
<Card Class="listCard"
|
||||
Title="模型列表"
|
||||
Style="margin-top: 24px;"
|
||||
BodyStyle="padding: 0 32px 40px 32px">
|
||||
<Extra>
|
||||
|
||||
</Extra>
|
||||
<ChildContent>
|
||||
<AntList TItem="HfModelDetail"
|
||||
DataSource="modelList"
|
||||
ItemLayout="ListItemLayout.Horizontal">
|
||||
<ListItem Actions="new[] {
|
||||
down(()=> Down(context.Path))
|
||||
}" Style="width:100%">
|
||||
<div class="listContent" style="width:100%">
|
||||
<div class="listContentItem" style="width:20%">
|
||||
<b>名称</b>
|
||||
<p>@context.Name</p>
|
||||
</div>
|
||||
<div class="listContentItem" style="width:20%">
|
||||
<b>文件大小</b>
|
||||
<p>@context.Size</p>
|
||||
</div>
|
||||
<div class="listContentItem" style="width:20%">
|
||||
<b>更新时间</b>
|
||||
<p>@context.Time</p>
|
||||
</div>
|
||||
</div>
|
||||
</ListItem>
|
||||
</AntList>
|
||||
</ChildContent>
|
||||
</Card>
|
||||
</div>
|
||||
</ChildContent>
|
||||
</PageContainer>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
RenderFragment down(Action clickAction) =>@<a key="down" @onclick="@clickAction">下载</a>;
|
||||
}
|
||||
@@ -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<HfModelDetail> modelList = new List<HfModelDetail>();
|
||||
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("/", "---")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -54,10 +54,6 @@
|
||||
{
|
||||
<Tag Color="@PresetColor.Red.ToString()">AzureOpenAI</Tag>
|
||||
}
|
||||
else if (context.AIType == AIType.LLamaSharp)
|
||||
{
|
||||
<Tag Color="@PresetColor.Yellow.ToString()">LLamaSharp</Tag>
|
||||
}
|
||||
else if (context.AIType == AIType.SparkDesk)
|
||||
{
|
||||
<Tag Color="@PresetColor.Cyan.ToString()">SparkDesk</Tag>
|
||||
@@ -78,12 +74,8 @@
|
||||
{
|
||||
<Tag Color="@PresetColor.GeekBlue.ToString()">BgeRerank</Tag>
|
||||
}
|
||||
else if (context.AIType == AIType.StableDiffusion)
|
||||
{
|
||||
<Tag Color="@PresetColor.Magenta.ToString()">StableDiffusion</Tag>
|
||||
}
|
||||
else if (context.AIType == AIType.Ollama)
|
||||
{
|
||||
else if (context.AIType == AIType.Ollama || context.AIType == AIType.OllamaEmbedding)
|
||||
{
|
||||
<Tag Color="@PresetColor.Pink.ToString()">Ollama</Tag>
|
||||
}
|
||||
</p>
|
||||
@@ -101,10 +93,6 @@
|
||||
{
|
||||
<Tag Color="@PresetColor.Green.ToString()">向量模型</Tag>
|
||||
}
|
||||
else if (context.AIModelType == AIModelType.Image)
|
||||
{
|
||||
<Tag Color="@PresetColor.Lime.ToString()">图片模型</Tag>
|
||||
}
|
||||
else if (context.AIModelType == AIModelType.Rerank)
|
||||
{
|
||||
<Tag Color="@PresetColor.GeekBlue.ToString()">Rerank重排模型</Tag>
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AntSK</title>
|
||||
<base href="~/" />
|
||||
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />
|
||||
<link href="_content/AntDesign.ProLayout/css/ant-design-pro-layout-blazor.css" rel="stylesheet" />
|
||||
<link href="./css/ant-design-blazor.css" rel="stylesheet" />
|
||||
<link href="./css/ant-design-pro-layout-blazor.css" rel="stylesheet" />
|
||||
<link href="./css/site.css" rel="stylesheet" />
|
||||
<link href="AntSK.styles.css" rel="stylesheet" />
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ builder.AddServiceDefaults();
|
||||
|
||||
builder.Configuration.GetSection("DBConnection").Get<DBConnectionOption>();
|
||||
builder.Configuration.GetSection("Login").Get<LoginOption>();
|
||||
builder.Configuration.GetSection("LLamaSharp").Get<LLamaSharpOption>();
|
||||
builder.Configuration.GetSection("KernelMemory").Get<KernelMemoryOption>();
|
||||
builder.Configuration.GetSection("FileDir").Get<FileDirOption>();
|
||||
|
||||
@@ -79,27 +78,6 @@ builder.Services.AddBlazoredLocalStorage(config =>
|
||||
builder.Services.AddMapper();
|
||||
//后台队列任务
|
||||
builder.Services.AddBackgroundTaskBroker().AddHandler<ImportKMSTaskReq, BackGroundTaskHandler>("ImportKMSTask");
|
||||
// 读取连接字符串配置
|
||||
|
||||
if (LLamaSharpOption.RunType.ToUpper() == "CPU")
|
||||
{
|
||||
NativeLibraryConfig
|
||||
.All
|
||||
.WithCuda(false)
|
||||
.WithLogCallback((level, message) => {
|
||||
logger.LogInformation($"[llama {level}]: {message.TrimEnd('\n')}");
|
||||
});
|
||||
}
|
||||
else if (LLamaSharpOption.RunType.ToUpper() == "GPU")
|
||||
{
|
||||
NativeLibraryConfig
|
||||
.All
|
||||
.WithCuda(true)
|
||||
.WithLogCallback((level, message) => {
|
||||
logger.LogInformation($"[llama {level}]: {message.TrimEnd('\n')}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//增加API允许跨域调用
|
||||
builder.Services.AddCors(options => options.AddPolicy("Any",
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
"ConnectionString": "Host=;Port=;Database=antsk;Username=;Password=",
|
||||
"TableNamePrefix": "km-"
|
||||
},
|
||||
"LLamaSharp": {
|
||||
"RunType": "GPU",
|
||||
"ContextSize": 2048,
|
||||
"GpuLayerCount": 20
|
||||
},
|
||||
"FileDir": {
|
||||
"DirectoryPath": "D:\\model"
|
||||
},
|
||||
|
||||
27136
src/AntSK/wwwroot/css/ant-design-blazor.css
Normal file
27136
src/AntSK/wwwroot/css/ant-design-blazor.css
Normal file
File diff suppressed because it is too large
Load Diff
1
src/AntSK/wwwroot/css/ant-design-pro-layout-blazor.css
Normal file
1
src/AntSK/wwwroot/css/ant-design-pro-layout-blazor.css
Normal file
File diff suppressed because one or more lines are too long
96
src/AntSK/wwwroot/css/diag.css
Normal file
96
src/AntSK/wwwroot/css/diag.css
Normal file
@@ -0,0 +1,96 @@
|
||||
.diagram-canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: inherit;
|
||||
outline: 0;
|
||||
overflow: hidden;
|
||||
cursor: -webkit-grab;
|
||||
cursor: grab;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.diagram-svg-layer, .diagram-html-layer {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
-webkit-transform-origin: 0 0;
|
||||
-ms-transform-origin: 0 0;
|
||||
transform-origin: 0 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.html-layer, .svg-layer {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
-webkit-transform-origin: 0 0;
|
||||
-ms-transform-origin: 0 0;
|
||||
transform-origin: 0 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.diagram-node {
|
||||
position: absolute;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
cursor: move;
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.diagram-node.locked {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.diagram-link {
|
||||
pointer-events: visiblePainted;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.diagram-navigator {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.diagram-navigator .current-view {
|
||||
position: absolute;
|
||||
border: 2px solid #000;
|
||||
}
|
||||
|
||||
.diagram-group {
|
||||
position: absolute;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
cursor: move;
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.diagram-group .children {
|
||||
position: absolute;
|
||||
overflow: visible;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.diagram-link foreignObject.diagram-link-label {
|
||||
overflow: visible;
|
||||
pointer-events: none;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
div.diagram-control {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.executable.diagram-control {
|
||||
pointer-events: all;
|
||||
cursor: pointer;
|
||||
}
|
||||
2
src/AntSK/wwwroot/css/prism-coy.min.css
vendored
2
src/AntSK/wwwroot/css/prism-coy.min.css
vendored
@@ -1 +1 @@
|
||||
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{position:relative;margin:.5em 0;overflow:visible;padding:1px}pre[class*=language-]>code{position:relative;z-index:1;border-left:10px solid #358ccb;box-shadow:-1px 0 0 0 #358ccb,0 0 0 1px #dfdfdf;background-color:#fdfdfd;background-image:linear-gradient(transparent 50%,rgba(69,142,209,.04) 50%);background-size:3em 3em;background-origin:content-box;background-attachment:local}code[class*=language-]{max-height:inherit;height:inherit;padding:0 1em;display:block;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background-color:#fdfdfd;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin-bottom:1em}:not(pre)>code[class*=language-]{position:relative;padding:.2em;border-radius:.3em;color:#c92c2c;border:1px solid rgba(0,0,0,.1);display:inline;white-space:normal}pre[class*=language-]:after,pre[class*=language-]:before{content:'';display:block;position:absolute;bottom:.75em;left:.18em;width:40%;height:20%;max-height:13em;box-shadow:0 13px 8px #979797;-webkit-transform:rotate(-2deg);-moz-transform:rotate(-2deg);-ms-transform:rotate(-2deg);-o-transform:rotate(-2deg);transform:rotate(-2deg)}pre[class*=language-]:after{right:.75em;left:auto;-webkit-transform:rotate(2deg);-moz-transform:rotate(2deg);-ms-transform:rotate(2deg);-o-transform:rotate(2deg);transform:rotate(2deg)}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#7d8b99}.token.punctuation{color:#5f6364}.token.boolean,.token.constant,.token.deleted,.token.function-name,.token.number,.token.property,.token.symbol,.token.tag{color:#c92c2c}.token.attr-name,.token.builtin,.token.char,.token.function,.token.inserted,.token.selector,.token.string{color:#2f9c0a}.token.entity,.token.operator,.token.url,.token.variable{color:#a67f59;background:rgba(255,255,255,.5)}.token.atrule,.token.attr-value,.token.class-name,.token.keyword{color:#1990b8}.token.important,.token.regex{color:#e90}.language-css .token.string,.style .token.string{color:#a67f59;background:rgba(255,255,255,.5)}.token.important{font-weight:400}.token.bold{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.namespace{opacity:.7}@media screen and (max-width:767px){pre[class*=language-]:after,pre[class*=language-]:before{bottom:14px;box-shadow:none}}pre[class*=language-].line-numbers.line-numbers{padding-left:0}pre[class*=language-].line-numbers.line-numbers code{padding-left:3.8em}pre[class*=language-].line-numbers.line-numbers .line-numbers-rows{left:0}pre[class*=language-][data-line]{padding-top:0;padding-bottom:0;padding-left:0}pre[data-line] code{position:relative;padding-left:4em}pre .line-highlight{margin-top:0}
|
||||
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{position:relative;margin:.5em 0;overflow:visible;padding:1px}pre[class*=language-]>code{position:relative;z-index:1;border-left:10px solid #1890ff;box-shadow:-1px 0 0 0 #1890ff,0 0 0 1px #dfdfdf;background-color:#fdfdfd;background-image:linear-gradient(transparent 50%,rgba(69,142,209,.04) 50%);background-size:3em 3em;background-origin:content-box;background-attachment:local}code[class*=language-]{max-height:inherit;height:inherit;padding:0 1em;display:block;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background-color:#fdfdfd;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin-bottom:1em}:not(pre)>code[class*=language-]{position:relative;padding:.2em;border-radius:.3em;color:#c92c2c;border:1px solid rgba(0,0,0,.1);display:inline;white-space:normal}pre[class*=language-]:after,pre[class*=language-]:before{content:'';display:block;position:absolute;bottom:.75em;left:.18em;width:40%;height:20%;max-height:13em;box-shadow:0 13px 8px #979797;-webkit-transform:rotate(-2deg);-moz-transform:rotate(-2deg);-ms-transform:rotate(-2deg);-o-transform:rotate(-2deg);transform:rotate(-2deg)}pre[class*=language-]:after{right:.75em;left:auto;-webkit-transform:rotate(2deg);-moz-transform:rotate(2deg);-ms-transform:rotate(2deg);-o-transform:rotate(2deg);transform:rotate(2deg)}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#7d8b99}.token.punctuation{color:#5f6364}.token.boolean,.token.constant,.token.deleted,.token.function-name,.token.number,.token.property,.token.symbol,.token.tag{color:#c92c2c}.token.attr-name,.token.builtin,.token.char,.token.function,.token.inserted,.token.selector,.token.string{color:#2f9c0a}.token.entity,.token.operator,.token.url,.token.variable{color:#a67f59;background:rgba(255,255,255,.5)}.token.atrule,.token.attr-value,.token.class-name,.token.keyword{color:#1990b8}.token.important,.token.regex{color:#e90}.language-css .token.string,.style .token.string{color:#a67f59;background:rgba(255,255,255,.5)}.token.important{font-weight:400}.token.bold{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.namespace{opacity:.7}@media screen and (max-width:767px){pre[class*=language-]:after,pre[class*=language-]:before{bottom:14px;box-shadow:none}}pre[class*=language-].line-numbers.line-numbers{padding-left:0}pre[class*=language-].line-numbers.line-numbers code{padding-left:3.8em}pre[class*=language-].line-numbers.line-numbers .line-numbers-rows{left:0}pre[class*=language-][data-line]{padding-top:0;padding-bottom:0;padding-left:0}pre[data-line] code{position:relative;padding-left:4em}pre .line-highlight{margin-top:0}
|
||||
@@ -53,3 +53,29 @@ ol {
|
||||
min-height: 100vh;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 1px; /* <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD> */
|
||||
height: 8px; /* <20><><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߶<C4B8> */
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #f5f5f5; /* <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ɫ */
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1; /* <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>Ĵָ<C4B4>ı<EFBFBD><C4B1><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6>IJ<EFBFBD><C4B2>֣<EFBFBD> */
|
||||
border-radius: 8px; /* <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>Ĵָ<C4B4><D6B8>Բ<EFBFBD><D4B2> */
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #555; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣʱ<CDA3><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵָ<C4B4>ı<EFBFBD><C4B1><EFBFBD>ɫ */
|
||||
}
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Firefox */
|
||||
* {
|
||||
scrollbar-width: thin; /* <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>Ϊϸ<CEAA><CFB8> */
|
||||
scrollbar-color: #ccc #f1f1f1; /* <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>Ĵָ<C4B4><EFBFBD><CDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ */
|
||||
}
|
||||
70
src/AntSK/wwwroot/css/theme.default.css
Normal file
70
src/AntSK/wwwroot/css/theme.default.css
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
/*@font-face {
|
||||
font-family: 'IBM Plex Mono';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/ibmplexmono/v19/-F6qfjptAgt5VM-kVkqdyU8n3twJwl1FgtIU.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}*/
|
||||
|
||||
/*@font-face {
|
||||
font-family: ibmplexmono;
|
||||
src: url(fonts/ibmplexmono.woff2);
|
||||
display: swap;
|
||||
}*/
|
||||
|
||||
@font-face {
|
||||
font-family: CascadiaCode;
|
||||
src: url(fonts/CascadiaCode.ttf);
|
||||
display: swap;
|
||||
}
|
||||
|
||||
|
||||
.bc-terminal-theme {
|
||||
font-family: CascadiaCode, monospace;
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
background-color: rgb(29, 42, 53);
|
||||
color: rgb(203, 213, 225);
|
||||
}
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph {
|
||||
}
|
||||
|
||||
.bc-terminal-theme .bc-terminal-input {
|
||||
color: rgb(203, 213, 225);
|
||||
caret-color: rgb(5, 206, 145);
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
/*line-height: 1.15;*/
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph-command > .bc-prompt > .bc-prompt-name {
|
||||
color: rgb(255, 157, 0);
|
||||
}
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph-command > .bc-prompt > .bc-prompt-spr1 {
|
||||
}
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph-command > .bc-prompt > .bc-prompt-host {
|
||||
color: rgb(5, 206, 145);
|
||||
}
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph-command > .bc-prompt > .bc-prompt-spr2 {
|
||||
}
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph-command > .bc-prompt > .bc-prompt-path {
|
||||
}
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph-command > .bc-prompt > .bc-prompt-pmt {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.bc-terminal-theme > .bc-paragraph-response > .bc-command-content {
|
||||
}
|
||||
@@ -45,11 +45,6 @@
|
||||
"path": "/modelmanager/modellist",
|
||||
"name": "模型管理",
|
||||
"key": "modelmanager.modellist"
|
||||
},
|
||||
{
|
||||
"path": "/modelmanager/modeldown",
|
||||
"name": "模型下载",
|
||||
"key": "modelmanager.modeldown"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -77,8 +72,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "https://antsk.cn/",
|
||||
"name": "使用文档",
|
||||
"path": "https://antsk.cn",
|
||||
"name": "官方文档",
|
||||
"key": "antskdoc",
|
||||
"icon": "question-circle"
|
||||
},
|
||||
@@ -94,4 +89,4 @@
|
||||
"key": "antskvideo",
|
||||
"icon": "video-camera"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="keywords" content="antd,umi,umijs,ant design,脚手架,布局, Ant Design,项目,Pro,admin,控制台,主页,开箱即用,中后台,解决方案,组件库" />
|
||||
<meta name="description" content="An out-of-box UI solution for enterprise applications as a React boilerplate." />
|
||||
<meta name="description" content="开箱即用的中台前端/设计解决方案。" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Ant Design Pro Blazor</title>
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||||
<base href="/" />
|
||||
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />
|
||||
<link href="_content/AntDesign.ProLayout/css/ant-design-pro-layout-blazor.css" rel="stylesheet" />
|
||||
<link href="./css/site.css" rel="stylesheet" />
|
||||
<link href="AntSK.styles.css" rel="stylesheet" />
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="keywords" content="AI,SemanticKernel,Rag,KMS" />
|
||||
<meta name="description" content="AntSKPro是一站式本地AI知识库,支持模型管理、用户管理、知识库管理、GraphRAG等" />
|
||||
<meta name="description" content="开箱即用的RAG、知识库平台" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>AntSK</title>
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||||
<base href="/" />
|
||||
<link href="./css/ant-design-blazor.css" rel="stylesheet" />
|
||||
<link href="./css/ant-design-pro-layout-blazor.css" rel="stylesheet" />
|
||||
<link href="./css/site.css" rel="stylesheet" />
|
||||
<link href="AntSK.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
12
src/AntSk.LLM/OllamaEmbeddingModelList.txt
Normal file
12
src/AntSk.LLM/OllamaEmbeddingModelList.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
nomic-embed-text:v1.5
|
||||
mxbai-embed-large:335m
|
||||
all-minilm:22m
|
||||
all-minilm:33m
|
||||
snowflake-arctic-embed:22m
|
||||
snowflake-arctic-embed:33m
|
||||
snowflake-arctic-embed:110m
|
||||
snowflake-arctic-embed:137m
|
||||
snowflake-arctic-embed:335m
|
||||
bge-m3:567m
|
||||
bge-large:335m
|
||||
paraphrase-multilingual:278m
|
||||
@@ -1,10 +1,9 @@
|
||||
<Project>
|
||||
<!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
|
||||
<PropertyGroup>
|
||||
<KMVersion>0.70.240803.1</KMVersion>
|
||||
<LLamaSharpVersion>0.15.0</LLamaSharpVersion>
|
||||
<KMVersion>0.71.240820.1</KMVersion>
|
||||
<NewtonsoftVersion>13.0.3</NewtonsoftVersion>
|
||||
<RestSharpVersion>111.4.1</RestSharpVersion>
|
||||
<SKVersion>1.16.2</SKVersion>
|
||||
<RestSharpVersion>112.1.0</RestSharpVersion>
|
||||
<SKVersion>1.17.2</SKVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user