Compare commits

...

13 Commits

Author SHA1 Message Date
zyxucp
21efcf2479 update 复制 2024-07-03 13:07:26 +08:00
zyxucp
0dc7bfcadb add 延迟 2024-07-01 17:10:24 +08:00
zyxucp
22d99091e1 fix string += 2024-07-01 11:52:18 +08:00
zyxucp
7558d3ffdc add ollama modellist 2024-06-30 18:51:01 +08:00
zyxucp
85ae41c44c add utf8 2024-06-30 18:43:48 +08:00
zyxucp
91193850dd fxi 2024-06-30 18:32:58 +08:00
zyxucp
7cc04e3364 add 处理代码 2024-06-30 17:55:19 +08:00
zyxucp
3da28090c6 fix 处理代码最后逻辑 2024-06-30 17:46:58 +08:00
zyxucp
1595ef2c0a Merge branch 'main' of github.com:AIDotNet/AntSK 2024-06-30 17:30:37 +08:00
zyxucp
83e3d81de7 fix markdown 2024-06-30 17:30:26 +08:00
zyxucp
18437ddda4 Update README.zh.md 2024-06-30 17:22:29 +08:00
zyxucp
fd503171a1 Update README.md 2024-06-30 17:22:04 +08:00
zyxucp
7022139780 update docker file and yaml 2024-06-30 17:15:06 +08:00
10 changed files with 55 additions and 49 deletions

View File

@@ -1,8 +1,4 @@
# 1. Define the Python image to use for getting pip
FROM pytorch/pytorch AS python-base
# 2. Define the .NET SDK image to build your application
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["src/AntSK/AntSK.csproj", "AntSK/"]
RUN dotnet restore "AntSK/AntSK.csproj"
@@ -11,19 +7,11 @@ WORKDIR "/src/AntSK"
RUN dotnet build "AntSK.csproj" -c Release -o /app/build
RUN dotnet publish "AntSK.csproj" -c Release -o /app/publish
# 3. Define the final image that will contain both .NET runtime and Python
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
# Copy the Python/pip installation from the official Python image
COPY --from=python-base /usr/local /usr/local
COPY --from=python-base /opt/conda/ /opt/conda/
FROM registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk-base:v1.0.0 AS final
WORKDIR /app
COPY --from=build /app/publish .
# Make sure the app and Python directories are in PATH
ENV PATH="/app:/opt/conda/bin:/usr/local/bin:${PATH}"
ENV PATH="/app:/opt/conda/bin:/usr/local/bin:${PATH}"
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN apt update && apt install -y libpugixml-dev libtbb-dev
ENTRYPOINT ["dotnet", "AntSK.dll"]

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**.
- **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**.
- **Domestic Innovation**: AntSK supports domestic models and databases and can run under domestic innovation conditions.

View File

@@ -22,7 +22,7 @@
- **联网搜索**AntSK实时获取最新信息确保用户接受到的资料总是最及时、最相关的。
- **模型管理**:适配和管理集成不同厂商的不同模型。并且支持**llama.cpp**所支持的gguf类型以及**llamafactory**所支持的模型离线运行
- **模型管理**:适配和管理集成不同厂商的不同模型。并且支持**llama.cpp**所支持的gguf类型以及**llamafactory****ollama** 所支持的模型离线运行
- **国产信创**AntSK支持国产模型和国产数据库可以在信创条件下运行

View File

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

View File

@@ -32,9 +32,9 @@ services:
- ./pg/data:/var/lib/postgresql/data
antsk:
container_name: antsk
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.4.1
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.4.3
# 如果需要pytorch环境需要使用下面这个镜像镜像比较大
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.4.1
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.4.3
ports:
- 5000:5000
networks:

View File

@@ -19,6 +19,7 @@ using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Text;
namespace AntSK.Pages.ChatPage.Components
{
@@ -82,6 +83,7 @@ namespace AntSK.Pages.ChatPage.Components
var userSession = userSessionStorageResult.Success ? userSessionStorageResult.Value : null;
_userName = userSession?.UserName;
await GetMsgList();
await MarkDown();
}
/// <summary>
/// 获取聊天记录列表
@@ -323,16 +325,16 @@ namespace AntSK.Pages.ChatPage.Components
};
MessageList.Add(info);
var chatResult = _chatService.SendKmsByAppAsync(app, questions, history, filePath, _relevantSources);
var rawContent = string.Empty;
StringBuilder rawContent = new StringBuilder();
await foreach (var content in chatResult)
{
rawContent+=content.ConvertToString();
info.Context=Markdown.ToHtml(rawContent);
//await Task.Delay(50);
rawContent.Append(content.ConvertToString());
info.Context = Markdown.ToHtml(rawContent.ToString());
await Task.Delay(30);
await InvokeAsync(StateHasChanged);
}
//全部处理完后再处理一次Markdown
//await MarkDown(info);
//全部处理完后再处理一次Markdown 处理代码高亮
await MarkDown();
}
/// <summary>
@@ -345,12 +347,12 @@ namespace AntSK.Pages.ChatPage.Components
{
Chats info = null;
var chatResult = _chatService.SendChatByAppAsync(app, history);
var rawContent=string.Empty;
StringBuilder rawContent = new StringBuilder();
await foreach (var content in chatResult)
{
if (info == null)
{
rawContent=content.ConvertToString();
rawContent.Append(content.ConvertToString());
info = new Chats();
info.Id = Guid.NewGuid().ToString();
info.UserName = _userName;
@@ -362,14 +364,14 @@ namespace AntSK.Pages.ChatPage.Components
}
else
{
rawContent+=content.ConvertToString();
rawContent.Append(content.ConvertToString());
}
info.Context = Markdown.ToHtml(rawContent);
//await Task.Delay(50);
info.Context = Markdown.ToHtml(rawContent.ToString());
await Task.Delay(30);
await InvokeAsync(StateHasChanged);
}
//全部处理完后再处理一次Markdown
//await MarkDown(info);
//全部处理完后再处理一次Markdown 处理代码高亮
await MarkDown();
}
/// <summary>
@@ -377,14 +379,8 @@ namespace AntSK.Pages.ChatPage.Components
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private async Task MarkDown(Chats info)
private async Task MarkDown()
{
if (info.IsNotNull())
{
// info!.HtmlAnswers = markdown.Transform(info.HtmlAnswers);
info!.Context = Markdown.ToHtml(info.Context);
}
await InvokeAsync(StateHasChanged);
await _JSRuntime.InvokeVoidAsync("Prism.highlightAll");
await _JSRuntime.ScrollToBottomAsync("scrollDiv");

View File

@@ -243,7 +243,7 @@ namespace AntSK.Pages.Setting.AIModel
{
if (string.IsNullOrEmpty(value))
{
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList(); ;
ollamaModelList = File.ReadAllLines(Path.Combine(AppContext.BaseDirectory, "OllamaModelList.txt")).ToList();
}
else
{

View File

@@ -95,7 +95,7 @@ namespace AntSK.Services.OpenApi
private async Task SendChatStream(HttpContext HttpContext, OpenAIStreamResult result, Apps app, ChatHistory history)
{
HttpContext.Response.Headers.Add("Content-Type", "text/event-stream");
HttpContext.Response.Headers.Add("Content-Type", "text/event-stream;charset=utf-8");
var chatResult = _chatService.SendChatByAppAsync(app, history);
await foreach (var content in chatResult)
{
@@ -165,7 +165,7 @@ namespace AntSK.Services.OpenApi
private async Task SendKmsStream(HttpContext HttpContext, OpenAIStreamResult result, Apps app, string questions,ChatHistory history)
{
HttpContext.Response.Headers.Add("Content-Type", "text/event-stream");
HttpContext.Response.Headers.Add("Content-Type", "text/event-stream;charset=utf-8");
var chatResult = _chatService.SendKmsByAppAsync(app, questions, history, "");
int i = 0;
await foreach (var content in chatResult)

View File

@@ -18,7 +18,7 @@
<ItemGroup>
<None Update="OllamaModelList.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="StableDiffusion\Backend\CPU\stable-diffusion.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -45,7 +45,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="StableDiffusionModelList.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

View File

@@ -4,9 +4,17 @@ gemma:2b
gemma:7b
llama3
llama3:70b
llama2
llama2-chinese
yi
llama2:7b
llama2:13b
llama2:70b
llama2-chinese:7b
llama2-chinese:13b
llama2-uncensored
codellama:7b
codellama:13b
codellama:34b
codellama:70b
yi:6b
yi:9B
yi:34B
qwen2:0.5b
@@ -31,4 +39,18 @@ mixtral:8x7b
llava
tinyllama
openchat
deepseek-coder-v2
deepseek-coder-v2:236b
mistral
codegemma:7b
codegemma:2b
command-r:35b
command-r-plus:104b
deepseek-coder:1.3b
deepseek-coder:6.7b
deepseek-coder:33b
moondream
neural-chat
starling-lm
solar