mirror of
https://github.com/AIDotNet/AntSK.git
synced 2026-02-21 09:05:35 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
358909892c | ||
|
|
6c1bc4be04 | ||
|
|
431c754f42 | ||
|
|
f46faa7679 | ||
|
|
195053cbd7 | ||
|
|
b41d79c247 | ||
|
|
5acab7a46f | ||
|
|
5b83c844a1 | ||
|
|
2325c58092 | ||
|
|
04d16148b5 | ||
|
|
f0f14889c7 | ||
|
|
dedafdd108 | ||
|
|
fad2b4e733 | ||
|
|
032de7a447 | ||
|
|
cb0df4d4af | ||
|
|
c810f85cea |
@@ -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.
|
||||
|
||||
@@ -101,6 +101,7 @@ 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
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ version: '3.8'
|
||||
services:
|
||||
antsk:
|
||||
container_name: antsk
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.2
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.5
|
||||
# 如果需要pytorch环境需要使用下面这个镜像,镜像比较大
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.2
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.5
|
||||
ports:
|
||||
- 5000:5000
|
||||
networks:
|
||||
|
||||
@@ -32,9 +32,9 @@ services:
|
||||
- ./pg/data:/var/lib/postgresql/data
|
||||
antsk:
|
||||
container_name: antsk
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.2
|
||||
image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:v0.5.5
|
||||
# 如果需要pytorch环境需要使用下面这个镜像,镜像比较大
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.2
|
||||
# image: registry.cn-hangzhou.aliyuncs.com/xuzeyu91/antsk:p0.5.5
|
||||
ports:
|
||||
- 5000:5000
|
||||
networks:
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Amazon.Runtime.Internal.Util;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
85
src/AntSK.Domain/Domain/Model/ResponseResult.cs
Normal file
85
src/AntSK.Domain/Domain/Model/ResponseResult.cs
Normal 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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
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;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace AntSK.Domain.Repositories
|
||||
/// </summary>
|
||||
public bool IsSend { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 创建事件
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,11 @@
|
||||
.ant-card-body {
|
||||
height: 90% !important;
|
||||
}
|
||||
|
||||
.think {
|
||||
color: gray;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 = "初始化";
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user