Compare commits

..

52 Commits
0.5.2 ... 0.6.1

Author SHA1 Message Date
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
zyxucp
358909892c update deepseek 思考 2025-02-06 11:01:42 +08:00
zyxucp
6c1bc4be04 add deepseek-r1 ollama 2025-02-03 18:37:14 +08:00
zyxucp
431c754f42 Update README.md 2025-01-13 14:29:39 +08:00
zyxucp
f46faa7679 Update README.md 2025-01-13 14:27:33 +08:00
zyxucp
195053cbd7 update 星火 2024-12-17 12:14:33 +08:00
zyxucp
b41d79c247 Merge pull request #108 from itchangc/main
BAAI/bge-reranker-v2-minicpm-layerwise
2024-11-20 14:24:40 +08:00
zhaochang
5acab7a46f todo 2024-11-17 20:12:34 +08:00
zhaochang
5b83c844a1 BAAI/bge-reranker-v2-minicpm-layerwise 2024-11-17 20:11:51 +08:00
token
2325c58092 Update Chats.cs 2024-11-04 05:16:07 +08:00
zyxucp
04d16148b5 add rerank api 2024-10-30 11:13:39 +08:00
zyxucp
f0f14889c7 update docker yml 2024-10-24 15:11:52 +08:00
zyxucp
dedafdd108 fix sk update bug 2024-10-24 15:11:25 +08:00
zyxucp
fad2b4e733 Update docker-compose.yml 2024-10-23 18:05:39 +08:00
zyxucp
032de7a447 Update docker-compose.simple.yml 2024-10-23 18:05:24 +08:00
zyxucp
cb0df4d4af update sk and km version 2024-10-23 18:03:21 +08:00
zyxucp
c810f85cea update nuget 2024-10-23 17:06:27 +08:00
zyxucp
6700b75684 update del icon 2024-10-23 09:40:15 +08:00
zyxucp
ab15dd6e99 add SecretKey search 2024-10-18 09:52:47 +08:00
zyxucp
13a4419705 update index 2024-10-14 14:10:04 +08:00
zyxucp
cf03465e23 Update README.zh.md 2024-10-06 10:35:45 +08:00
zyxucp
a441730508 Update README.md 2024-10-06 10:34:45 +08:00
zyxucp
6e30886bd2 Update README.md 2024-10-06 10:34:21 +08:00
zyxucp
bc2af42724 Update README.md 2024-10-06 10:31:35 +08:00
zyxucp
919fc5dea7 Update docker-compose.yml 2024-10-06 10:30:50 +08:00
zyxucp
9ab287fabd Update docker-compose.simple.yml 2024-10-06 10:30:36 +08:00
zyxucp
cf02efc2da update nuget 2024-10-05 18:33:30 +08:00
39 changed files with 388 additions and 279 deletions

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. **免费商用**:用户在不修改代码的情况下,可以免费用于商业目的。
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 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.
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.

View File

@@ -20,7 +20,7 @@
- **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, including gguf types supported by **llama.cpp** and models offline running supported by **llamafactory** and **ollama**.
- **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.
@@ -86,7 +86,7 @@ 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:
@@ -101,11 +101,18 @@ services:
- 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
```
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
```
@@ -197,13 +204,14 @@ This warehouse follows the [AntSK License](https://github.com/AIDotNet/AntSK?tab
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. **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.
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. 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:

View File

@@ -73,6 +73,12 @@ AntSK 适用于多种业务场景,例如:
需要配置如下的配置文件
## 为了方便体验,我已经把打包好的程序放进了网盘,你只需要安装.net8环境即可运行。
[.net8环境 ](https://dotnet.microsoft.com/zh-cn/download/dotnet/8.0)
[我用夸克网盘分享了「AntSK」](https://pan.quark.cn/s/9462c849cbad)
## 1⃣使用docker-compose
提供了pg版本 **appsettings.json** 和 简化版本(**Sqlite+disk** **docker-compose.simple.yml**
@@ -94,7 +100,7 @@ version: '3.8'
services:
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.3.1
image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.6.0
ports:
- 5000:5000
networks:
@@ -112,9 +118,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⃣配置文件的一些含义
```
@@ -203,13 +215,14 @@ DB我使用的是CodeFirst模式只要配置好数据库链接表结构是
除以下附加条款外该项目遵循Apache 2.0协议
1. 本项目可以用于商业目的,但如果违反以下规定,它有权禁止您使用
1. **免费商用**:用户在不修改代码的情况下,可以免费用于商业目的。
2. **商业授权**:如果您满足以下任意条件之一,需取得商业授权:
1. 对本软件进行二次修改、开发包括但不限于修改应用名称、logo、代码以及功能
2. 为企业客户提供多租户服务,且该服务支持 10 人或以上的使用。
3. 预装或集成到硬件设备或产品中进行捆绑销售。
4. 政府或教育机构的大规模采购项目,特别是涉及安全、数据隐私等敏感需求时。
2. 未经授权您不允许修改AntSK的徽标和标题信息
3. 未经授权,您不能修改页面底部的版权信息
4. 如果您需要授权可以联系微信xuzeyu91
3. 如果您需要授权可以联系微信xuzeyu91
如果您打算在商业项目中使用AntSK您需要确保遵守以下步骤

View File

@@ -3,9 +3,9 @@ version: '3.8'
services:
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.1
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.6.0
# 如果需要pytorch环境需要使用下面这个镜像镜像比较大
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.1
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.6.0
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.1
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.6.0
# 如果需要pytorch环境需要使用下面这个镜像镜像比较大
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.1
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.6.0
ports:
- 5000:5000
networks:

View File

@@ -8,21 +8,21 @@
<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.5" />
<PackageReference Include="AntDesign.Charts" Version="0.5.6" />
<PackageReference Include="AntDesign.ProLayout" Version="0.20.3" />
<PackageReference Include="BlazorComponents.Terminal" Version="0.6.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageReference Include="pythonnet" Version="3.0.3" />
<PackageReference Include="pythonnet" Version="3.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
<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="Newtonsoft.Json" Version="$(NewtonsoftVersion)" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.166" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.169" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
<PackageReference Include="RestSharp" Version="$(RestSharpVersion)" />
<PackageReference Include="NPOI" Version="2.7.1" />
@@ -35,13 +35,13 @@
<PackageReference Include="Microsoft.KernelMemory.MemoryDb.Redis" Version="$(KMVersion)" />
<PackageReference Include="Microsoft.KernelMemory.MemoryDb.AzureAISearch" Version="$(KMVersion)" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.1-dev-10391" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.OpenTelemetry" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.OpenTelemetry" Version="4.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AntSK.LLamaFactory\AntSK.LLamaFactory.csproj" />

View File

@@ -252,6 +252,53 @@
<param name="history"></param>
<returns></returns>
</member>
<member name="P:AntSK.Domain.Result.Code">
<summary>
错误码0是正常返回异常返回错误码
</summary>
</member>
<member name="P:AntSK.Domain.Result.Data">
<summary>
返回数据
</summary>
</member>
<member name="P:AntSK.Domain.Result.Message">
<summary>
返回信息详情
</summary>
</member>
<member name="M:AntSK.Domain.ResponseResult.Success">
<summary>
执行成功
</summary>
<returns></returns>
</member>
<member name="M:AntSK.Domain.ResponseResult.Success(System.Object,System.String,System.String)">
<summary>
执行成功
</summary>
<param name="data"></param>
<param name="code"></param>
<param name="message"></param>
<returns></returns>
</member>
<member name="M:AntSK.Domain.ResponseResult.Error(System.Object,System.String,System.String)">
<summary>
执行失败
</summary>
<param name="data"></param>
<param name="code"></param>
<param name="message"></param>
<returns></returns>
</member>
<member name="M:AntSK.Domain.ResponseResult.Error(System.String,System.String)">
<summary>
执行失败
</summary>
<param name="code"></param>
<param name="message"></param>
<returns></returns>
</member>
<member name="P:AntSK.Domain.Options.DBConnectionOption.DbType">
<summary>
sqlite连接字符串
@@ -419,7 +466,7 @@
</member>
<member name="P:AntSK.Domain.Repositories.Chats.CreateTime">
<summary>
创建事件
创建时间
</summary>
</member>
<member name="P:AntSK.Domain.Repositories.Chats.FileName">

View File

@@ -1,4 +1,4 @@
using Amazon.Runtime.Internal.Util;

using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;

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

@@ -18,4 +18,11 @@
public List<string> input { get; set; }
}
public class RerankModel
{
public string modelId { get; set; }
public string query { get; set; }
public string document { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
namespace AntSK.Domain
{
public class Result
{
/// <summary>
/// 错误码0是正常返回异常返回错误码
/// </summary>
public string Code { get; set; } = "0";
/// <summary>
/// 返回数据
/// </summary>
public object Data { get; set; }
/// <summary>
/// 返回信息详情
/// </summary>
public string Message { get; set; }
}
public static class ResponseResult
{
/// <summary>
/// 执行成功
/// </summary>
/// <returns></returns>
public static Result Success()
{
return new Result
{
Data = "",
Code = "0",
Message = "ok"
};
}
/// <summary>
/// 执行成功
/// </summary>
/// <param name="data"></param>
/// <param name="code"></param>
/// <param name="message"></param>
/// <returns></returns>
public static Result Success(this object data, string code = "0", string message = "ok")
{
return new Result
{
Data = data,
Code = code,
Message = message
};
}
/// <summary>
/// 执行失败
/// </summary>
/// <param name="data"></param>
/// <param name="code"></param>
/// <param name="message"></param>
/// <returns></returns>
public static Result Error(this object data, string code, string message)
{
return new Result
{
Data = data,
Code = code,
Message = message
};
}
/// <summary>
/// 执行失败
/// </summary>
/// <param name="code"></param>
/// <param name="message"></param>
/// <returns></returns>
public static Result Error(string code, string message)
{
return new Result
{
Data = "",
Code = code,
Message = message
};
}
}
}

View File

@@ -1,5 +1,4 @@
using Amazon.Runtime.Internal.Util;
using AntSK.BackgroundTask;
using AntSK.BackgroundTask;
using AntSK.Domain.Domain.Interface;
using AntSK.Domain.Domain.Model;
using Microsoft.Extensions.DependencyInjection;

View File

@@ -36,8 +36,16 @@ namespace AntSK.Domain.Domain.Other.Bge
dynamic flagEmbedding = Py.Import("FlagEmbedding");
dynamic model_dir = modelscope.snapshot_download(modelName, revision: "master");
dynamic flagReranker = flagEmbedding.FlagReranker(model_dir, use_fp16: false);
model = flagReranker;
if (modelName == "BAAI/bge-reranker-v2-minicpm-layerwise")
{
dynamic flagReranker = flagEmbedding.LayerWiseFlagLLMReranker(model_dir, use_fp16: true);
model = flagReranker;
}
else
{
dynamic flagReranker = flagEmbedding.FlagReranker(model_dir, use_fp16: true);
model = flagReranker;
}
return model;
}
}
@@ -66,7 +74,15 @@ namespace AntSK.Domain.Domain.Other.Bge
pyList.Append(item.ToPython()); // 将C# string转换为Python对象并添加到PyList中
}
PyObject result = model.compute_score(pyList, normalize: true);
return result.ConvertToString().Trim('[').Trim(']').ConvertToDouble();
//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();
}
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();

View File

@@ -10,7 +10,6 @@ using AntSK.Domain.Repositories;
using AntSK.Domain.Utils;
using AntSK.OCR;
using DocumentFormat.OpenXml.Drawing.Diagrams;
using LLama;
using Markdig;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;

View File

@@ -1,8 +1,8 @@
using Amazon.Runtime.Internal.Util;
using AntSK.Domain.Common.DependencyInjection;
using AntSK.Domain.Common.DependencyInjection;
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;
@@ -24,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>();
@@ -43,7 +41,6 @@ namespace AntSK.Domain.Domain.Service
var cmdTask = Task.Factory.StartNew(() =>
{
var isProcessComplete = false;
process = new Process
{
@@ -81,8 +78,6 @@ namespace AntSK.Domain.Domain.Service
var cmdTask = Task.Factory.StartNew(() =>
{
var isProcessComplete = false;
process = new Process
{
StartInfo = new ProcessStartInfo
@@ -117,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,
@@ -200,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

@@ -29,7 +29,7 @@ namespace AntSK.Domain.Repositories
/// </summary>
public bool IsSend { get; set; } = false;
/// <summary>
/// 创建事件
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }

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

@@ -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

@@ -24,6 +24,12 @@ deepseek-coder:6.7b
deepseek-coder:33b
deepseek-coder-v2:16b
deepseek-coder-v2:236b
deepseek-r1:1.5b
deepseek-r1:7b
deepseek-r1:8b
deepseek-r1:14b
deepseek-r1:32b
deepseek-r1:70b
phi:2.7b
phi3:mini
phi3:medium
@@ -102,4 +108,4 @@ llama-pro:instruct
everythinglm:13b
llava-phi3:3.8b
mistrallite:7b
notus:7b
notus:7b

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

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

View File

@@ -8,7 +8,6 @@
<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\**" />

View File

@@ -1,4 +1,5 @@
using AntSK.Domain.Domain.Model.Dto.OpenAPI;
using AntSK.Domain;
using AntSK.Domain.Domain.Model.Dto.OpenAPI;
using AntSK.Domain.Utils;
using AntSK.Services.OpenApi;
using Microsoft.AspNetCore.Mvc;
@@ -22,5 +23,22 @@ namespace AntSK.Controllers
string sk = HttpContext.Request.Headers["Authorization"].ConvertToString();
await _openApiService.Chat(model, sk, HttpContext);
}
[HttpPost]
[Route("api/v1/rerank")]
public async Task<IActionResult> Rerank(RerankModel model)
{
try
{
string sk = HttpContext.Request.Headers["Authorization"].ConvertToString();
var result = await _openApiService.Rerank(model, sk, HttpContext);
return Ok(result.Success());
}
catch (Exception ex)
{
return Ok(ResponseResult.Error("1001",ex.Message));
}
}
}
}

View File

@@ -25,13 +25,6 @@
{
public LinkItem[] Links { get; set; } =
{
new LinkItem
{
Key = "许泽宇的技术分享",
Title = "许泽宇的技术分享",
Href = "./assets/gzh.jpg",
BlankTarget = true,
},
new LinkItem
{
Key = "antsk.cn",

View File

@@ -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>

View File

@@ -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);

View File

@@ -126,6 +126,11 @@
.ant-card-body {
height: 90% !important;
}
.think {
color: gray;
font-style: italic;
}
</style>
@code {

View File

@@ -329,7 +329,7 @@ namespace AntSK.Pages.ChatPage.Components
await foreach (var content in chatResult)
{
rawContent.Append(content.ConvertToString());
info.Context = Markdown.ToHtml(rawContent.ToString());
info.Context = Markdown.ToHtml(rawContent.ToString().Replace("<think>", "<div class=\"think\">").Replace("</think>", "</div>"));
await Task.Delay(30);
await InvokeAsync(StateHasChanged);
}
@@ -366,7 +366,7 @@ namespace AntSK.Pages.ChatPage.Components
{
rawContent.Append(content.ConvertToString());
}
info.Context = Markdown.ToHtml(rawContent.ToString());
info.Context = Markdown.ToHtml(rawContent.ToString().Replace("<think>", "<div class=\"think\">").Replace("</think>", "</div>"));
await Task.Delay(30);
await InvokeAsync(StateHasChanged);
}

View File

@@ -166,7 +166,7 @@
</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>

View File

@@ -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>

View File

@@ -92,10 +92,10 @@
<FormItem Label="模型版本" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
<SimpleSelect DefaultValue="Lite" @bind-Value="@context.ModelName">
<SelectOptions>
<SimpleSelectOption Value="Max" Label="Max"></SimpleSelectOption>
<SimpleSelectOption Value="Pro" Label="Pro"></SimpleSelectOption>
<SimpleSelectOption Value="V3_5" Label="Max"></SimpleSelectOption>
<SimpleSelectOption Value="V3" Label="Pro"></SimpleSelectOption>
<SimpleSelectOption Value="V2" Label="V2"></SimpleSelectOption>
<SimpleSelectOption Value="Lite" Label="Lite"></SimpleSelectOption>
<SimpleSelectOption Value="V1_5" Label="Lite"></SimpleSelectOption>
</SelectOptions>
</SimpleSelect>
</FormItem>
@@ -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

@@ -65,7 +65,7 @@ namespace AntSK.Pages.Setting.AIModel
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", "BAAI/bge-reranker-v2-minicpm-layerwise" };
private bool BgeEmbeddingIsStart = false;
private string BgeEmbeddingBtnText = "初始化";
@@ -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

@@ -39,7 +39,11 @@
delete(async ()=>await Delete(context.Id))
}" Style="width:100%">
<div class="listContent" style="width:100%">
<div class="listContentItem" style="width:15%">
<div class="listContentItem" style="width:20%">
<b>模型ID</b>
<p title="@context.Id">@context.Id</p>
</div>
<div class="listContentItem" style="width:5%">
<b>模型描述</b>
<p title="@context.ModelDescription">@context.ModelDescription</p>
</div>
@@ -99,11 +103,11 @@
}
</p>
</div>
<div class="listContentItem" style="width:25%">
<div class="listContentItem" style="width:20%">
<b>模型地址</b>
<p title="@context.EndPoint">@context.EndPoint</p>
</div>
<div class="listContentItem" style="width:15%">
<div class="listContentItem" style="width:10%">
<b>模型名称</b>
<p title="@context.ModelName">@context.ModelName</p>
</div>

View File

@@ -10,7 +10,6 @@ using AntSK.Domain.Utils;
using AntSK.plugins.Functions;
using AntSK.Services.Auth;
using Blazored.LocalStorage;
using LLama.Native;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Mvc;

View File

@@ -1,6 +1,7 @@
using AntSK.Domain.Common.DependencyInjection;
using AntSK.Domain.Domain.Interface;
using AntSK.Domain.Domain.Model.Dto.OpenAPI;
using AntSK.Domain.Domain.Other.Bge;
using AntSK.Domain.Repositories;
using AntSK.Domain.Utils;
using Microsoft.KernelMemory;
@@ -17,6 +18,8 @@ namespace AntSK.Services.OpenApi
public interface IOpenApiService
{
Task Chat(OpenAIModel model, string sk, HttpContext HttpContext);
Task<double> Rerank(RerankModel model, string sk, HttpContext HttpContext);
}
[ServiceDescription(typeof(IOpenApiService), ServiceLifetime.Scoped)]
@@ -24,7 +27,8 @@ namespace AntSK.Services.OpenApi
IApps_Repositories _apps_Repositories,
IKernelService _kernelService,
IKMService _kMService,
IChatService _chatService
IChatService _chatService,
IAIModels_Repositories _aIModels_Repositories
) : IOpenApiService
{
public async Task Chat(OpenAIModel model, string sk, HttpContext HttpContext)
@@ -252,5 +256,16 @@ namespace AntSK.Services.OpenApi
}
return (questions,history);
}
public async Task<double> Rerank(RerankModel model, string sk, HttpContext HttpContext)
{
var rerankModel = _aIModels_Repositories.GetById(model.modelId);
BegRerankConfig.LoadModel(rerankModel.EndPoint, rerankModel.ModelName);
List<string> rerank = new List<string>();
rerank.Add(model.query);
rerank.Add(model.document);
var result= BegRerankConfig.Rerank(rerank);
return result;
}
}
}

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<KMVersion>0.71.240820.1</KMVersion>
<NewtonsoftVersion>13.0.3</NewtonsoftVersion>
<RestSharpVersion>111.4.1</RestSharpVersion>
<RestSharpVersion>112.1.0</RestSharpVersion>
<SKVersion>1.17.2</SKVersion>
</PropertyGroup>
</Project>