Compare commits

...

57 Commits
0.5.6 ... 0.6.4

Author SHA1 Message Date
zyxucp
34874aa7b8 update readme 2025-06-10 17:07:05 +08:00
zyxucp
723e3388a7 update readme 2025-06-10 16:59:49 +08:00
zyxucp
be56859a6d update 官网 2025-06-10 16:58:28 +08:00
zyxucp
901e81c61b update 取消默认打开 2025-06-10 14:37:26 +08:00
zyxucp
8a19f61689 update 升级至dotnet9 2025-06-10 14:29:33 +08:00
zyxucp
e6456a2c86 Update README.zh.md 2025-05-23 10:34:19 +08:00
zyxucp
0ecf060b2b Update README.md 2025-05-23 10:34:00 +08:00
zyxucp
a0bc481ac5 Update appsettings.json 2025-05-23 10:33:32 +08:00
zyxucp
9e873f1e2d Update README.md 2025-05-21 16:35:06 +08:00
zyxucp
b3eccaba60 Update docker-compose.simple.yml 2025-05-21 16:34:51 +08:00
zyxucp
3a19015b1f Update docker-compose.yml 2025-05-21 16:34:29 +08:00
zyxucp
ea3a94f594 Update LICENSE 2025-05-21 16:30:10 +08:00
zyxucp
8b5b261661 Merge branch 'main' of https://github.com/AIDotNet/AntSK 2025-05-01 20:48:00 +08:00
zyxucp
bc3f4dcb92 update menu and chat 2025-05-01 20:47:09 +08:00
zyxucp
01deb3084a Update README.zh.md 2025-04-26 21:14:10 +08:00
zyxucp
fb8cc18f99 Update LICENSE 2025-03-30 17:13:19 +08:00
zyxucp
a219bb7eaa Update README.zh.md 2025-03-29 12:57:26 +08:00
zyxucp
4ac7c79192 Update README.zh.md 2025-03-29 12:54:55 +08:00
zyxucp
a24c5548e1 updte 延迟3秒启动 2025-03-29 12:51:43 +08:00
zyxucp
8c4030ae43 update chat 默认app 2025-03-29 12:45:39 +08:00
zyxucp
c912ceeee0 del 删除做图应用 2025-03-29 12:37:20 +08:00
zyxucp
58c5edbc5e del 删除做图应用 2025-03-29 12:36:08 +08:00
zyxucp
3d86fd1125 update nuge and menu 2025-03-29 12:33:10 +08:00
zyxucp
f8c6a05380 update style 2025-03-12 23:22:30 +08:00
zyxucp
10b4706094 update 1 2025-03-12 23:12:21 +08:00
zyxucp
3f7e2d29e1 update 官网 2025-03-12 23:11:43 +08:00
zyxucp
d93e962ae9 Update docker-compose.simple.yml 2025-02-27 14:55:05 +08:00
zyxucp
1da5d5bce1 Update docker-compose.yml 2025-02-27 14:54:25 +08:00
zyxucp
b853ab4851 update index 2025-02-24 18:06:54 +08:00
zyxucp
00b37d9600 update pip 2025-02-23 09:22:55 +08:00
zyxucp
c467a3c427 update pip 2025-02-23 09:17:07 +08:00
zyxucp
06cdbb14d0 update 提示 2025-02-20 15:01:37 +08:00
zyxucp
115e12257b update ollama 2025-02-20 14:33:23 +08:00
zyxucp
533a47566b add 2025-02-20 14:28:03 +08:00
zyxucp
51ec2db3c3 del 2025-02-20 14:27:22 +08:00
zyxucp
3aa76e0662 Merge branch 'main' of https://github.com/AIDotNet/AntSK 2025-02-20 14:13:43 +08:00
zyxucp
755d2c2d4f update 2025-02-20 14:11:43 +08:00
zyxucp
bd27048237 Update docker-compose.yml 2025-02-20 13:19:48 +08:00
zyxucp
01063f2d49 Update docker-compose.yml 2025-02-18 15:42:53 +08:00
zyxucp
5a4f038da1 Update docker-compose.simple.yml 2025-02-18 15:42:38 +08:00
zyxucp
dd6e1a6d54 Update README.md 2025-02-18 15:42:19 +08:00
zyxucp
52e20396ad Update README.zh.md 2025-02-18 15:41:28 +08:00
zyxucp
a8f48929e7 Update README.zh.md 2025-02-18 15:40:45 +08:00
zyxucp
ae89fb5ec7 Update README.md 2025-02-18 15:40:09 +08:00
zyxucp
48a8670f01 update llamafactory 2025-02-18 15:23:46 +08:00
zyxucp
2c8efd2eef Merge branch 'main' of https://github.com/AIDotNet/AntSK 2025-02-17 16:34:02 +08:00
zyxucp
a4acb80151 add embedding model 2025-02-17 16:28:31 +08:00
zyxucp
a8f143995d Update LICENSE 2025-02-17 10:44:48 +08:00
zyxucp
e46b02d70b Update LICENSE 2025-02-17 10:41:06 +08:00
zyxucp
31ea75ecba Merge branch 'main' of https://github.com/AIDotNet/AntSK 2025-02-13 17:23:28 +08:00
zyxucp
e2142deb4a update 2025-02-13 17:22:30 +08:00
zyxucp
a6b11bb33d Update README.zh.md 2025-02-11 22:57:43 +08:00
zyxucp
773073b847 update 注释 2025-02-11 18:44:16 +08:00
zyxucp
2bd38b96e7 update 上传文件问答bug 2025-02-11 18:43:30 +08:00
zyxucp
f7bcbcfc95 update 单文件发布 2025-02-11 16:55:04 +08:00
zyxucp
6f5429695c update 2025-02-11 16:07:41 +08:00
zyxucp
547a3b5919 update 调整检索最低相似度 2025-02-06 15:13:28 +08:00
44 changed files with 860 additions and 956 deletions

View File

@@ -1,5 +1,5 @@
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Copy csproj and restore as distinct layers
@@ -13,7 +13,7 @@ RUN dotnet build "AntSK.csproj" -c Release -o /app/build
RUN dotnet publish "AntSK.csproj" -c Release -o /app/publish
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /service
EXPOSE 5000

View File

@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY ["src/AntSK/AntSK.csproj", "AntSK/"]
RUN dotnet restore "AntSK/AntSK.csproj"
@@ -7,7 +7,7 @@ WORKDIR "/src/AntSK"
RUN dotnet build "AntSK.csproj" -c Release -o /app/build
RUN dotnet publish "AntSK.csproj" -c Release -o /app/publish
FROM registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk-base:v1.0.0 AS final
FROM registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk-base:9.0.0 AS final
WORKDIR /app
COPY --from=build /app/publish .

224
LICENSE
View File

@@ -1,209 +1,79 @@
AntSK License
Version 2.0, January 2004
http://www.apache.org/licenses/
## AntSK 用户协议
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
欢迎使用 AntSK 。请仔细阅读以下协议条款,继续使用本软件即表示您同意本协议内容。
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.
本软件采用 Apache License 2.0 许可。除 Apache License 2.0 规定的条款外,您在使用 AntSK 时还应遵守以下附加条款:
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
**一. 商用许可**
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
1. **免费商用**用户在不修改logo和名称的情况下可以免费用于商业目的。
2. **商业授权**:如果您满足以下任意条件之一,需取得商业授权:
1. 修改应用名称、logo、版权信息等。
2. 为企业客户提供多租户服务,且该服务支持 10 人或以上的使用。
3. 预装或集成到硬件设备或产品中进行捆绑销售。
4. 政府或教育机构的大规模采购项目,特别是涉及安全、数据隐私等敏感需求时。
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
**二. 贡献者协议**
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
作为 AntSK 的贡献者,您应当同意以下条款:
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
1. **许可调整**:生产者有权根据需要对开源协议进行调整,使其更加严格或宽松。
2. **商业用途**:您贡献的代码可能会被用于商业用途,包括但不限于云业务运营。
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
**三. 其他条款**
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
1. 本协议条款的解释权归 AntSK 开发者所有。
2. 本协议可能根据实际情况进行更新,更新时将通过本软件通知用户。
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
如有任何问题或需申请商业授权,请联系 AntSK 开发团队。
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
除上述特定条件外,其他所有权利和限制均遵循 Apache License 2.0。有关 Apache License 2.0 的详细信息,请访问 http://www.apache.org/licenses/LICENSE-2.0。
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
---
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
根据 Apache 许可证 2.0 版(“许可证”)进行许可;除非符合许可证,否则您不得使用此文件。您可以在以下网址获取许可证副本:
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
http://www.apache.org/licenses/LICENSE-2.0
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
除非适用法律要求或书面同意,软件根据许可证分发的内容以“原样”分发,不附带任何明示或暗示的保证或条件。请参阅特定语言管理权限的许可证和许可证下的限制。
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
## AntSK User Agreement
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
Welcome to AntSK, a AI knowledge base. Please read the following agreement carefully. By continuing to use this software, you agree to the terms outlined below.
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
**License Agreement**
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
This software is licensed under the **Apache License 2.0**. In addition to the terms of the Apache License 2.0, the following additional terms apply to the use of AntSK:
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
**I. Commercial Use License**
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
1. **Free Commercial Use**: Users can use it for commercial purposes for free without modifying the logo and name.
2. **Commercial License Required**: A commercial license is required if any of the following conditions are met:
1. Modify the application name logo、 Copyright information, etc.
2. You provide multi-tenant services to enterprise customers with 10 or more users.
3. You pre-install or integrate the software into hardware devices or products and bundle it for sale.
4. You are engaging in large-scale procurement for government or educational institutions, especially involving security, data privacy, or other sensitive requirements.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
**II. Contributor Agreement**
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
As a contributor to AntSK, you agree to the following:
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
1. **License Adjustment**: The producer reserves the right to adjust the open-source license as needed, making it stricter or more lenient.
2. **Commercial Use**: Any code you contribute may be used for commercial purposes, including but not limited to cloud business operations.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
**III. Other Terms**
END OF TERMS AND CONDITIONS
1. The interpretation of these terms is subject to the discretion of AntSK developers.
2. These terms may be updated, and users will be notified through the software when changes occur.
APPENDIX: How to apply the Apache License to your work.
For any questions or to request a commercial license, please contact the AntSK development team.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
Copyright [2024] [许泽宇]
---
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

236
README.en.md Normal file
View File

@@ -0,0 +1,236 @@
[简体中文](./README.md) | English
# AntSK
## AI Knowledge Base/Intelligent Agent built on .Net9 + AntBlazor+SemanticKernel
## ⭐Core Features
- **Semantic Kernel**: Utilizes advanced natural language processing technology to accurately understand, process, and respond to complex semantic queries, providing users with precise information retrieval and recommendation services.
- **Kernel Memory**: Capable of continuous learning and storing knowledge points, AntSK has long-term memory function, accumulates experience, and provides a more personalized interaction experience.
- **Knowledge Base**: Import knowledge base through documents (Word, PDF, Excel, Txt, Markdown, Json, PPT) and perform knowledge base Q&A.
- **GPT Generation**: This platform supports creating personalized GPT models, enabling users to build their own GPT models.
- **API Interface Publishing**: Exposes internal functions in the form of APIs, enabling developers to integrate AntSK into other applications and enhance application intelligence.
- **API Plugin System**: Open API plugin system that allows third-party developers or service providers to easily integrate their services into AntSK, continuously enhancing application functionality.
- **.Net Plugin System**: Open dll plugin system that allows third-party developers or service providers to easily integrate their business functions by generating dll in standard format code, continuously enhancing application functionality.
- **Online Search**: AntSK, real-time access to the latest information, ensuring users receive the most timely and relevant data.
- **Model Management**: Adapts and manages integration of different models from different manufacturers, models offline running supported by **llamafactory** and **ollama**.
- **Domestic Innovation**: AntSK supports domestic models and databases and can run under domestic innovation conditions.
- **Model Fine-Tuning**: Planned based on llamafactory for model fine-tuning.
## ⛪Application Scenarios
AntSK is suitable for various business scenarios, such as:
- Enterprise knowledge management system
- Automatic customer service and chatbots
- Enterprise search engine
- Personalized recommendation system
- Intelligent writing assistance
- Education and online learning platforms
- Other interesting AI Apps
## ✏Function Examples
### Online Demo
[document](http://antsk.cn/)
[demo](https://demo.antsk.cn/)
and
[demo1](https://antsk.ai-dotnet.com/)
```
Default account: test
Default password: test
Due to the low configuration of the cloud server, the local model cannot be run, so the system settings permissions have been closed. You can simply view the interface. If you want to use the local model, please download and use it on your own.
```
### Other Function Examples
[Video Demonstration](https://www.bilibili.com/video/BV1zH4y1h7Y9/)
## ❓How to get started?
Here I am using Postgres as the data and vector storage because Semantic Kernel and Kernel Memory support it, but you can also use other options.
The model by default supports the local model of openai, azure openai, and llama. If you need to use other models, you can integrate them using one-api.
The Login configuration in the configuration file is the default login account and password.
The following configuration file needs to be configured
## 1⃣Using docker-compose
Provided the pg version **appsettings.json** and simplified version (Sqlite+disk) **docker-compose.simple.yml**
Download **docker-compose.yml** from the project root directory and place the configuration file **appsettings.json** in the same directory.
The pg image has already been prepared. You can modify the default username and password in docker-compose.yml, and then the database connection in your **appsettings.json** needs to be consistent.
Then you can execute the following command in the directory to start AntSK
```
docker-compose up -d
```
## 2⃣How to mount local models and model download directory in docker
```
# Non-host version, do not use local proxy
version: '3.8'
services:
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.6.3
ports:
- 5000:5000
networks:
- antsk
depends_on:
- antskpg
restart: always
environment:
- ASPNETCORE_URLS=http://*:5000
volumes:
- ./appsettings.json:/app/appsettings.json # Local configuration file needs to be placed in the same directory
- D://model:/app/model
networks:
antsk:
external: true
```
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
[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
```
{
"DBConnection": {
"DbType": "Sqlite",
"ConnectionStrings": "Data Source=AntSK.db;"
},
"KernelMemory": {
"VectorDb": "Disk",
"ConnectionString": "Host=;Port=;Database=antsk;Username=;Password=",
"TableNamePrefix": "km-"
},
"FileDir": {
"DirectoryPath": "D:\\git\\AntBlazor\\model"
},
"Login": {
"User": "admin",
"Password": "admin"
},
"BackgroundTaskBroker": {
"ImportKMSTask": {
"WorkerCount": 1
}
}
}
```
```
// Supports various databases, you can check SqlSugar, MySql, SqlServer, Sqlite, Oracle, PostgreSQL, Dm, Kdbndp, Oscar, MySqlConnector, Access, OpenGauss, QuestDB, HG, ClickHouse, GBase, Odbc, OceanBaseForOracle, TDengine, GaussDB, OceanBase, Tidb, Vastbase, PolarDB, Custom
DBConnection.DbType
// Connection string, need to use the corresponding string according to the different DB types
DBConnection.ConnectionStrings
//The type of vector storage, supporting Postgres, Disk, Memory, Qdrant, Redis, AzureAISearch
//Postgres and Redis require ConnectionString configuration
//The ConnectionString of Qdrant and AzureAISearch uses Endpoint | APIKey
KernelMemory.VectorDb
//Local model path, used for quick selection of models under llama, as well as saving downloaded models.
FileDir.DirectoryPath
//Default admin account password
Login
//Import asynchronous processing thread count. A higher count can be used for online API, but for local models, 1 is recommended to avoid memory overflow issues.
BackgroundTaskBroker.ImportKMSTask.WorkerCount
```
## ⚠Fixing Style Issues:
Run the following in AntSK/src/AntSK:
```
dotnet clean
dotnet build
dotnet publish "AntSK.csproj"
```
Then navigate to AntSK/src/AntSK/bin/Release/net8.0/publish and run:
```
dotnet AntSK.dll
```
The styles should now be applied after starting.
I'm using CodeFirst mode for the database, so as long as the database connection is properly configured, the table structure will be created automatically.
## ✔Using llamafactory
```
1. First, ensure that Python and pip are installed in your environment. This step is not necessary if using an image, such as version v0.2.3.2, which already includes the complete Python environment.
2. Go to the model add page and select llamafactory.
3. Click "Initialize" to check whether the 'pip install' environment setup is complete.
4. Choose a model that you like.
5. Click "Start" to begin downloading the model from the tower. This may involve a somewhat lengthy wait.
6. After the model has finished downloading, enter http://localhost:8000/ in the request address. The default port is 8000.
7. Click "Save" and start chatting.
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.
```
## 💕 Contributors
This project exists thanks to all the people who contribute.
<a href="https://github.com/AIDotNet/AntSK/graphs/contributors">
<img src="https://contrib.rocks/image?repo=AIDotNet/AntSK&max=1000&columns=15&anon=1" />
</a>
## 🚨 Use Protocol
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. **Free Commercial Use**: Users can use the software for commercial purposes without modifying the code.
2. **Commercial License Required**: A commercial license is required if any of the following conditions are met:
1. You modify, develop, or alter the software, including but not limited to changes to the application name, logo, code, or functionality.
2. You provide multi-tenant services to enterprise customers with 10 or more users.
3. You pre-install or integrate the software into hardware devices or products and bundle it for sale.
4. You are engaging in large-scale procurement for government or educational institutions, especially involving security, data privacy, or other sensitive requirements.
3. 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 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
![Official WeChat Account](https://github.com/AIDotNet/AntSK/blob/main/images/gzh.jpg)
---
We appreciate your interest in **AntSK** and look forward to collaborating with you to create an intelligent future!

236
README.md
View File

@@ -1,92 +1,115 @@
[简体中文](./README.zh.md) | English
中文|[English](./README.en.md)
# AntSK
## AI Knowledge Base/Intelligent Agent built on .Net8+AntBlazor+SemanticKernel
## 使用.Net9 + Blazor+SemanticKernel 打造的AI知识库/智能体
## ⭐Core Features
## ⭐核心功能
- **Semantic Kernel**: Utilizes advanced natural language processing technology to accurately understand, process, and respond to complex semantic queries, providing users with precise information retrieval and recommendation services.
- **语义内核 (Semantic Kernel)**:采用领先的自然语言处理技术,准确理解、处理和响应复杂的语义查询,为用户提供精确的信息检索和推荐服务。
- **Kernel Memory**: Capable of continuous learning and storing knowledge points, AntSK has long-term memory function, accumulates experience, and provides a more personalized interaction experience.
- **内存内核 (Kernel Memory)**具备持续学习和存储知识点的能力AntSK 拥有长期记忆功能,累积经验,提供更个性化的交互体验。
- **Knowledge Base**: Import knowledge base through documents (Word, PDF, Excel, Txt, Markdown, Json, PPT) and perform knowledge base Q&A.
- **知识库**:通过文档(WordPDFExcelTxtMarkdownJsonPPT等形式导入知识库可以进行知识库问答支持本地bge-embedding 向量模型 以及bge-rerank 重排模型。
- **GPT Generation**: This platform supports creating personalized GPT models, enabling users to build their own GPT models.
- **文生图**:集成**StableDiffusion** 本地模型,可以进行文生图。
- **API Interface Publishing**: Exposes internal functions in the form of APIs, enabling developers to integrate AntSK into other applications and enhance application intelligence.
- **GPTs 生成**此平台支持创建个性化的GPT模型尝试构建您自己的GPT模型。
- **API Plugin System**: Open API plugin system that allows third-party developers or service providers to easily integrate their services into AntSK, continuously enhancing application functionality.
- **API接口发布**将内部功能以API的形式对外提供便于开发者将AntSK 集成进其他应用,增强应用智慧。
- **.Net Plugin System**: Open dll plugin system that allows third-party developers or service providers to easily integrate their business functions by generating dll in standard format code, continuously enhancing application functionality.
- **API插件系统**开放式API插件系统允许第三方开发者或服务商轻松将其服务集成到AntSK不断增强应用功能。
- **Online Search**: AntSK, real-time access to the latest information, ensuring users receive the most timely and relevant data.
- **.Net插件系统**开放式dll插件系统允许第三方开发者或服务商轻松将其业务功能通过标准格式的代码生成dll后集成到AntSK不断增强应用功能。
- **Model Management**: Adapts and manages integration of different models from different manufacturers, models offline running supported by **llamafactory** and **ollama**.
- **联网搜索**AntSK实时获取最新信息确保用户接受到的资料总是最及时、最相关的。
- **Domestic Innovation**: AntSK supports domestic models and databases and can run under domestic innovation conditions.
- **模型管理**:适配和管理集成不同厂商的不同模型。并且支持**llama.cpp**所支持的gguf类型以及**llamafactory** 和 **ollama** 所支持的模型离线运行
- **Model Fine-Tuning**: Planned based on llamafactory for model fine-tuning.
- **国产信创**AntSK支持国产模型和国产数据库可以在信创条件下运行
## ⛪Application Scenarios
- **模型微调**规划中基于llamafactory进行模型微调
AntSK is suitable for various business scenarios, such as:
- Enterprise knowledge management system
- Automatic customer service and chatbots
- Enterprise search engine
- Personalized recommendation system
- Intelligent writing assistance
- Education and online learning platforms
- Other interesting AI Apps
## ⛪应用场景
## ✏Function Examples
### Online Demo
[document](http://antsk.cn/)
AntSK 适用于多种业务场景,例如:
- 企业级知识管理系统
- 自动客服与聊天机器人
- 企业级搜索引擎
- 个性化推荐系统
- 智能辅助写作
- 教育与在线学习平台
- 其他有意思的AI App
[demo](https://demo.antsk.cn/)
and
[demo1](https://antsk.ai-dotnet.com/)
## ✏️功能示例
### 在线演示
[体验地址1](https://demo.antsk.cn/)
[体验地址2](https://antsk.ai-dotnet.com/)
```
Default account: test
默认账号:test
Default password: test
默认密码:test
Due to the low configuration of the cloud server, the local model cannot be run, so the system settings permissions have been closed. You can simply view the interface. If you want to use the local model, please download and use it on your own.
由于云服务器配置较低,无法运行本地模型,所以把系统设置权限关闭了,大家看看界面即可,要使用本地模型,请下载自行使用
请勿在演示站点上传敏感信息
```
### Other Function Examples
[Video Demonstration](https://www.bilibili.com/video/BV1zH4y1h7Y9/)
### 其他功能示例
[视频示例](https://www.bilibili.com/video/BV1zH4y1h7Y9/)
## ❓How to get started?
[在线文档http://antsk.cn](http://antsk.cn)
Here I am using Postgres as the data and vector storage because Semantic Kernel and Kernel Memory support it, but you can also use other options.
## ❓如何开始?
The model by default supports the local model of openai, azure openai, and llama. If you need to use other models, you can integrate them using one-api.
在这里我使用的是Postgres 作为数据存储和向量存储因为Semantic Kernel和Kernel Memory都支持他当然你也可以换成其他的。
The Login configuration in the configuration file is the default login account and password.
模型默认支持openai、azure openai、讯飞星火、阿里云积、 和llama支持的gguf本地模型 以及llamafactory的本地模型,如果需要使用其他模型可以使用one-api进行集成。
The following configuration file needs to be configured
配置文件中的Login配置是默认的登录账号和密码
## 1⃣Using docker-compose
需要配置如下的配置文件
Provided the pg version **appsettings.json** and simplified version (Sqlite+disk) **docker-compose.simple.yml**
## 为了方便体验,我已经把打包好的程序放进了网盘,你只需要安装.net8环境即可运行。
[.net8环境 ](https://dotnet.microsoft.com/zh-cn/download/dotnet/8.0)
Download **docker-compose.yml** from the project root directory and place the configuration file **appsettings.json** in the same directory.
[我用夸克网盘分享了「AntSK」](https://pan.quark.cn/s/63ea02e1683e)
The pg image has already been prepared. You can modify the default username and password in docker-compose.yml, and then the database connection in your **appsettings.json** needs to be consistent.
下载文件后启动 AntSK.exe 然后会自动打开浏览器
```
账号: admin
密码: admin
```
Then you can execute the following command in the directory to start AntSK
[源码深度解读](https://deepwiki.com/AIDotNet/AntSK)
## 1⃣使用docker-compose
提供了pg版本 **appsettings.json** 和 简化版本(**Sqlite+disk** **docker-compose.simple.yml**
从项目根目录下载**docker-compose.yml**,然后把配置文件**appsettings.json**和它放在统一目录,
这里已经把pg的镜像做好了。在docker-compose.yml中可以修改默认账号密码然后你的**appsettings.json**的数据库连接需要保持一致。
然后你可以进入到目录后执行
```
docker-compose up -d
```
来启动AntSK
## 2How to mount local models and model download directory in docker
## 2如何在docker中挂载本地模型和模型下载的目录
```
# Non-host version, do not use local proxy
# host 版本, 不使用本机代理
version: '3.8'
services:
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.5.0
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.6.0
ports:
- 5000:5000
networks:
@@ -97,32 +120,32 @@ services:
environment:
- ASPNETCORE_URLS=http://*:5000
volumes:
- ./appsettings.json:/app/appsettings.json # Local configuration file needs to be placed in the same directory
- ./appsettings.json:/app/appsettings.json # 本地配置文件 需要放在同级目录
- D://model:/app/model
- D://model:/root/.cache/modelscope/hub/AI-ModelScope #使用Llamafactory时需要挂载 否则初始化的环境重启后会丢失
networks:
antsk:
external: true
```
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
以这个为示例意思是把windows本地D://model的文件夹挂载进 容器内/app/model 如果是这样你的appsettings.json中的模型地址应该配置为
[LiteDockerCompose](https://github.com/AIDotNet/AntSK/blob/main/docker-compose.simple.yml)
The compact version is deployed with sqlite-disk by one click
精简版使用sqlite+disk向量模式,简化部署配置
[FullDockerCompose](https://github.com/AIDotNet/AntSK/blob/main/docker-compose.yml)
The full version uses pg+aspire
完整版使用pg+aspire 功能更完整,配置文件需要参考如下配置含义进行配置
## 3Some meanings of configuration file
## 3配置文件的一些含义
```
{
"DBConnection": {
"DbType": "Sqlite",
"DbType": "Sqlite",
"ConnectionStrings": "Data Source=AntSK.db;"
},
"KernelMemory": {
"VectorDb": "Disk",
"VectorDb": "Disk",
"ConnectionString": "Host=;Port=;Database=antsk;Username=;Password=",
"TableNamePrefix": "km-"
},
@@ -141,95 +164,90 @@ The full version uses pg+aspire
}
```
```
// Supports various databases, you can check SqlSugar, MySql, SqlServer, Sqlite, Oracle, PostgreSQL, Dm, Kdbndp, Oscar, MySqlConnector, Access, OpenGauss, QuestDB, HG, ClickHouse, GBase, Odbc, OceanBaseForOracle, TDengine, GaussDB, OceanBase, Tidb, Vastbase, PolarDB, Custom
//支持多种数据库,具体可以查看SqlSugarMySqlSqlServerSqliteOraclePostgreSQLDmKdbndpOscarMySqlConnectorAccessOpenGaussQuestDBHGClickHouseGBaseOdbcOceanBaseForOracleTDengineGaussDBOceanBaseTidbVastbasePolarDBCustom
DBConnection.DbType
// Connection string, need to use the corresponding string according to the different DB types
//连接字符串需要根据不同DB类型用对应的字符串
DBConnection.ConnectionStrings
//The type of vector storage, supporting Postgres, Disk, Memory, Qdrant, Redis, AzureAISearch
//Postgres and Redis require ConnectionString configuration
//The ConnectionString of Qdrant and AzureAISearch uses Endpoint | APIKey
//向量存储的类型,支持 PostgresDiskMemoryQdrantRedisAzureAISearch
//Postgres、Redis需要配置 ConnectionString
//Qdrant AzureAISearch 的 ConnectionString 使用 Endpoint|APIKey
KernelMemory.VectorDb
//Local model path, used for quick selection of models under llama, as well as saving downloaded models.
//本地模型路径用于在选择llama时可以快速选择目录下的模型以及保存下载的模型
FileDir.DirectoryPath
//Default admin account password
//默认管理员账号密码
Login
//Import asynchronous processing thread count. A higher count can be used for online API, but for local models, 1 is recommended to avoid memory overflow issues.
//导入异步处理的线程数使用在线API可以高一点本地模型建议1 否则容易内存溢出崩掉
BackgroundTaskBroker.ImportKMSTask.WorkerCount
```
## ⚠️Fixing Style Issues:
Run the following in AntSK/src/AntSK:
## ⚠️找不到样式问题解决:
AntSK/src/AntSK下执行:
```
dotnet clean
dotnet build
dotnet publish "AntSK.csproj"
```
Then navigate to AntSK/src/AntSK/bin/Release/net8.0/publish and run:
再去AntSK/src/AntSK/bin/Release/net8.0/publish
```
dotnet AntSK.dll
```
The styles should now be applied after starting.
然后启动就有样式了
I'm using CodeFirst mode for the database, so as long as the database connection is properly configured, the table structure will be created automatically.
DB我使用的是CodeFirst模式只要配置好数据库链接表结构是自动创建的
## ✔️Using llamafactory
## ✔️使用llamafactory
```
1. First, ensure that Python and pip are installed in your environment. This step is not necessary if using an image, such as version v0.2.3.2, which already includes the complete Python environment.
2. Go to the model add page and select llamafactory.
3. Click "Initialize" to check whether the 'pip install' environment setup is complete.
4. Choose a model that you like.
5. Click "Start" to begin downloading the model from the tower. This may involve a somewhat lengthy wait.
6. After the model has finished downloading, enter http://localhost:8000/ in the request address. The default port is 8000.
7. Click "Save" and start chatting.
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.
1、首先需要确保你的环境已经安装了python和pip如果使用镜像例如p0.2.4版本已经包含了 python全套环境则无需此步骤
2、进入模型添加页面选择llamafactory
3、点击初始化可以检查pip install 环境是否完成
4、选择一个喜欢的模型
5、点击启动,这会开始从魔塔下载模型,你可能需要有一个较为漫长的等待
6、等待模型下载完毕后,在请求地址输入 http://localhost:8000/ 这里默认是使用8000端口
7、点击保存,然后就可以开始聊天了
8、很多人会问 LLamaSharpllamafactory有什么区别其实这两者LLamaSharp是llama.cpp的 dotnet实现但是只支持本地gguf模型 而llamafactory 支持的模型种类更多但使用的是python的实现其主要差异在这里另外llamafactory具有模型微调的能力这也是我们下一步需要重点集成的部分。
```

## 💕 贡献者
## 💕 Contributors
This project exists thanks to all the people who contribute.
这个项目的存在要感谢所有的贡献者。

<a href="https://github.com/AIDotNet/AntSK/graphs/contributors">
<img src="https://contrib.rocks/image?repo=AIDotNet/AntSK&max=1000&columns=15&anon=1" />
<img src="https://contrib.rocks/image?repo=AIDotNet/AntSK&max=1000&columns=15&anon=1" />
</a>

## 🚨 使用协议
## 🚨 Use Protocol
本仓库遵循 [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 开源协议。
This warehouse follows the [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) open source protocol.
除以下附加条款外,该项目遵循Apache 2.0协议
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
1. **免费商用**:用户在不修改代码的情况下,可以免费用于商业目的。
2. **商业授权**:如果您满足以下任意条件之一,需取得商业授权:
1. 对本软件进行二次修改、开发包括但不限于修改应用名称、logo、代码以及功能
2. 为企业客户提供多租户服务,且该服务支持 10 人或以上的使用。
3. 预装或集成到硬件设备或产品中进行捆绑销售。
4. 政府或教育机构的大规模采购项目,特别是涉及安全、数据隐私等敏感需求时。
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**
3. 如果您需要授权可以联系微信xuzeyu91
If you plan to use AntSK in commercial projects, you need to ensure that you follow the following steps:
如果您打算在商业项目中使用AntSK您需要确保遵守以下步骤
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
1. 包含AntSK许可证的版权声明。 [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file)
## 💕 Special thanks
Helping enterprise AI application development, we recommend [AntBlazor](https://antblazor.com)
2. 如果您修改了软件源代码,您需要在源代码中明确标明这些修改。
## ☎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.
3. 满足以上要求
Additionally, you can also contact me via email: antskpro@qq.com
## 💕 特别感谢
助力企业级AI应用开发推荐使用 [AntBlazor](https://antblazor.com)
![Official WeChat Account](https://github.com/AIDotNet/AntSK/blob/main/images/gzh.jpg)
---
## ☎️联系我
如有任何问题或建议请通过以下方式关注我的公众号《许泽宇的技术分享》发消息与我联系我们也有AIDotnet交流群可以发送进群等消息然后我会拉你进交流群
We appreciate your interest in **AntSK** and look forward to collaborating with you to create an intelligent future!
另外您也可以通过邮箱与我联系antskpro@qq.com
![公众号](https://github.com/AIDotNet/AntSK/blob/main/images/gzh.jpg)

View File

@@ -1,247 +0,0 @@
中文|[English](./README.md)
# AntSK
## 使用.Net8+Blazor+SemanticKernel 打造的AI知识库/智能体
## ⭐核心功能
- **语义内核 (Semantic Kernel)**:采用领先的自然语言处理技术,准确理解、处理和响应复杂的语义查询,为用户提供精确的信息检索和推荐服务。
- **内存内核 (Kernel Memory)**具备持续学习和存储知识点的能力AntSK 拥有长期记忆功能,累积经验,提供更个性化的交互体验。
- **知识库**通过文档Word、PDF、Excel、Txt、Markdown、Json、PPT等形式导入知识库可以进行知识库问答支持本地bge-embedding 向量模型 以及bge-rerank 重排模型。
- **文生图**:集成**StableDiffusion** 本地模型,可以进行文生图。
- **GPTs 生成**此平台支持创建个性化的GPT模型尝试构建您自己的GPT模型。
- **API接口发布**将内部功能以API的形式对外提供便于开发者将AntSK 集成进其他应用,增强应用智慧。
- **API插件系统**开放式API插件系统允许第三方开发者或服务商轻松将其服务集成到AntSK不断增强应用功能。
- **.Net插件系统**开放式dll插件系统允许第三方开发者或服务商轻松将其业务功能通过标准格式的代码生成dll后集成到AntSK不断增强应用功能。
- **联网搜索**AntSK实时获取最新信息确保用户接受到的资料总是最及时、最相关的。
- **模型管理**:适配和管理集成不同厂商的不同模型。并且支持**llama.cpp**所支持的gguf类型以及**llamafactory** 和 **ollama** 所支持的模型离线运行
- **国产信创**AntSK支持国产模型和国产数据库可以在信创条件下运行
- **模型微调**规划中基于llamafactory进行模型微调
## ⛪应用场景
AntSK 适用于多种业务场景,例如:
- 企业级知识管理系统
- 自动客服与聊天机器人
- 企业级搜索引擎
- 个性化推荐系统
- 智能辅助写作
- 教育与在线学习平台
- 其他有意思的AI App
## ✏️功能示例
### 在线演示
[体验地址1](https://demo.antsk.cn/)
[体验地址2](https://antsk.ai-dotnet.com/)
```
默认账号test
默认密码test
由于云服务器配置较低,无法运行本地模型,所以把系统设置权限关闭了,大家看看界面即可,要使用本地模型,请下载自行使用
请勿在演示站点上传敏感信息
```
### 其他功能示例
[视频示例](https://www.bilibili.com/video/BV1zH4y1h7Y9/)
[在线文档http://antsk.cn](http://antsk.cn)
## ❓如何开始?
在这里我使用的是Postgres 作为数据存储和向量存储因为Semantic Kernel和Kernel Memory都支持他当然你也可以换成其他的。
模型默认支持openai、azure openai、讯飞星火、阿里云积、 和llama支持的gguf本地模型 以及llamafactory的本地模型,如果需要使用其他模型可以使用one-api进行集成。
配置文件中的Login配置是默认的登录账号和密码
需要配置如下的配置文件
## 1⃣使用docker-compose
提供了pg版本 **appsettings.json** 和 简化版本(**Sqlite+disk** **docker-compose.simple.yml**
从项目根目录下载**docker-compose.yml**,然后把配置文件**appsettings.json**和它放在统一目录,
这里已经把pg的镜像做好了。在docker-compose.yml中可以修改默认账号密码然后你的**appsettings.json**的数据库连接需要保持一致。
然后你可以进入到目录后执行
```
docker-compose up -d
```
来启动AntSK
## 2⃣如何在docker中挂载本地模型和模型下载的目录
```
# 非 host 版本, 不使用本机代理
version: '3.8'
services:
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.3.1
ports:
- 5000:5000
networks:
- antsk
depends_on:
- antskpg
restart: always
environment:
- ASPNETCORE_URLS=http://*:5000
volumes:
- ./appsettings.json:/app/appsettings.json # 本地配置文件 需要放在同级目录
- D://model:/app/model
- D://model:/root/.cache/modelscope/hub/AI-ModelScope #使用Llamafactory时需要挂载 否则初始化的环境重启后会丢失
networks:
antsk:
```
以这个为示例意思是把windows本地D://model的文件夹挂载进 容器内/app/model 如果是这样你的appsettings.json中的模型地址应该配置为
[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⃣配置文件的一些含义
```
{
"DBConnection": {
"DbType": "Sqlite",
"ConnectionStrings": "Data Source=AntSK.db;"
},
"KernelMemory": {
"VectorDb": "Disk",
"ConnectionString": "Host=;Port=;Database=antsk;Username=;Password=",
"TableNamePrefix": "km-"
},
"FileDir": {
"DirectoryPath": "D:\\git\\AntBlazor\\model"
},
"Login": {
"User": "admin",
"Password": "xuzeyu"
},
"BackgroundTaskBroker": {
"ImportKMSTask": {
"WorkerCount": 1
}
}
}
```
```
//支持多种数据库具体可以查看SqlSugarMySqlSqlServerSqliteOraclePostgreSQLDmKdbndpOscarMySqlConnectorAccessOpenGaussQuestDBHGClickHouseGBaseOdbcOceanBaseForOracleTDengineGaussDBOceanBaseTidbVastbasePolarDBCustom
DBConnection.DbType
//连接字符串需要根据不同DB类型用对应的字符串
DBConnection.ConnectionStrings
//向量存储的类型,支持 Postgres、Disk、Memory、Qdrant、Redis、AzureAISearch
//Postgres、Redis需要配置 ConnectionString
//Qdrant 和AzureAISearch 的 ConnectionString 使用 Endpoint|APIKey
KernelMemory.VectorDb
//本地模型路径用于在选择llama时可以快速选择目录下的模型以及保存下载的模型
FileDir.DirectoryPath
//默认管理员账号密码
Login
//导入异步处理的线程数使用在线API可以高一点本地模型建议1 否则容易内存溢出崩掉
BackgroundTaskBroker.ImportKMSTask.WorkerCount
```
## ⚠️找不到样式问题解决:
AntSK/src/AntSK下执行:
```
dotnet clean
dotnet build
dotnet publish "AntSK.csproj"
```
再去AntSK/src/AntSK/bin/Release/net8.0/publish下
```
dotnet AntSK.dll
```
然后启动就有样式了
DB我使用的是CodeFirst模式只要配置好数据库链接表结构是自动创建的
## ✔使用llamafactory
```
1、首先需要确保你的环境已经安装了python和pip如果使用镜像例如p0.2.4版本已经包含了 python全套环境则无需此步骤
2、进入模型添加页面选择llamafactory
3、点击初始化可以检查pip install 环境是否完成
4、选择一个喜欢的模型
5、点击启动,这会开始从魔塔下载模型,你可能需要有一个较为漫长的等待
6、等待模型下载完毕后在请求地址输入 http://localhost:8000/ 这里默认是使用8000端口
7、点击保存然后就可以开始聊天了
8、很多人会问 LLamaSharp与llamafactory有什么区别其实这两者LLamaSharp是llama.cpp的 dotnet实现但是只支持本地gguf模型 而llamafactory 支持的模型种类更多但使用的是python的实现其主要差异在这里另外llamafactory具有模型微调的能力这也是我们下一步需要重点集成的部分。
```

## 💕 贡献者
这个项目的存在要感谢所有的贡献者。

<a href="https://github.com/AIDotNet/AntSK/graphs/contributors">
<img src="https://contrib.rocks/image?repo=AIDotNet/AntSK&max=1000&columns=15&anon=1" />
</a>

## 🚨 使用协议
本仓库遵循 [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. 包含AntSK许可证的版权声明。 [AntSK License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 。
2. 如果您修改了软件源代码,您需要在源代码中明确标明这些修改。
3. 满足以上要求
## 💕 特别感谢
助力企业级AI应用开发推荐使用 [AntBlazor](https://antblazor.com)
## ☎️联系我
如有任何问题或建议请通过以下方式关注我的公众号《许泽宇的技术分享》发消息与我联系我们也有AIDotnet交流群可以发送进群等消息然后我会拉你进交流群
另外您也可以通过邮箱与我联系antskpro@qq.com
![公众号](https://github.com/AIDotNet/AntSK/blob/main/images/gzh.jpg)
## 🌟 Star History
<a href="https://github.com/AIDotNet/AntSK/stargazers" target="_blank" style="display: block" align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=AIDotNet/AntSK&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=AIDotNet/AntSK&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=AIDotNet/AntSK&type=Date" />
</picture>
</a>

View File

@@ -3,9 +3,9 @@ version: '3.8'
services:
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.5
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.6.3
# 如果需要pytorch环境需要使用下面这个镜像镜像比较大
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.5
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.6.3
ports:
- 5000:5000
networks:

View File

@@ -16,7 +16,7 @@ services:
- 18889:18889
restart: unless-stopped
antskpg:
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/pg:v0.5.0
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/pg:v0.5.0
container_name: antskpg
restart: always
ports: # 生产环境建议不要暴露
@@ -32,9 +32,9 @@ services:
- ./pg/data:/var/lib/postgresql/data
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.5
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.6.3
# 如果需要pytorch环境需要使用下面这个镜像镜像比较大
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.5
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.6.3
ports:
- 5000:5000
networks:

View File

@@ -1,27 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DocumentationFile>AntSK.Domain.xml</DocumentationFile>
<NoWarn>CA1050,CA1707,CA2007,VSTHRD111,CS1591,RCS1110,CA5394,SKEXP0001,SKEXP0002,SKEXP0003,SKEXP0004,SKEXP0010,SKEXP0011,,SKEXP0012,SKEXP0020,SKEXP0021,SKEXP0022,SKEXP0023,SKEXP0024,SKEXP0025,SKEXP0026,SKEXP0027,SKEXP0028,SKEXP0029,SKEXP0030,SKEXP0031,SKEXP0032,SKEXP0040,SKEXP0041,SKEXP0042,SKEXP0050,SKEXP0051,SKEXP0052,SKEXP0053,SKEXP0054,SKEXP0055,SKEXP0060,SKEXP0061,SKEXP0101,SKEXP0102,KMEXP00</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AntDesign.Charts" Version="0.5.6" />
<PackageReference Include="AntDesign.ProLayout" Version="0.20.3" />
<PackageReference Include="AntDesign.Charts" Version="0.6.0" />
<PackageReference Include="AntDesign.ProLayout" Version="1.0.1" />
<PackageReference Include="BlazorComponents.Terminal" Version="0.6.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="pythonnet" Version="3.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
<PackageReference Include="pythonnet" Version="3.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.3.1" />
<PackageReference Include="AutoMapper" Version="8.1.0" />
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="Markdig" Version="0.41.1" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftVersion)" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.169" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.187" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
<PackageReference Include="RestSharp" Version="$(RestSharpVersion)" />
<PackageReference Include="NPOI" Version="2.7.1" />

View File

@@ -17,7 +17,6 @@ namespace AntSK.Domain.Domain.Interface
IAsyncEnumerable<string> SendChatByAppAsync(Apps app, ChatHistory history);
IAsyncEnumerable<StreamingKernelContent> SendKmsByAppAsync(Apps app, string questions, ChatHistory history, string filePath, List<RelevantSource> relevantSources = null);
Task<string> SendImgByAppAsync(Apps app, string questions);
Task<ChatHistory> GetChatHistory(List<Chats> MessageList, ChatHistory history);
}
}

View File

@@ -10,6 +10,6 @@ namespace AntSK.Domain.Domain.Interface
public interface IOllamaService
{
public event LogMessageHandler LogMessageReceived;
Task StartOllama(string modelName);
Task OllamaPull(string modelName);
}
}

View File

@@ -10,6 +10,5 @@ namespace AntSK.Domain.Domain.Model.Enum
{
chat = 1,
kms = 2,
img=3
}
}

View File

@@ -75,14 +75,10 @@ namespace AntSK.Domain.Domain.Other.Bge
}
PyObject result = model.compute_score(pyList, normalize: true);
//BAAI/bge-reranker-v2-minicpm-layerwise
// https://www.modelscope.cn/models/AI-ModelScope/bge-reranker-v2-m3
//PyList cutoffLayers = new PyList();
//cutoffLayers.Append(new PyInt(8));
//dynamic scores = model.compute_score(pyList, cutoff_layers: cutoffLayers);
return result.ConvertToDouble();
var res = result.ToString();
var res1 = res.Replace("[", "").Replace("]", "").ConvertToDouble();
return res1;
}
catch (Exception ex)
{

View File

@@ -90,10 +90,12 @@ namespace AntSK.Domain.Domain.Service
public async IAsyncEnumerable<StreamingKernelContent> SendKmsByAppAsync(Apps app, string questions, ChatHistory history, string filePath, List<RelevantSource> relevantSources = null)
{
relevantSources?.Clear();
var relevantSourceList = await _kMService.GetRelevantSourceList(app, questions);
List<RelevantSource> relevantSourceList = new List<RelevantSource>();
var _kernel = _kernelService.GetKernelByApp(app);
if (!string.IsNullOrWhiteSpace(filePath))
{
//上传文件问答
var memory = _kMService.GetMemoryByApp(app);
// 匹配GUID的正则表达式
@@ -105,7 +107,7 @@ namespace AntSK.Domain.Domain.Service
{
var fileId = match.Value;
var status=await memory.IsDocumentReadyAsync(fileId, index: KmsConstantcs.KmsIndex);
var status = await memory.IsDocumentReadyAsync(fileId, index: KmsConstantcs.KmsIndex);
if (!status)
{
var result = await memory.ImportDocumentAsync(new Document(fileId).AddFile(filePath)
@@ -129,6 +131,11 @@ namespace AntSK.Domain.Domain.Service
app.Prompt = KmsConstantcs.KmsPrompt;
}
}
else
{
//从知识库问答
relevantSourceList = await _kMService.GetRelevantSourceList(app, questions);
}
var dataMsg = new StringBuilder();
@@ -222,112 +229,6 @@ namespace AntSK.Domain.Domain.Service
}
public async Task<string> SendImgByAppAsync(Apps app, string questions)
{
var imageModel = _aIModels_Repositories.GetFirst(p => p.Id == app.ImageModelID);
KernelArguments args = new() {
{ "input", questions }
};
var _kernel = _kernelService.GetKernelByApp(app);
var temperature = app.Temperature / 100; //存的是0~100需要缩小
OpenAIPromptExecutionSettings settings = new() { Temperature = temperature };
var func = _kernel.CreateFunctionFromPrompt("Translate this into English:{{$input}}", settings);
var chatResult = await _kernel.InvokeAsync(function: func, arguments: args);
if (chatResult.IsNotNull())
{
//Can Load stable-diffusion library in diffenert environment
//SDHelper.LoadLibrary()
string versionString = string.Empty;
string extensionString = string.Empty;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
extensionString = ".dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
extensionString = ".so";
}
else
{
throw new InvalidOperationException("OS Platform no support");
}
ProcessStartInfo startInfo = new ProcessStartInfo("nvcc", "--version");
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
using (Process process = Process.Start(startInfo))
{
if (process != null)
{
string result = process.StandardOutput.ReadToEnd();
Regex regex = new Regex(@"release (\d+).[\d]");
Match match = regex.Match(result);
if (match.Success)
{
switch (match.Groups[1].Value.ToString())
{
case "11":
versionString = "Cuda11";
break;
case "12":
versionString = "Cuda12";
break;
default:
versionString = "CPU";
break;
}
}
}
else
{
throw new Exception("nvcc get an error");
}
}
string libraryPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "StableDiffusion", "Backend", versionString, "stable-diffusion" + extensionString);
NativeLibrary.TryLoad(libraryPath, out _);
string prompt = chatResult.GetValue<string>();
if (!SDHelper.IsInitialized)
{
Structs.ModelParams modelParams = new Structs.ModelParams
{
ModelPath = imageModel.ModelName,
RngType = Structs.RngType.CUDA_RNG,
//VaePath = vaePath,
//KeepVaeOnCpu = keepVaeOnCpu,
//set false can get a better image, otherwise can use lower vram
VaeTiling = false,
//LoraModelDir = loraModelDir,
};
bool result = SDHelper.Initialize(modelParams);
}
Structs.TextToImageParams textToImageParams = new Structs.TextToImageParams
{
Prompt = prompt,
NegativePrompt = "bad quality, wrong image, worst quality",
SampleMethod = (Structs.SampleMethod)Enum.Parse(typeof(Structs.SampleMethod), "EULER_A"),
//the base image size in SD1.5 is 512x512
Width = 512,
Height = 512,
NormalizeInput = true,
ClipSkip = -1,
CfgScale = 7,
SampleSteps = 20,
Seed = -1,
};
Bitmap[] outputImages = SDHelper.TextToImage(textToImageParams);
var base64 = ImageUtils.BitmapToBase64(outputImages[0]);
return base64;
}
else
{
return "";
}
}
public async Task<ChatHistory> GetChatHistory(List<Chats> MessageList, ChatHistory history)
{
foreach (var item in MessageList)

View File

@@ -102,21 +102,21 @@ namespace AntSK.Domain.Domain.Service
var settings = chatModel.ModelKey.Split("|");
Sdcb.SparkDesk.ModelVersion modelVersion = Sdcb.SparkDesk.ModelVersion.V3_5;
Sdcb.SparkDesk.ModelVersion modelVersion = Sdcb.SparkDesk.ModelVersion.Lite;
switch (chatModel.ModelName)
{
case "V3_5":
modelVersion = Sdcb.SparkDesk.ModelVersion.V3_5;
case "Max":
modelVersion = Sdcb.SparkDesk.ModelVersion.Max;
break;
case "V3":
modelVersion = Sdcb.SparkDesk.ModelVersion.V3;
case "Pro":
modelVersion = Sdcb.SparkDesk.ModelVersion.Pro;
break;
case "V2":
modelVersion = Sdcb.SparkDesk.ModelVersion.V2;
modelVersion = Sdcb.SparkDesk.ModelVersion.V2_0;
break;
case "V1_5":
modelVersion = Sdcb.SparkDesk.ModelVersion.V1_5;
case "Lite":
modelVersion = Sdcb.SparkDesk.ModelVersion.Lite;
break;
}

View File

@@ -2,6 +2,7 @@
using AntSK.Domain.Domain.Interface;
using AntSK.Domain.Domain.Model.Dto;
using AntSK.Domain.Options;
using AntSK.Domain.Utils;
using AntSK.LLamaFactory.Model;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
@@ -23,8 +24,6 @@ namespace AntSK.Domain.Domain.Service
{
private Process process;
public static bool isProcessComplete = false;
private readonly object _syncLock = new object();
private List<LLamaModel> modelList = new List<LLamaModel>();
@@ -42,7 +41,6 @@ namespace AntSK.Domain.Domain.Service
var cmdTask = Task.Factory.StartNew(() =>
{
var isProcessComplete = false;
process = new Process
{
@@ -80,8 +78,6 @@ namespace AntSK.Domain.Domain.Service
var cmdTask = Task.Factory.StartNew(() =>
{
var isProcessComplete = false;
process = new Process
{
StartInfo = new ProcessStartInfo
@@ -116,15 +112,20 @@ namespace AntSK.Domain.Domain.Service
{
var cmdTask = Task.Factory.StartNew(() =>
{
var isProcessComplete = false;
string templateName = "default";
var modelList = GetLLamaFactoryModels();
var model = modelList.Where(p => p.ModelScope == modelName).FirstOrDefault();
if (model.IsNotNull() && !string.IsNullOrEmpty(model.Template))
{
templateName = model.Template;
}
process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "python",
Arguments = "api_antsk.py --model_name_or_path " + modelName + " --template default ",
Arguments = "api_antsk.py --model_name_or_path " + modelName + " --template " + templateName + " ",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError=true,
@@ -199,7 +200,7 @@ namespace AntSK.Domain.Domain.Service
{
foreach (var m in model.Models)
{
modelList.Add(new LLamaModel() { Name=m.Key, ModelScope=m.Value.MODELSCOPE });
modelList.Add(new LLamaModel() { Name = m.Key, ModelScope = m.Value.MODELSCOPE, Template = model.Template });
}
}
}

View File

@@ -22,7 +22,7 @@ namespace AntSK.Domain.Domain.Service
LogMessageReceived?.Invoke(message);
}
public async Task StartOllama(string modelName)
public async Task OllamaPull(string modelName)
{
Console.OutputEncoding = Encoding.UTF8;
var cmdTask = Task.Factory.StartNew(() =>
@@ -35,7 +35,7 @@ namespace AntSK.Domain.Domain.Service
StartInfo = new ProcessStartInfo
{
FileName = "ollama",
Arguments = "run " + modelName,
Arguments = "pull " + modelName,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,

View File

@@ -42,6 +42,7 @@ namespace AntSK.Domain.Repositories
/// <summary>
/// Embedding 模型Id
/// </summary>
[Required]
public string? EmbeddingModelID { get; set; }
public string? RerankModelID { get; set; }
@@ -86,8 +87,8 @@ namespace AntSK.Domain.Repositories
/// <summary>
/// 相似度
/// </summary>
[SugarColumn(DefaultValue = "70")]
public double Relevance { get; set; } = 70f;
[SugarColumn(DefaultValue = "60")]
public double Relevance { get; set; } = 60f;
/// <summary>
/// 提问最大token数

View File

@@ -23,7 +23,7 @@ namespace AntSK.Domain.Utils
var uncaseBody = new StringContent(requestBody, Encoding.UTF8, mediaType);
request.Content = uncaseBody;
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT").ConvertToString() != "Production")
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT").ConvertToString() == "Development")
{
//生产环境根据环境变量可去关闭日志
//便于调试查看请求prompt
@@ -79,7 +79,7 @@ namespace AntSK.Domain.Utils
// 接着,调用基类的 SendAsync 方法将你的修改后的请求发出去
HttpResponseMessage response = await base.SendAsync(request, cancellationToken);
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT").ConvertToString() != "Production")
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT").ConvertToString() == "Development")
{
string responseContent = requestBody.IsStream() ? response.Content.ReadAsStringAsync().Result : response.Content.ReadAsStringAsync().Result.Unescape();
Log.Information("{Message}", $"【模型服务接口返回-{guid},host:{_endPoint}】:{Environment.NewLine}{responseContent}");

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
@@ -11,9 +11,9 @@
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftVersion)" />
<PackageReference Include="RestSharp" Version="$(RestSharpVersion)" />
<PackageReference Include="Cnblogs.KernelMemory.AI.DashScope" Version="0.3.0" />
<PackageReference Include="Cnblogs.SemanticKernel.Connectors.DashScope" Version="0.3.2" />
<PackageReference Include="Sdcb.SparkDesk" Version="3.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
<PackageReference Include="Cnblogs.SemanticKernel.Connectors.DashScope" Version="0.4.0" />
<PackageReference Include="Sdcb.SparkDesk" Version="3.1.0" />
<PackageReference Include="System.Drawing.Common" Version="$(NetVersion)" />
</ItemGroup>
<ItemGroup>

View File

@@ -7,6 +7,6 @@ snowflake-arctic-embed:33m
snowflake-arctic-embed:110m
snowflake-arctic-embed:137m
snowflake-arctic-embed:335m
bge-m3:567m
bge-m3
bge-large:335m
paraphrase-multilingual:278m
paraphrase-multilingual:278m

View File

@@ -108,4 +108,4 @@ llama-pro:instruct
everythinglm:13b
llava-phi3:3.8b
mistrallite:7b
notus:7b
notus:7b

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@@ -23,5 +23,7 @@ namespace AntSK.LLamaFactory.Model
{
public string Name { get; set; }
public string ModelScope { get; set; }
public string Template { get; set; }
}
}

View File

@@ -17,7 +17,7 @@ fire
modelscope
langchain-community
sentence_transformers
FlagEmbedding
flagembedding
packaging
pyyaml
trl>=0.8.6

View File

@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.KernelMemory.Core" Version="$(KMVersion)" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.9.0.20240103" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
<PackageReference Include="Sdcb.OpenCvSharp4.mini.runtime.debian.12-x64" Version="4.8.0.20231125" />
<PackageReference Include="Sdcb.OpenVINO" Version="0.6.6" />
<PackageReference Include="Sdcb.OpenVINO" Version="0.6.10" />
<PackageReference Include="Sdcb.OpenVINO.PaddleOCR.Models.Online" Version="0.6.2" />
<PackageReference Include="Sdcb.OpenVINO.PaddleOCR" Version="0.6.3" />
<PackageReference Include="Sdcb.OpenVINO.runtime.ubuntu.22.04-x64" Version="2024.2.0" />
<PackageReference Include="Sdcb.OpenVINO.runtime.win-x64" Version="2024.2.0" />
<PackageReference Include="Sdcb.OpenVINO.PaddleOCR" Version="0.6.8" />
<PackageReference Include="Sdcb.OpenVINO.runtime.ubuntu.22.04-x64" Version="2025.0.0" />
<PackageReference Include="Sdcb.OpenVINO.runtime.win-x64" Version="2025.0.0" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "9.0.1",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}

View File

@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DocumentationFile>AntSK.xml</DocumentationFile>
<NoWarn>CA1050,CA1707,CA2007,VSTHRD111,CS1591,RCS1110,CA5394,SKEXP0001,SKEXP0002,SKEXP0003,SKEXP0004,SKEXP0010,SKEXP0011,,SKEXP0012,SKEXP0020,SKEXP0021,SKEXP0022,SKEXP0023,SKEXP0024,SKEXP0025,SKEXP0026,SKEXP0027,SKEXP0028,SKEXP0029,SKEXP0030,SKEXP0031,SKEXP0032,SKEXP0040,SKEXP0041,SKEXP0042,SKEXP0050,SKEXP0051,SKEXP0052,SKEXP0053,SKEXP0054,SKEXP0055,SKEXP0060,SKEXP0061,SKEXP0101,SKEXP0102</NoWarn>
<ApplicationIcon>AntSKlogo.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Compile Remove="llamafactory\**" />
<Content Remove="llamafactory\**" />
@@ -20,11 +19,11 @@
<Content Include="AntSKlogo.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.6" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
<PackageReference Include="Downloader" Version="3.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="$(NetVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="$(NetVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(NetVersion)" />
<PackageReference Include="System.Net.Http.Json" Version="$(NetVersion)" />
<PackageReference Include="Downloader" Version="3.3.4" />
</ItemGroup>
<ItemGroup>

View File

@@ -27,7 +27,6 @@
<RadioGroup @bind-Value="context.Type" OnChange="OnAppTypeChange" TValue="string" ButtonStyle="RadioButtonStyle.Solid">
<Radio RadioButton Value="@AppType.chat.ToString()">会话应用</Radio>
<Radio RadioButton Value="@AppType.kms.ToString()">知识库</Radio>
<Radio RadioButton Value="@AppType.img.ToString()">做图应用</Radio>
</RadioGroup>
</FormItem>
<FormItem Label="描述" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
@@ -42,25 +41,24 @@
</Select>
<Button Type="@ButtonType.Link" OnClick="NavigateModelList">去创建</Button>
</FormItem>
@if (@context.Type != AppType.img.ToString())
{
<FormItem Label="向量模型" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<Select DataSource="@_embedingList"
@bind-Value="@context.EmbeddingModelID"
ValueProperty="c=>c.Id"
LabelProperty="c=>'【'+c.AIType.ToString()+'】'+c.ModelDescription">
</Select>
<Button Type="@ButtonType.Link" OnClick="NavigateModelList">去创建</Button>
</FormItem>
<FormItem Label="提示词" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<TextArea MinRows="4" Placeholder="请输入角色信息" @bind-Value="@context.Prompt" />
</FormItem>
<FormItem Label="温度系数" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<span>更确定</span>
<Slider TValue="double" Style="display: inline-block;width: 300px; " Min="0" Max="100" DefaultValue="70" @bind-Value="@context.Temperature" />
<span>更发散</span>
</FormItem>
}
<FormItem Label="向量模型" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<Select DataSource="@_embedingList"
@bind-Value="@context.EmbeddingModelID"
ValueProperty="c=>c.Id"
LabelProperty="c=>'【'+c.AIType.ToString()+'】'+c.ModelDescription">
</Select>
<Button Type="@ButtonType.Link" OnClick="NavigateModelList">去创建</Button>
</FormItem>
<FormItem Label="提示词" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<TextArea MinRows="4" Placeholder="请输入角色信息" @bind-Value="@context.Prompt" />
</FormItem>
<FormItem Label="温度系数" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<span>更确定</span>
<Slider TValue="double" Style="display: inline-block;width: 300px; " Min="0" Max="100" DefaultValue="70" @bind-Value="@context.Temperature" />
<span>更发散</span>
</FormItem>
@if (@context.Type == AppType.chat.ToString())
{
<FormItem Label="API插件列表" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">

View File

@@ -59,10 +59,6 @@
<Tag Color="@PresetColor.Green.ToString()">知识库</Tag>
}
else if (context.Type == AppType.img.ToString())
{
<Tag Color="@PresetColor.Red.ToString()">做图应用</Tag>
}
</DescriptionTemplate>
</CardMeta>
</Card>

View File

@@ -26,6 +26,10 @@ namespace AntSK.Pages.ChatPage
{
await base.OnInitializedAsync();
_list = _apps_Repositories.GetList();
if (string.IsNullOrEmpty(AppId)&&_list.Count>0)
{
AppId = _list.FirstOrDefault().Id;
}
}
private void OnRelevantSources(List<RelevantSource> relevantSources)

View File

@@ -130,6 +130,12 @@
.think {
color: gray;
font-style: italic;
text-align: left !important;
display: block;
margin-top: 5px;
margin-left: 8px;
padding-left: 8px;
border-left: 2px solid #7F7FFF;
}
</style>

View File

@@ -264,48 +264,17 @@ namespace AntSK.Pages.ChatPage.Components
await SendKms(questions, history, app, filePath);
}
else if (app.Type == AppType.img.ToString())
await SaveMsg(MessageList);
if (OnRelevantSources.IsNotNull())
{
await SendImg(questions, app);
await OnRelevantSources.InvokeAsync(_relevantSources);
}
//缓存消息记录
if (app.Type != AppType.img.ToString())
{
await SaveMsg(MessageList);
if (OnRelevantSources.IsNotNull())
{
await OnRelevantSources.InvokeAsync(_relevantSources);
}
}
return true;
}
/// <summary>
/// 发送图片对话
/// </summary>
/// <param name="questions"></param>
/// <param name="app"></param>
/// <returns></returns>
private async Task SendImg(string questions,Apps app)
{
Chats info = new Chats();
info.Id = Guid.NewGuid().ToString();
info.UserName=_userName;
info.AppId=AppId;
info.CreateTime = DateTime.Now;
var base64= await _chatService.SendImgByAppAsync(app, questions);
if (string.IsNullOrEmpty(base64))
{
info.Context = "生成失败";
}
else
{
info.Context = $"<img src=\"data:image/jpeg;base64,{base64}\" alt=\"Base64 Image\" />";
}
MessageList.Add(info);
}
/// <summary>
/// 发送知识库问答
/// </summary>

View File

@@ -68,111 +68,142 @@
</AntDesign.Col>
</Row>
<Divider><Title Level="3">功能特性</Title></Divider>
<Space Size=@(("10", "10" )) Wrap Align="start" Style="padding:10px">
<Space Size=@(("10", "10" )) Wrap Align="start" Style="padding:10px">
<SpaceItem>
<Card Bordered="true" Title=@("👉🏻商业") Hoverable="true" Style="height:260px;width:300px">
<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>
<Text>● 未获取商业授权,禁止商业使用</Text>
<br>
<Text>● 如需商业授权,请联系微信:</Text>
<b style="color:#1890ff">13469996907</b>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🍬语义内核") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>1、采用遥遥领先的自然语言处理技术</Text>
<br>
<Text>2、准确理解、处理和响应复杂的语义查询</Text>
<br>
<Text>3、为用户提供精确的信息检索和推荐服务</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🏁知识库") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>1、通过文档Word、PDF、Excel、Txt、Markdown、Json、PPT等形式导入知识库</Text>
<br>
<Text>2、可以进行知识库文档搜索问答</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🌈GPTs 生成") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>1、支持创建个性化的GPTs</Text>
<br>
<Text>2、构建您自己的GPTs</Text>
<br>
<Text>3、可以尽情发挥你的想象力</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🎁插件生态") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>1、开放式API插件系统允许第三方开发者或服务商轻松将其接口集成到AntSK不断增强应用功能</Text>
<br>
<Text>2、开放式函数插件系统标准格式的函数代码以及dll后集成到AntSK不断增强应用功能</Text>
<br>
<Text>3、支持二次开发Function</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("📱模型集成与管理") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>1、适配和管理集成不同厂商的不同模型</Text>
<br>
<Text>
2、并且支持llama.cpp所支持的gguf类型的模型离线运行
</Text>
<br>
<SpaceItem>
<Card Bordered="true" Title=@("🌟AntSKPro 一体机") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>
3、支持llamafactory所支持的模型包括baichuan、gemma、yuan、yi等
● 海量会话+向量+重排离线模型
</Text>
<br>
<Text>
4、未来将实现模型的训练、微调、部署一站式服务
</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🔗国产信创") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>1、支持国产本地化模型</Text>
<br>
<Text>
2、支持国产信创数据库
</Text>
<br>
<Text>
3、支持信创环境运行
</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("❤关注我的公众号") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Image Height="170" Src="./assets/gzh.jpg" />
</Body>
</Card>
</SpaceItem>
</Space>
<Text>● 装机直发、开箱即用</Text>
<a href="https://antsk.cn/solutions.html" target="_blank">更多详情</a>
<br>
<Text>
● 保姆式指导
</Text>
<br>
<Text>
● 整机硬件质保三年
</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🍬语义内核") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>● 采用领先的自然语言处理技术</Text>
<br>
<Text>● 精准理解、处理和响应复杂的语义查询</Text>
<br>
<Text>● 为用户提供精准的信息检索和推荐服务</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🏁知识库") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>● 支持导入各种格式的文档如Word, PDF, Excel, Txt, Json, PPT, Png等至知识库和知识图谱</Text>
<br>
<Text>● 可进行知识库和知识图谱文档的搜索问答</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🌈GPTs 生成") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>● 支持创建个性化的GPTs</Text>
<br>
<Text>● 构建您自己的GPTs</Text>
<br>
<Text>● 尽情发挥您的想象力</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🎁插件生态") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>● 开放API插件系统允许第三方开发者或服务商轻松集成接口至AntSK持续增强应用功能</Text>
<br>
<Text>● 开放函数插件系统标准格式的函数代码及dll文件可集成至AntSK持续增强应用能力</Text>
<br>
<Text>● 支持二次开发Function</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("📱模型集成与管理") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>● 适配与管理来自不同厂商的多种模型</Text>
<br>
<Text>
● 支持ollama支持的gguf模型类型离线运行
</Text>
<br>
<Text>
● 支持llamafactory所支持的模型包括baichuan、gemma、yuan、yi等
</Text>
<br>
<Text>
● 未来将实现模型的训练、微调、部署一站式服务
</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("🔗国产信创") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>● 支持国产本地化模型</Text>
<br>
<Text>
● 支持国产信创数据库
</Text>
<br>
<Text>
● 支持信创环境运行
</Text>
<br>
</Body>
</Card>
</SpaceItem>
<SpaceItem>
<Card Bordered="true" Title=@("✨技术支持") Hoverable="true" Style="height:260px;width:300px">
<Body>
<Text>● 商业版享有专业的技术支持1对1</Text>
<br>
<Text>
● 提供技术指导、方案设计、技术对接等服务
</Text>
<br>
<Text>
● 提供培训服务
</Text>
<br>
</Body>
</Card>
</SpaceItem>
</Space>
</GridContent>

View File

@@ -2,42 +2,165 @@
/* stylelint-disable no-duplicate-selectors */
/* stylelint-disable */
/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
/* 全局样式优化 */
:root {
--primary-color: #1890ff;
--primary-hover: #40a9ff;
--primary-active: #096dd9;
--primary-light: rgba(24, 144, 255, 0.1);
--text-color: rgba(0, 0, 0, 0.85);
--text-color-secondary: rgba(0, 0, 0, 0.45);
--border-radius: 4px;
--box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
--transition-duration: 0.3s;
}
/* 图标组样式优化 */
.iconGroup span.anticon {
margin-left: 16px;
color: rgba(0, 0, 0, 0.45);
color: var(--text-color-secondary);
cursor: pointer;
transition: color 0.32s;
transition: all var(--transition-duration) ease;
}
.iconGroup span.anticon:hover {
color: rgba(0, 0, 0, 0.85);
color: var(--text-color);
transform: scale(1.1);
}
/* 统计卡片样式增强 */
.ant-card {
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
transition: all var(--transition-duration) ease;
}
.ant-card:hover {
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
transform: translateY(-3px);
}
/* ChartCard 组件样式优化 */
.chartCard {
position: relative;
padding: 16px;
transition: all var(--transition-duration) ease;
}
.chartCard .chartTop {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.chartCard .metaWrap {
flex: 1;
}
.chartCard .meta {
display: flex;
justify-content: space-between;
color: var(--text-color-secondary);
font-size: 14px;
line-height: 22px;
}
.chartCard .action {
color: var(--primary-color);
transition: all var(--transition-duration) ease;
}
.chartCard .total {
margin-top: 4px;
color: var(--text-color);
font-weight: 600;
font-size: 24px;
line-height: 32px;
}
.chartCard .content {
position: relative;
margin-bottom: 12px;
height: auto;
width: 100%;
}
.chartCard .contentFixed {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
.chartCard .footer {
margin-top: 8px;
padding-top: 9px;
border-top: 1px solid rgba(0, 0, 0, 0.06);
}
/* 功能特性卡片样式优化 */
.ant-space-item .ant-card {
overflow: hidden;
border: 1px solid rgba(0, 0, 0, 0.06);
background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}
.ant-space-item .ant-card:hover {
border-color: var(--primary-color);
}
.ant-space-item .ant-card .ant-card-head {
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
background: linear-gradient(90deg, var(--primary-light) 0%, rgba(255, 255, 255, 0) 100%);
}
.ant-space-item .ant-card .ant-card-head-title {
font-weight: 600;
font-size: 16px;
color: var(--text-color);
}
/* 排名列表样式优化 */
.rankingList {
margin: 25px 0 0;
padding: 0;
list-style: none;
}
.rankingList li {
display: flex;
align-items: center;
margin-top: 16px;
zoom: 1;
padding: 8px;
border-radius: var(--border-radius);
transition: background-color var(--transition-duration) ease;
}
.rankingList li:hover {
background-color: rgba(0, 0, 0, 0.02);
}
.rankingList li::before,
.rankingList li::after {
display: table;
content: ' ';
}
.rankingList li::after {
clear: both;
height: 0;
font-size: 0;
visibility: hidden;
}
.rankingList li span {
color: rgba(0, 0, 0, 0.85);
color: var(--text-color);
font-size: 14px;
line-height: 22px;
}
.rankingList li .rankingItemNumber {
display: inline-block;
width: 20px;
@@ -49,12 +172,15 @@
line-height: 20px;
text-align: center;
background-color: #fafafa;
border-radius: 20px;
border-radius: 50%;
transition: all var(--transition-duration) ease;
}
.rankingList li .rankingItemNumber.active {
color: #fff;
background-color: #314659;
background-color: var(--primary-color);
}
.rankingList li .rankingItemTitle {
flex: 1;
margin-right: 8px;
@@ -62,79 +188,41 @@
white-space: nowrap;
text-overflow: ellipsis;
}
.salesExtra {
display: inline-block;
margin-right: 24px;
}
.salesExtra a {
margin-left: 24px;
color: rgba(0, 0, 0, 0.85);
}
.salesExtra a:hover {
color: #1890ff;
}
.salesExtra a.currentDate {
color: #1890ff;
}
.salesCard .salesBar {
padding: 0 0 32px 32px;
}
.salesCard .salesRank {
padding: 0 32px 32px 72px;
}
.salesCard :global .ant-tabs-bar,
.salesCard :global .ant-tabs-nav-wrap {
padding-left: 16px;
}
.salesCard :global .ant-tabs-bar .ant-tabs-nav .ant-tabs-tab,
.salesCard :global .ant-tabs-nav-wrap .ant-tabs-nav .ant-tabs-tab {
padding-top: 16px;
padding-bottom: 14px;
line-height: 24px;
}
.salesCard :global .ant-tabs-extra-content {
padding-right: 24px;
line-height: 55px;
}
.salesCard :global .ant-card-head {
/* 标题样式优化 */
.ant-divider .ant-typography {
position: relative;
color: var(--text-color);
font-weight: 600;
text-align: center;
}
.salesCard :global .ant-card-head-title {
align-items: normal;
}
.salesCardExtra {
height: inherit;
}
.salesTypeRadio {
.ant-divider .ant-typography::after {
content: '';
position: absolute;
right: 54px;
bottom: 12px;
bottom: -8px;
left: 50%;
width: 40px;
height: 3px;
background: var(--primary-color);
transform: translateX(-50%);
border-radius: 3px;
}
.offlineCard :global .ant-tabs-ink-bar {
bottom: auto;
/* 标签样式优化 */
.ant-tag {
margin: 4px;
padding: 2px 8px;
border-radius: 12px;
font-size: 12px;
transition: all var(--transition-duration) ease;
}
.offlineCard :global .ant-tabs-bar {
border-bottom: none;
}
.offlineCard :global .ant-tabs-nav-container-scrolling {
padding-right: 40px;
padding-left: 40px;
}
.offlineCard :global .ant-tabs-tab-prev-icon::before {
position: relative;
left: 6px;
}
.offlineCard :global .ant-tabs-tab-next-icon::before {
position: relative;
right: 6px;
}
.offlineCard :global .ant-tabs-tab-active h4 {
color: #1890ff;
}
.trendText {
margin-left: 8px;
color: rgba(0, 0, 0, 0.85);
.ant-tag:hover {
transform: scale(1.05);
}
/* 响应式调整 */
@media screen and (max-width: 992px) {
.salesExtra {
display: none;
@@ -142,7 +230,11 @@
.rankingList li span:first-child {
margin-right: 8px;
}
.ant-card:hover {
transform: translateY(-2px);
}
}
@media screen and (max-width: 768px) {
.rankingTitle {
margin-top: 16px;
@@ -150,7 +242,11 @@
.salesCard .salesBar {
padding: 16px;
}
.ant-space {
justify-content: center;
}
}
@media screen and (max-width: 576px) {
.salesExtraWrap {
display: none;
@@ -158,4 +254,7 @@
.salesCard :global .ant-tabs-content {
padding-top: 30px;
}
.chartCard .total {
font-size: 20px;
}
}

View File

@@ -170,6 +170,8 @@
</Select>
</InputGroup>
<a href="https://ollama.com/library" target="_blank">获取更多模型</a>
<br/>
<span>可以在OllamaModelList.txt中进行修改</span>
</FormItem>
<FormItem Label="请求地址" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<Input Placeholder="http://localhost:11434/" @bind-Value="@context.EndPoint" AutoComplete="false" />
@@ -179,7 +181,7 @@
</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>
}
@@ -200,6 +202,8 @@
</Select>
</InputGroup>
<a href="https://ollama.com/library" target="_blank">获取更多模型</a>
<br />
<span>可以在OllamaEmbeddingModelList.txt中进行修改</span>
</FormItem>
<FormItem Label="请求地址" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<Input Placeholder="http://localhost:11434/" @bind-Value="@context.EndPoint" AutoComplete="false" />
@@ -209,7 +213,7 @@
</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>
}
@@ -220,9 +224,8 @@
@bind-Value="@context.ModelName"
ValueProperty="c=>c"
LabelProperty="c=>c">
</Select>
</Select>
</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" AutoComplete="false" />

View File

@@ -317,7 +317,7 @@ namespace AntSK.Pages.Setting.AIModel
_ollamaService.LogMessageReceived -= CmdLogHandler;
_ollamaService.LogMessageReceived += CmdLogHandler;
_ollamaService.StartOllama(_aiModel.ModelName);
_ollamaService.OllamaPull(_aiModel.ModelName);
}
private void OnCancelPipInstall()

View File

@@ -123,5 +123,15 @@ app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
//延迟3秒后打开浏览器 localhost:5000
//Task.Run(async () =>
//{
// await Task.Delay(3000);
// System.Diagnostics.Process.Start("explorer.exe", "http://localhost:5000");
//});
app.Run();

View File

@@ -1 +0,0 @@
# AntSK

View File

@@ -10,7 +10,7 @@
"urls": "http://*:5000",
"ProSettings": {
"NavTheme": "light",
"Layout": "side",
"Layout": "top",
"ContentWidth": "Fluid",
"FixedHeader": false,
"FixSiderbar": true,
@@ -38,7 +38,7 @@
},
"Login": {
"User": "admin",
"Password": "xuzeyu"
"Password": "admin"
},
"BackgroundTaskBroker": {
"ImportKMSTask": {

View File

@@ -71,18 +71,18 @@
}
]
},
{
"path": "https://antsk.cn",
"name": "官方文档",
"key": "antskdoc",
"icon": "question-circle"
},
{
"path": "https://api.antsk.cn/",
"name": "GPT代理接口",
"key": "antskapi",
"icon": "bulb"
},
{
"path": "https://antsk.cn",
"name": "官网",
"key": "antskdoc",
"icon": "question-circle"
},
{
"path": "https://www.bilibili.com/video/BV1vK421b7NF",
"name": "教程视频",

View File

@@ -5,5 +5,6 @@
<NewtonsoftVersion>13.0.3</NewtonsoftVersion>
<RestSharpVersion>112.1.0</RestSharpVersion>
<SKVersion>1.17.2</SKVersion>
<NetVersion>9.0.0</NetVersion>
</PropertyGroup>
</Project>

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>AntSK.BackgroundTask</AssemblyName>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<LangVersion>Preview</LangVersion>