Giter Site home page Giter Site logo

aidotnet / antsk Goto Github PK

View Code? Open in Web Editor NEW
1.0K 11.0 137.0 28.61 MB

基于.Net8+AntBlazor+SemanticKernel 和KernelMemory 打造的AI知识库/智能体,支持本地离线AI大模型。可以不联网离线运行。支持aspire观测应用数据

Home Page: https://antsk.cn

License: Apache License 2.0

Dockerfile 0.06% C# 36.25% HTML 13.13% CSS 3.21% JavaScript 0.83% Python 46.51%
semantickernel dotnet ai kernelmemory rag

antsk's People

Contributors

duyanming avatar elderjames avatar intptrmax avatar itchangc avatar jeffersyuan1976 avatar loganchi avatar longdream avatar longdream163 avatar wmchuang avatar xuzeyu91 avatar yc-2503 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

antsk's Issues

我本地通过One-Api配置了通义千问,通过Postman可以正常返回,使用AntSk尝试聊天却没有任何响应

以下是我的配置参数:
"OpenAIOption": {
"EndPoint": "http://localhost:3000/v1/chat/completions",
"Key": "sk-998bc3456ce24c1fb5bf938d0666fxxx",
"Model": "qwen-turbo",
"EmbeddingModel": "qwen-turbo"
},
请问上述配置有问题吗?为什么运行程序后,在聊天界面输入聊天内容后,就卡死了,长时间没有任何响应。
image

选择的应用为会话应用类型。
谢谢!

一定要openai的key吗,如果只跑本地模型呢

现在只跑本地模型,配置了
"LLamaSharp": {
"Chat": "D:\Code\LLamaSharp-master\models\ggml-model-q2_k.gguf",
"Embedding": "D:\Code\LLamaSharp-master\models\ggml-model-q2_k.gguf"
}
但是程序跑起来后发送请求就抛出异常,提示没有 openai的key
image
你文档说如果跑本地模型,这里可以乱填的

能加一个对导入的文档做关键信息提取吗

目前只有对文档的聊天问答,导入的相似文档一多,然后答案就一大堆了,还得人为去甄别这些答案的真伪,如果能定义一些提取的关键字的模板,然后用这些模板去对文档做信息提取,针对每个文档都有一份它自己的摘要或者关键信息,这样查某个文档里的关键内容就更加准确和方便了

expected 2048 dimensions, not 1024

llama_new_context_with_model: graph splits (measure): 1
fail: Microsoft.KernelMemory.Postgres.PostgresMemory[0]
DB error upserting record
Npgsql.PostgresException (0x80004005): 22000: expected 2048 dimensions, not 1024
at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.UpsertAsync(String tableName, PostgresMemoryRecord record, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.UpsertAsync(String tableName, PostgresMemoryRecord record, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Postgres.PostgresMemory.UpsertAsync(String index, MemoryRecord record, CancellationToken cancellationToken)
Exception data:
Severity: 错误
SqlState: 22000
MessageText: expected 2048 dimensions, not 1024
File: vector.c
Line: 66
Routine: CheckExpectedDim
fail: Microsoft.KernelMemory.Pipeline.BaseOrchestrator[0]
Pipeline start failed
Npgsql.PostgresException (0x80004005): 22000: expected 2048 dimensions, not 1024
at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.UpsertAsync(String tableName, PostgresMemoryRecord record, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.UpsertAsync(String tableName, PostgresMemoryRecord record, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Postgres.PostgresMemory.UpsertAsync(String index, MemoryRecord record, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Handlers.SaveRecordsHandler.SaveEmbeddingsAsync(DataPipeline pipeline, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Handlers.SaveRecordsHandler.InvokeAsync(DataPipeline pipeline, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Pipeline.InProcessPipelineOrchestrator.RunPipelineAsync(DataPipeline pipeline, CancellationToken cancellationToken)
at Microsoft.KernelMemory.Pipeline.BaseOrchestrator.ImportDocumentAsync(String index, DocumentUploadRequest uploadRequest, CancellationToken cancellationToken)

添加星火大模型后,列表不对

添加星火大模型后,在模型列表里面模型地址和模型名显示不对,显示的是appid和appkey,这个几不安全,希望尽快修复。。。。。。。。。。

Setting-ModelList错误

1、在AddModel的时候,判定模型存不存在的时候,需要过滤当前数据本身(update)。
AddModel-HandleSubmit

        if (_aimodels_Repositories.IsAny(p => p.AIModelType == _aiModel.AIModelType && p.EndPoint == _aiModel.EndPoint.ConvertToString() && p.ModelKey == _aiModel.ModelKey && p.ModelName == _aiModel.ModelName && p.Id != ModelId)) {
            _ = Message.Error("模型已存在!", 2);
            return;
        }

2、获取模型存放路径,当路径文件不存在时,建议增加默认路径
_modelFiles = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), LLamaSharpOption.FileDirectory));
if (!string.IsNullOrEmpty(ModelPath)) {
_aiModel.AIType = Domain.Model.Enum.AIType.LLamaSharp;
_downloadModalVisible = true;

                _downloadUrl = $"https://hf-mirror.com{ModelPath.Replace("---", "/")}";
            }

3、比较期待新的function的能力,以及通过function实现planner的编排。

代码编译报错

代码下载来之后,编译报错了

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 CS0115 “AppList.OnInitializedAsync()”: 没有找到适合的方法来重写 AntSK D:\Code\AntSK-main\AntSK\Pages\AppPage\AppList.razor.cs 29 活动

一堆的这个错误

知识库连续上传文件会导致程序崩溃

首次启动程序上传一个txt程序正常
1.第二次接着上传一个或批量上传docx文件,控制台过了一会就直接停止了服务,页面就卡在那

image

2.有时候上传docx文件的时候页面直接卡死,控制台有反应。但实际文件路劲下有文件,数据库未存进去

image

3.登录之后不管在哪个页面只要刷新之后立马就退出登录了

4.小问题,样式问题,嘿嘿,新增模型写了新增用户

image

5.当我对本地知识库进行第二次提问就开始报错,只能程序启动后提问一次

image
image

wrong parameters in SparkDeskTextCompletion

there is a obvious error in SparkDeskTextCompletion's GetStreamingTextContentsAsync method:
var functionDefs = functions.Select(func => new FunctionDef(func.Name, func.Description, func.Parameters.Select(p => new FunctionParametersDef(p.Name, p.ParameterType?.IsClass == true ? "object" : "string", func.Description, p.IsRequired)).ToList())).ToList();

func.Description should be p.Description,otherwise the parameters description will be same as the method's description

AzureOpenAI的参数未经过调用

1、AzureOpenAI的调用参数需要调整
memory.WithAzureOpenAITextEmbeddingGeneration(new AzureOpenAIConfig() {
APIKey = embedModel.ModelKey,
Deployment = embedModel.ModelName,
Endpoint = embedModel.EndPoint,
Auth = AzureOpenAIConfig.AuthTypes.APIKey,
APIType = AzureOpenAIConfig.APITypes.EmbeddingGeneration,
}, null, null, false, embeddingHttpClient);
需要指定Auth类型为ApiKey,否则会报错。

2、在KMService中, chatmodel与enbedModel在前端设置的时候需要更清晰的引导
//加载huihu 模型
BuildTextGenerationByAIType(memory, chatModel, chatHttpClient);
//加载向量模型
BuildTextEmbeddingGenerationByAIType(memory, embedModel, embeddingHttpClient);

添加“知识库”报错,该控件数据类型绑定错误调整后修复该问题。

      <FormItem Label="最低相似度(%)" LabelCol="LayoutModel._formItemLayout.LabelCol" WrapperCol="LayoutModel._formItemLayout.WrapperCol">
          <Slider TValue="double" Style="display: inline-block;width: 300px; " Min="0" Max="100" DefaultValue="70" @bind-Value="@context.Relevance" />
      </FormItem>
    /// <summary>
    /// 相似度
    /// </summary>
    [SugarColumn(DefaultValue = "70")]
    public double Relevance { get; set; } = 70;

报错:END CONTENT TO SUMMARIZE

END CONTENT TO SUMMARIZE.

Summarize the conversation in 'CONTENT TO SUMMARIZE', identifying main points of discussion and any conclusions that were reached.
Do not incorporate other general knowledge.
Summary is in plain text, in complete sentences, with no markup or tags.

BEGIN SUMMARY:

image

聊天,第二次就抛出这个异常,然后就答非所问,换了几个不同的模型也是这个问题

关于使用自定义模板导入excel到知识库的建议

目前项目中的excel导入需要有ExeclPropertyAttribute属性的字段的类,只能导入问题/回答这种模板的,目前自己尝试了一下使用ExcelToDataTable再转为List,然后存入知识库的情况

public static List<string> ExcelToStringList(Stream stream)
{
    var dataTable = ExcelToDataTable(stream,true);
    List<string> stringList = new List<string>();

    foreach (DataRow row in dataTable.Rows)
    {
        string rowData = "";

        foreach (DataColumn column in dataTable.Columns)
        {
            // 拼接列名和对应值
            rowData += $"{column.ColumnName}: {row[column]} ";
        }

        stringList.Add(rowData.Trim());
    }

    return stringList;
}
case ImportType.Excel:
    using (var fs = File.OpenRead(req.FilePath))
    {
        var excelList= ExeclHelper.ExcelToStringList(fs);
        
        _memory.Orchestrator.AddHandler<TextExtractionHandler>("extract_text");
        _memory.Orchestrator.AddHandler<KMExcelHandler>("antsk_excel_split");
        _memory.Orchestrator.AddHandler<GenerateEmbeddingsHandler>("generate_embeddings");
        _memory.Orchestrator.AddHandler<SaveRecordsHandler>("save_memory_records");

        StringBuilder text = new StringBuilder();
        foreach (var item in excelList)
        {
           //这里直接使用字符串拼接切割符号
            text.AppendLine(@$"{item}{KmsConstantcs.KMExcelSplit}");                            
        }
        var importResult = _memory.ImportTextAsync(text.ToString(), fileid, new TagCollection() { { KmsConstantcs.KmsIdTag, req.KmsId } }
              , index: KmsConstantcs.KmsIndex,
              steps: new[]
              {
                    "extract_text",
                    "antsk_excel_split",
                    "generate_embeddings",
                    "save_memory_records"
              }
              ).Result;
        req.KmsDetail.FileName = req.FileName;
        string fileGuidName = Path.GetFileName(req.FilePath);
        req.KmsDetail.FileGuidName = fileGuidName;
        req.KmsDetail.DataCount = excelList.Count();
    }                        
    break;

image
希望您能给我一些建议,希望这有帮助

我用DOCKER安装好后说数据连不上

Unhandled exception. SqlSugar.SqlSugarException: 中文提示 : 连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,错误信息:Host can't be null.
English Message : Connection open error . Host can't be null
at SqlSugar.Check.Exception(Boolean isException, String message, String[] args)
at SqlSugar.PostgreSQLProvider.get_Connection()
at SqlSugar.DbMaintenanceProvider.CreateDatabase(String databaseDirectory)
at Program.<

$>g__InitDB|0_5(WebApplication app) in /src/AntSK/Program.cs:line 118
at Program.$(String[] args) in /src/AntSK/Program.cs:line 95
请问我在那里修改

请问我下载和安装antsk如何正常显示知识库页面?

我下载了antsk,并且编译成功。下载安装了postgresql。下载了tinyllama-1.1b-chat-v1.0.Q8_0.gguf,修改了配置文件,成功运行了antsk.exe。现在问题是:
1、访问http://localhost:5000/,会跳转到http://localhost:5000/user/login,但是样式显示有点不正常,而且没有登录用户的地方。
2、不能访问:https://localhost:5001/llama/,不能正常显示你的知识库的页面。
请问如何正常安装和配置antsk。
我的配置文件如下:
appsettings.json

使用PG向量库,知识库导入文本报错 dimensions for type vector must be at least 1

Microsoft.KernelMemory.Postgres.PostgresMemory[0]
Table 'public."km-kms"' creation error: Npgsql.PostgresException (0x80004005): 22023: dimensions for type vector must be at least 1

  POSITION: 141
     at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
     at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
     at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
     at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
     at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.CreateTableAsync(String tableName, Int32 vectorSize, CancellationToken cancellationToken)
     at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.CreateTableAsync(String tableName, Int32 vectorSize, CancellationToken cancellationToken)
    Exception data:
      Severity: ERROR
      SqlState: 22023
      MessageText: dimensions for type vector must be at least 1
      Position: 141
      File: vector.c
      Line: 356
      Routine: vector_typmod_in. Err: 22023: dimensions for type vector must be at least 1

  POSITION: 141. InnerEx: (null)
  Npgsql.PostgresException (0x80004005): 22023: dimensions for type vector must be at least 1

  POSITION: 141
     at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
     at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
     at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
     at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
     at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.CreateTableAsync(String tableName, Int32 vectorSize, CancellationToken cancellationToken)
     at Microsoft.KernelMemory.Postgres.Db.PostgresDbClient.CreateTableAsync(String tableName, Int32 vectorSize, CancellationToken cancellationToken)
    Exception data:
      Severity: ERROR
      SqlState: 22023
      MessageText: dimensions for type vector must be at least 1
      Position: 141
      File: vector.c
      Line: 356
      Routine: vector_typmod_in

启动后样式找不到

image image

项目自己搭建环境,不是用compose启动的,启动后样式找不到
不知启动步骤是否有误,操作步骤如下
cd AntSK/AntSK
dotnet run

自有知识的导入

请问自有知识导入后,本系统的查询和一般的文档搜索相比,有什么巨大提升吗?

麻烦提供一下模型gguf文件下载链接

能不能发一下,你的模型的gguf文件下载链接。
我使用我下载的模型tinyllama-1.1b-chat-v1.0.Q8_0.gguf,对话得到的结果很不理想,上传知识库文档也会报错。
answer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.