IcedMango.DifyAi
1.1.3
See the version list below for details.
dotnet add package IcedMango.DifyAi --version 1.1.3
NuGet\Install-Package IcedMango.DifyAi -Version 1.1.3
<PackageReference Include="IcedMango.DifyAi" Version="1.1.3" />
paket add IcedMango.DifyAi --version 1.1.3
#r "nuget: IcedMango.DifyAi, 1.1.3"
// Install IcedMango.DifyAi as a Cake Addin #addin nuget:?package=IcedMango.DifyAi&version=1.1.3 // Install IcedMango.DifyAi as a Cake Tool #tool nuget:?package=IcedMango.DifyAi&version=1.1.3
Description
English | δΈζ
A simple Dify C# SDK.
Currently support partial robot api.
Wiki api working in progress.
UnitTest missing, will be added soon. If you have encountered any problem, please feel free to open an issue or PR.
Important Notice
This project is under early development, and the API may change at any time. You may encounter bugs, missing features, or incomplete documentation.
QuickStart
Install
Install-Package IcedMango.DifyAi
Service Registration:
Startup.cs
//Startup.cs
using DifyAi.ServiceExtension;
public void ConfigureServices(IServiceCollection services)
{
...other code
// register service
services.AddDifyAiServices();
}
appsetting.json
Note:
- BaseUrl: EndPoint of dify api instance. Must end with /
- BotApiKey: You can start with 'Bearer app-your-bot-key' or just use 'app-your-bot-key'
- Proxy: Proxy setting, support http, https, socks5. Leave empty if you don't need it.
{
"DifyAi": {
"BaseUrl": "https://example.com/v1/",
"BotApiKey": "app-your-bot-key",
"Proxy": "socks5://127.0.0.1:8889"
}
}
Usage
using DifyAi.Dto.ParamDto;
using DifyAi.Services;
namespace TestDifyAi;
public class TestClass
{
private readonly IDifyAiChatServices _difyAiChatServices;
public TestClass(IDifyAiChatServices difyAiChatServices)
{
_difyAiChatServices = difyAiChatServices;
}
public async Task<string> TestCompletion()
{
var res = await _difyAiChatServices.CreateChatCompletionBlockModeAsync(new Dify_CreateChatCompletionParamDto()
{
Query = "Who are you?",
User = "IcedMango",
ConversationId = string.Empty
});
if (res.Success == true)
{
return res.Data.Answer;
}
return "Error";
}
}
Api Document
Todo List
- Robot Api(done, no chat completion stream return/text to speech)
- Api Document
- UnitTest
- Message Completion Stream Mode
- Wiki Related Api
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contribution License Agreement
By contributing, you agree to license your contribution to project owner under the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- Mapster (>= 7.4.0)
- Mapster.Core (>= 1.2.1)
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.Http (>= 6.0.0)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
-
net7.0
- Mapster (>= 7.4.0)
- Mapster.Core (>= 1.2.1)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Http (>= 7.0.0)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Mapster (>= 7.4.0)
- Mapster.Core (>= 1.2.1)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.