aidotnet / antsk Goto Github PK
View Code? Open in Web Editor NEW基于.Net8+AntBlazor+SemanticKernel 和KernelMemory 打造的AI知识库/智能体,支持本地离线AI大模型。可以不联网离线运行。支持aspire观测应用数据
Home Page: https://antsk.cn
License: Apache License 2.0
基于.Net8+AntBlazor+SemanticKernel 和KernelMemory 打造的AI知识库/智能体,支持本地离线AI大模型。可以不联网离线运行。支持aspire观测应用数据
Home Page: https://antsk.cn
License: Apache License 2.0
边回答问题,滚动条要边向下滚动。不要人工去滚动。
以下是我的配置参数:
"OpenAIOption": {
"EndPoint": "http://localhost:3000/v1/chat/completions",
"Key": "sk-998bc3456ce24c1fb5bf938d0666fxxx",
"Model": "qwen-turbo",
"EmbeddingModel": "qwen-turbo"
},
请问上述配置有问题吗?为什么运行程序后,在聊天界面输入聊天内容后,就卡死了,长时间没有任何响应。
选择的应用为会话应用类型。
谢谢!
目前只有对文档的聊天问答,导入的相似文档一多,然后答案就一大堆了,还得人为去甄别这些答案的真伪,如果能定义一些提取的关键字的模板,然后用这些模板去对文档做信息提取,针对每个文档都有一份它自己的摘要或者关键信息,这样查某个文档里的关键内容就更加准确和方便了
这个版本中用StreamingTextContent替代了StreamingChatMessageContent,想知道两者之间的具体区别和对系统性能的影响,谢谢
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.StateMachineBox
1.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.StateMachineBox
1.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,这个几不安全,希望尽快修复。。。。。。。。。。
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 活动
一堆的这个错误
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
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.
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:
聊天,第二次就抛出这个异常,然后就答非所问,换了几个不同的模型也是这个问题
目前项目中的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;
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.<
我下载了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
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
请问自有知识导入后,本系统的查询和一般的文档搜索相比,有什么巨大提升吗?
[isoftstone软通动力](
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.