From b84f252f2f545b99cca760bc590060aa2359dcb5 Mon Sep 17 00:00:00 2001 From: zyxucp <286513187@qq.com> Date: Thu, 23 May 2024 14:17:54 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 215 ---------------------------------------------- README.md | 219 ++++++++++++++++++++++------------------------- README.zh.md | 234 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 334 insertions(+), 334 deletions(-) delete mode 100644 README.en.md create mode 100644 README.zh.md diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 3118601..0000000 --- a/README.en.md +++ /dev/null @@ -1,215 +0,0 @@ -[简体中文](./README.md) | English -# AntSK -## AI Knowledge Base/Intelligent Agent built on .Net8+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, including gguf types supported by **llama.cpp** and models offline running supported by **llamafactory**. - -- **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://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.1.5ports: - - 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: -``` -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 -``` - -## 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-" - }, - "LLamaSharp": { - "RunType": "GPU", - "FileDirectory": "D:\\Code\\AI\\AntBlazor\\model\\" - }, - "Login": { - "User": "admin", - "Password": "xuzeyu" - }, - "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 execution options: GPU and CPU. When using the online API, any option can be used. -LLamaSharp.RunType - -//Local model path, used for quick selection of models under llama, as well as saving downloaded models. -LLamaSharp.FileDirectory - -//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. -``` - -## 🤝 Contributing - -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/AIDotNet/AntSK/pulls) - -If you would like to contribute, feel free to create a [Pull Request](https://github.com/AIDotNet/AntSK/pulls), or give us [Bug Report](https://github.com/AIDotNet/AntSK/issues/new). - - -## 💕 Contributors - -This project exists thanks to all the people who contribute. - - - - - -## 🚨 Use Protocol -This warehouse follows the [Apache-2.0 License]( https://github.com/AIDotNet/AntSK?tab=Apache -2.0-1-ov file) open source protocol. -The Apache open source license allows the use of AntSK in commercial environments, provided that the license terms are followed. One of the main terms is to retain the copyright and license statements. -If you plan to use AntSK in commercial projects, you need to ensure that you follow the following steps: -1. Copyright statement containing Apache license. [Apache-2.0 License]( https://github.com/AIDotNet/AntSK?tab=Apache -2.0-1-ov file). -2. If you modify the software source code, you need to clearly indicate these modifications in the source code. - -## ☎️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. -![Official WeChat Account](https://github.com/AIDotNet/Avalonia-Assistant/blob/main/img/gzh.jpg) - ---- - -We appreciate your interest in **AntSK** and look forward to collaborating with you to create an intelligent future! diff --git a/README.md b/README.md index 78786b8..312459a 100644 --- a/README.md +++ b/README.md @@ -1,100 +1,90 @@ -中文|[English](https://github.com/AIDotNet/AntSK/blob/main/README.en.md) +[简体中文](./README.zh.md) | English # AntSK -## 使用.Net8+Blazor+SemanticKernel 打造的AI知识库/智能体 +## AI Knowledge Base/Intelligent Agent built on .Net8+AntBlazor+SemanticKernel -## ⭐核心功能 +## ⭐Core Features -- **语义内核 (Semantic Kernel)**:采用领先的自然语言处理技术,准确理解、处理和响应复杂的语义查询,为用户提供精确的信息检索和推荐服务。 +- **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)**:具备持续学习和存储知识点的能力,AntSK 拥有长期记忆功能,累积经验,提供更个性化的交互体验。 +- **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. -- **知识库**:通过文档(Word、PDF、Excel、Txt、Markdown、Json、PPT)等形式导入知识库,可以进行知识库问答,支持本地bge-embedding 向量模型 ,以及bge-rerank 重排模型。 +- **Knowledge Base**: Import knowledge base through documents (Word, PDF, Excel, Txt, Markdown, Json, PPT) and perform knowledge base Q&A. -- **文生图**:集成**StableDiffusion** 本地模型,可以进行文生图。 +- **GPT Generation**: This platform supports creating personalized GPT models, enabling users to build their own GPT models. -- **GPTs 生成**:此平台支持创建个性化的GPT模型,尝试构建您自己的GPT模型。 +- **API Interface Publishing**: Exposes internal functions in the form of APIs, enabling developers to integrate AntSK into other applications and enhance application intelligence. -- **API接口发布**:将内部功能以API的形式对外提供,便于开发者将AntSK 集成进其他应用,增强应用智慧。 +- **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. -- **.Net插件系统**:开放式dll插件系统,允许第三方开发者或服务商轻松将其业务功能通过标准格式的代码生成dll后集成到AntSK,不断增强应用功能。 +- **Online Search**: AntSK, real-time access to the latest information, ensuring users receive the most timely and relevant data. -- **联网搜索**:AntSK,实时获取最新信息,确保用户接受到的资料总是最及时、最相关的。 +- **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**. -- **模型管理**:适配和管理集成不同厂商的不同模型。并且支持**llama.cpp**所支持的gguf类型,以及**llamafactory**所支持的模型离线运行 +- **Domestic Innovation**: AntSK supports domestic models and databases and can run under domestic innovation conditions. -- **国产信创**:AntSK支持国产模型,和国产数据库,可以在信创条件下运行 +- **Model Fine-Tuning**: Planned based on llamafactory for model fine-tuning. -- **模型微调**:规划中,基于llamafactory进行模型微调 - +## ⛪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 -AntSK 适用于多种业务场景,例如: -- 企业级知识管理系统 -- 自动客服与聊天机器人 -- 企业级搜索引擎 -- 个性化推荐系统 -- 智能辅助写作 -- 教育与在线学习平台 -- 其他有意思的AI App +## ✏️Function Examples +### Online Demo +[document](http://antsk.cn/) -## ✏️功能示例 -### 在线演示 - -[文档地址](http://antsk.cn/) - -[体验地址](https://antsk.ai-dotnet.com/) +[demo](https://antsk.ai-dotnet.com/) ``` -默认账号:test +Default account: test -默认密码: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. ``` -### 其他功能示例 -[视频示例](https://www.bilibili.com/video/BV1zH4y1h7Y9/) +### Other Function Examples +[Video Demonstration](https://www.bilibili.com/video/BV1zH4y1h7Y9/) -[在线文档:http://antsk.cn](http://antsk.cn) +## ❓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. -在这里我使用的是Postgres 作为数据存储和向量存储,因为Semantic Kernel和Kernel Memory都支持他,当然你也可以换成其他的。 +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. -模型默认支持openai、azure openai、讯飞星火、阿里云积、 和llama支持的gguf本地模型 以及llamafactory的本地模型,如果需要使用其他模型,可以使用one-api进行集成。 +The Login configuration in the configuration file is the default login account and password. -配置文件中的Login配置是默认的登录账号和密码 +The following configuration file needs to be configured -需要配置如下的配置文件 +## 1️⃣Using docker-compose -## 1️⃣使用docker-compose +Provided the pg version **appsettings.json** and simplified version (Sqlite+disk) **docker-compose.simple.yml** -提供了pg版本 **appsettings.json** 和 简化版本(**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. -从项目根目录下载**docker-compose.yml**,然后把配置文件**appsettings.json**和它放在统一目录, +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. -这里已经把pg的镜像做好了。在docker-compose.yml中可以修改默认账号密码,然后你的**appsettings.json**的数据库连接需要保持一致。 - -然后你可以进入到目录后执行 +Then you can execute the following command in the directory to start AntSK ``` docker-compose up -d ``` -来启动AntSK -## 2️⃣如何在docker中挂载本地模型,和模型下载的目录 +## 2️⃣How to mount local models and model download directory in docker ``` -# 非 host 版本, 不使用本机代理 +# 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.3.1 - ports: + image: registry.cn-hangzhou.aliyuncs.com/AIDotNet/antsk:v0.1.5ports: - 5000:5000 networks: - antsk @@ -104,31 +94,30 @@ services: environment: - ASPNETCORE_URLS=http://*:5000 volumes: - - ./appsettings.json:/app/appsettings.json # 本地配置文件 需要放在同级目录 + - ./appsettings.json:/app/appsettings.json # Local configuration file needs to be placed in the same directory - D://model:/app/model - - D://model:/root/.cache/modelscope/hub/AI-ModelScope #使用Llamafactory时需要挂载 否则初始化的环境重启后会丢失 networks: antsk: ``` -以这个为示例,意思是把windows本地D://model的文件夹挂载进 容器内/app/model 如果是这样你的appsettings.json中的模型地址应该配置为 +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 ``` -## 3️⃣配置文件的一些含义 +## 3️⃣Some meanings of configuration file ``` { "DBConnection": { - "DbType": "Sqlite", + "DbType": "Sqlite", "ConnectionStrings": "Data Source=AntSK.db;" }, "KernelMemory": { - "VectorDb": "Disk", + "VectorDb": "Disk", "ConnectionString": "Host=;Port=;Database=antsk;Username=;Password=", "TableNamePrefix": "km-" }, "LLamaSharp": { - "RunType": "GPU", + "RunType": "GPU", "FileDirectory": "D:\\Code\\AI\\AntBlazor\\model\\" }, "Login": { @@ -143,92 +132,84 @@ model/xxx.gguf } ``` ``` -//支持多种数据库,具体可以查看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 +// 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 -//连接字符串,需要根据不同DB类型,用对应的字符串 + +// Connection string, need to use the corresponding string according to the different DB types DBConnection.ConnectionStrings -//向量存储的类型,支持 Postgres、Disk、Memory、Qdrant、Redis、AzureAISearch -//Postgres、Redis需要配置 ConnectionString -//Qdrant 和AzureAISearch 的 ConnectionString 使用 Endpoint|APIKey +//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 -//本地模型使用的运行方式 GUP CPU ,如果用在线API 这个随意使用一个即可 +//Local model execution options: GPU and CPU. When using the online API, any option can be used. LLamaSharp.RunType -//本地模型路径,用于在选择llama时可以快速选择目录下的模型,以及保存下载的模型 +//Local model path, used for quick selection of models under llama, as well as saving downloaded models. LLamaSharp.FileDirectory -//默认管理员账号密码 +//Default admin account password Login -//导入异步处理的线程数,使用在线API可以高一点,本地模型建议1 否则容易内存溢出崩掉 + +//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 + ``` -## ⚠️找不到样式问题解决: -AntSK/src/AntSK下执行: +## ⚠️Fixing Style Issues: +Run the following in AntSK/src/AntSK: ``` dotnet clean dotnet build dotnet publish "AntSK.csproj" ``` -再去AntSK/src/AntSK/bin/Release/net8.0/publish下 +Then navigate to AntSK/src/AntSK/bin/Release/net8.0/publish and run: ``` dotnet AntSK.dll ``` -然后启动就有样式了 +The styles should now be applied after starting. -DB我使用的是CodeFirst模式,只要配置好数据库链接,表结构是自动创建的 +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. -## ✔️使用llamafactory +## ✔️Using 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具有模型微调的能力,这也是我们下一步需要重点集成的部分。 +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. ``` -## 🤝 贡献 +## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/AIDotNet/AntSK/pulls) - -如果你想贡献,可以创建一个[拉取请求](https://github.com/AIDotNet/AntSK/pulls), 或给我们[错误报告](https://github.com/AIDotNet/AntSK/issues/new). - - -## 💕 贡献者 -这个项目的存在要感谢所有的贡献者。 - +If you would like to contribute, feel free to create a [Pull Request](https://github.com/AIDotNet/AntSK/pulls), or give us [Bug Report](https://github.com/AIDotNet/AntSK/issues/new). + + +## 💕 Contributors + +This project exists thanks to all the people who contribute. + - - - -## 🚨 使用协议 - -本仓库遵循 [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 开源协议。 -Apache开源许可证允许在商业环境中使用AntSK,前提是需要遵守许可证的条款。主要条款之一是要保留版权声明和许可证声明。 - -如果您打算在商业项目中使用AntSK,您需要确保遵守以下步骤: - -1、包含Apache许可证的版权声明。 [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 。 - -2、如果您修改了软件源代码,您需要在源代码中明确标明这些修改。 - - -## ☎️联系我 -如有任何问题或建议,请通过以下方式关注我的公众号《许泽宇的技术分享》,发消息与我联系,我们也有AIDotnet交流群,可以发送进群等消息,然后我会拉你进交流群 -![公众号](https://github.com/AIDotNet/AntSK/blob/main/images/gzh.jpg) - -## 🌟 Star History - - - - - Star History Chart - + +## 🚨 Use Protocol +This warehouse follows the [Apache-2.0 License]( https://github.com/AIDotNet/AntSK?tab=Apache -2.0-1-ov file) open source protocol. +The Apache open source license allows the use of AntSK in commercial environments, provided that the license terms are followed. One of the main terms is to retain the copyright and license statements. +If you plan to use AntSK in commercial projects, you need to ensure that you follow the following steps: +1. Copyright statement containing Apache license. [Apache-2.0 License]( https://github.com/AIDotNet/AntSK?tab=Apache -2.0-1-ov file). +2. If you modify the software source code, you need to clearly indicate these modifications in the source code. + +## ☎️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. +![Official WeChat Account](https://github.com/AIDotNet/Avalonia-Assistant/blob/main/img/gzh.jpg) + +--- + +We appreciate your interest in **AntSK** and look forward to collaborating with you to create an intelligent future! diff --git a/README.zh.md b/README.zh.md new file mode 100644 index 0000000..0adaa4d --- /dev/null +++ b/README.zh.md @@ -0,0 +1,234 @@ +中文|[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**所支持的模型离线运行 + +- **国产信创**:AntSK支持国产模型,和国产数据库,可以在信创条件下运行 + +- **模型微调**:规划中,基于llamafactory进行模型微调 + + +## ⛪应用场景 + +AntSK 适用于多种业务场景,例如: +- 企业级知识管理系统 +- 自动客服与聊天机器人 +- 企业级搜索引擎 +- 个性化推荐系统 +- 智能辅助写作 +- 教育与在线学习平台 +- 其他有意思的AI App + +## ✏️功能示例 +### 在线演示 + +[文档地址](http://antsk.cn/) + +[体验地址](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中的模型地址应该配置为 +``` +model/xxx.gguf +``` + +## 3️⃣配置文件的一些含义 +``` +{ + "DBConnection": { + "DbType": "Sqlite", + "ConnectionStrings": "Data Source=AntSK.db;" + }, + "KernelMemory": { + "VectorDb": "Disk", + "ConnectionString": "Host=;Port=;Database=antsk;Username=;Password=", + "TableNamePrefix": "km-" + }, + "LLamaSharp": { + "RunType": "GPU", + "FileDirectory": "D:\\Code\\AI\\AntBlazor\\model\\" + }, + "Login": { + "User": "admin", + "Password": "xuzeyu" + }, + "BackgroundTaskBroker": { + "ImportKMSTask": { + "WorkerCount": 1 + } + } +} +``` +``` +//支持多种数据库,具体可以查看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 +//连接字符串,需要根据不同DB类型,用对应的字符串 +DBConnection.ConnectionStrings + +//向量存储的类型,支持 Postgres、Disk、Memory、Qdrant、Redis、AzureAISearch +//Postgres、Redis需要配置 ConnectionString +//Qdrant 和AzureAISearch 的 ConnectionString 使用 Endpoint|APIKey +KernelMemory.VectorDb + +//本地模型使用的运行方式 GUP CPU ,如果用在线API 这个随意使用一个即可 +LLamaSharp.RunType + +//本地模型路径,用于在选择llama时可以快速选择目录下的模型,以及保存下载的模型 +LLamaSharp.FileDirectory + +//默认管理员账号密码 +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具有模型微调的能力,这也是我们下一步需要重点集成的部分。 +``` + +## 🤝 贡献 + +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/AIDotNet/AntSK/pulls) + +如果你想贡献,可以创建一个[拉取请求](https://github.com/AIDotNet/AntSK/pulls), 或给我们[错误报告](https://github.com/AIDotNet/AntSK/issues/new). + + +## 💕 贡献者 + +这个项目的存在要感谢所有的贡献者。 + + + + + +## 🚨 使用协议 + +本仓库遵循 [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 开源协议。 +Apache开源许可证允许在商业环境中使用AntSK,前提是需要遵守许可证的条款。主要条款之一是要保留版权声明和许可证声明。 + +如果您打算在商业项目中使用AntSK,您需要确保遵守以下步骤: + +1、包含Apache许可证的版权声明。 [Apache-2.0 License](https://github.com/AIDotNet/AntSK?tab=Apache-2.0-1-ov-file) 。 + +2、如果您修改了软件源代码,您需要在源代码中明确标明这些修改。 + + +## ☎️联系我 +如有任何问题或建议,请通过以下方式关注我的公众号《许泽宇的技术分享》,发消息与我联系,我们也有AIDotnet交流群,可以发送进群等消息,然后我会拉你进交流群 +![公众号](https://github.com/AIDotNet/AntSK/blob/main/images/gzh.jpg) + +## 🌟 Star History + + + + + Star History Chart + + +