init receiver UI web project using devexpress template
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Azure;
|
||||
using Azure.AI.OpenAI;
|
||||
using Microsoft.Extensions.AI;
|
||||
|
||||
namespace EnvelopeGenerator.ReceiverUI.Web.Client.Utils
|
||||
{
|
||||
public static class ServiceExtensions
|
||||
{
|
||||
// Demo AI services are rate limited and intended for demonstration purposes only.
|
||||
// DevExpress does not offer a REST API and does not ship any built-in LLMs/SLMs.
|
||||
// Use of demo credentials in production is strictly prohibited.
|
||||
// Specify the Azure OpenAI endpoint, key, and deployment name in the 'appsettings.json' file.
|
||||
public static void AddChatClient(this IServiceCollection services, string aiEndpoint, string aiKey, string deployment)
|
||||
{
|
||||
services.AddDevExpressAI();
|
||||
services.AddScoped<IChatClient>(_ =>
|
||||
{
|
||||
var azureClient = new AzureOpenAIClient(new Uri(aiEndpoint), new AzureKeyCredential(aiKey));
|
||||
return azureClient
|
||||
.GetChatClient(deployment)
|
||||
.AsIChatClient();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user