mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
b708e2507d
* Add project and skeleton files. * Add CopilotStudioAgent implementation * Add CopilotStudio integration tests * Fix typos and PR feedback. * Fix .net framework build errors. * Address PR comments * Remove temp test. * Add rawresponse for streaming updates and more comments. * Add TODO to review streaming updates * Address PR comments and fix some issues with streaming messages. * Map additional properties to agent reponses * Update CopilotStudio integration tests to match new approach. * Update copilot studio namespaces/project names to match new naming * Add todo's for AIContent types. * Remove files from PR. * Fix up sln file. * Update .gitignore. * Remove duplicate package version items.
62 lines
2.4 KiB
C#
62 lines
2.4 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using Microsoft.Agents.CopilotStudio.Client;
|
|
using Microsoft.Agents.CopilotStudio.Client.Discovery;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace CopilotStudio.IntegrationTests.Support;
|
|
|
|
/// <summary>
|
|
/// <see cref="ConnectionSettings"/> with additional properties to specify Application (Client) Id,
|
|
/// Tenant Id, and optionally the Application Client secret.
|
|
/// </summary>
|
|
internal sealed class CopilotStudioConnectionSettings : ConnectionSettings
|
|
{
|
|
/// <summary>
|
|
/// Application ID for creating the authentication for the connection
|
|
/// </summary>
|
|
public string AppClientId { get; }
|
|
|
|
/// <summary>
|
|
/// Application secret for creating the authentication for the connection
|
|
/// </summary>
|
|
public string? AppClientSecret { get; }
|
|
|
|
/// <summary>
|
|
/// Tenant ID for creating the authentication for the connection
|
|
/// </summary>
|
|
public string TenantId { get; }
|
|
|
|
/// <summary>
|
|
/// Use interactive or service connection for authentication.
|
|
/// Defaults to true, meaning interactive authentication will be used.
|
|
/// </summary>
|
|
public bool UseInteractiveAuthentication { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Instantiate a new instance of the <see cref="CopilotStudioConnectionSettings"/> from provided settings.
|
|
/// </summary>
|
|
public CopilotStudioConnectionSettings(string tenantId, string appClientId, string? appClientSecret = null)
|
|
{
|
|
this.TenantId = tenantId;
|
|
this.AppClientId = appClientId;
|
|
this.AppClientSecret = appClientSecret;
|
|
this.Cloud = PowerPlatformCloud.Prod;
|
|
this.CopilotAgentType = AgentType.Published;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Instantiate a new instance of the <see cref="CopilotStudioConnectionSettings"/> from a configuration section.
|
|
/// </summary>
|
|
/// <param name="config"></param>
|
|
/// <exception cref="ArgumentException"></exception>
|
|
public CopilotStudioConnectionSettings(IConfigurationSection config)
|
|
: base(config)
|
|
{
|
|
this.AppClientId = config[nameof(this.AppClientId)] ?? throw new ArgumentException($"{nameof(this.AppClientId)} not found in config");
|
|
this.TenantId = config[nameof(this.TenantId)] ?? throw new ArgumentException($"{nameof(this.TenantId)} not found in config");
|
|
this.AppClientSecret = config[nameof(this.AppClientSecret)];
|
|
}
|
|
}
|