Skip to content
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Senparc 全家桶的 AI 扩展包,目前主要集中于 LLM(大语言模型
}
```

其中:`AiPlatform` 是平台类型,目前可选值为 `OpenAI`、`NeuCharOpenAI`、`AzureOpenAI`、`HuggingFace` 和 `FastAPI`,分别对应 openai.com 官方接口(OpenAI)、https://www.neuchar.com 由 Senparc 提供的中转接口、基于微软 Azure 的 AzureOpenAI 接口(AOAI)、HuggingFace 接口和 FastAPI 接口,系统会根据配置自动实现切换,无需在逻辑代码中进行判断。
其中:`AiPlatform` 是平台类型,目前可选值为 `OpenAI`、`NeuCharAI`、`AzureOpenAI`、`HuggingFace` 和 `FastAPI`,分别对应 openai.com 官方接口(OpenAI)、https://www.neuchar.com 由 Senparc 提供的中转接口、基于微软 Azure 的 AzureOpenAI 接口(AOAI)、HuggingFace 接口和 FastAPI 接口,系统会根据配置自动实现切换,无需在逻辑代码中进行判断。

仅当 `AiPlatform` 设置为 `OpenAI` 时,才需要设置 `OpenAIKeys` 及以下参数。

仅当 `AiPlatform` 设置为 `NeuCharOpenAI` 时,才需要设置 `NeuCharOpenAIKeys` 及以下参数。
仅当 `AiPlatform` 设置为 `NeuCharAI` 时,才需要设置 `NeuCharAIKeys` 及以下参数。

仅当 `AiPlatform` 设置为 `AzureOpenAI` 时,才需要设置 `AzureOpenAIKeys` 及以下参数。

Expand Down
30 changes: 26 additions & 4 deletions Samples/Senaprc.AI.Samples.Agents/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Senparc.AI.Kernel.Handlers;
using Senparc.AI.Samples.Agents;
using Senparc.CO2NET;
using Senparc.CO2NET.Extensions;
using Senparc.CO2NET.RegisterServices;


Expand Down Expand Up @@ -175,12 +176,33 @@

var aiTeam = graphConnector.CreateAiTeam(admin);

Start:
Console.WriteLine();
Console.WriteLine("Senparc.AI Sample Agnet启动完毕");
Console.WriteLine("开源地址:https://github.com/Senparc/Senparc.AI");
Console.WriteLine("-----------------------");
await Console.Out.WriteLineAsync("任意时间输入 exit 退出对话,并重新开始。");
Console.WriteLine("-----------------------");
Console.WriteLine("正在等待Agent响应...");
Console.WriteLine("-----------------------");

// start the chat
// generate a greeting message to hearing member from Administrator
var greetingMessage = await administrator.SendAsync("你好,如果已经就绪,请告诉我们“已就位”,并和 BA 打个招呼");

await administrator.SendMessageToGroupAsync(
groupChat: aiTeam,
chatHistory: [greetingMessage],
maxRound: 20);
try
{
await administrator.SendMessageToGroupAsync(
groupChat: aiTeam,
chatHistory: [greetingMessage],
maxRound: 20);
}
catch (Exception ex)
{
Console.WriteLine($"抱歉发生了异常: {ex.Message}. ");
}

Console.WriteLine("好,让我们重新开始!");
Console.WriteLine();

goto Start;
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
</ItemGroup>

<ItemGroup>
<Content Include="appsettings.Development.json" >
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
</PropertyGroup>

<ItemGroup>
<Content Include="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using AutoGen.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using AutoGen.Core;

namespace Senaprc.AI.Agents.AgentUtility
{
Expand Down Expand Up @@ -48,13 +47,9 @@ public PrintWechatMessageMiddleware(Action<IAgent, IMessage, string>? sendMessag
}

IMessage obj = await agent.GenerateReplyAsync(context.Messages, context.Options, cancellationToken);

var outputMessage = obj.FormatMessage();

_sendMessageAction?.Invoke(agent, obj, outputMessage);

Console.WriteLine(obj.FormatMessage());

return obj;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Senparc.AI.Agents/Senparc.AI.Agents.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>0.1.1-beta1</Version>
<Version>0.1.2.1-beta1</Version>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<AssemblyName>Senparc.AI.Agents</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion src/Senparc.AI.Kernel/Senparc.AI.Kernel.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>0.16.1.2-beta1</Version>
<Version>0.16.2-beta1</Version>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<AssemblyName>Senparc.AI.Kernel</AssemblyName>
Expand Down
3 changes: 2 additions & 1 deletion src/Senparc.AI/Senparc.AI.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>0.16.1-beta1</Version>
<Version>0.16.2-beta1</Version>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<AssemblyName>Senparc.AI</AssemblyName>
Expand Down Expand Up @@ -47,6 +47,7 @@
1、添加 SenparcKernelAiResult&lt;T$gt; 类型
2、重命名 IAiResult.Output 为 OutputString
v0.16.1 将 ISenparcAiSetting.ModelName、DeploymentName 从属性改为 public
v0.16.2 增加 Agents 项目输入为空时,异常捕获
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/Senparc/Senparc.AI</RepositoryUrl>
<Configurations>Debug;Release;Test</Configurations>
Expand Down