-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,501 additions
and
607 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/AzureOpenAIProxy.ApiApp/Configurations/StorageAccountSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace AzureOpenAIProxy.ApiApp.Configurations; | ||
|
||
/// <summary> | ||
/// This represents the settings entity for storage account. | ||
/// </summary> | ||
public class StorageAccountSettings | ||
{ | ||
/// <summary> | ||
/// Gets the name of the configuration settings. | ||
/// </summary> | ||
public const string Name = "StorageAccount"; | ||
|
||
/// <summary> | ||
/// Gets or sets the <see cref="TableStorageSettings"/> instance. | ||
/// </summary> | ||
public TableStorageSettings TableStorage { get; set; } = new(); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/AzureOpenAIProxy.ApiApp/Configurations/TableStorageSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace AzureOpenAIProxy.ApiApp.Configurations; | ||
|
||
/// <summary> | ||
/// This represents the settings entity for Azure Table Stroage. | ||
/// </summary> | ||
public class TableStorageSettings | ||
{ | ||
/// <summary> | ||
/// Gets the name of the configuration settings. | ||
/// </summary> | ||
public const string Name = "TableStorage"; | ||
|
||
/// <summary> | ||
/// Gets or sets the table name. | ||
/// </summary> | ||
public string? TableName { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/AzureOpenAIProxy.ApiApp/Endpoints/AdminResourceEndpoints.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using AzureOpenAIProxy.ApiApp.Models; | ||
using AzureOpenAIProxy.ApiApp.Services; | ||
|
||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace AzureOpenAIProxy.ApiApp.Endpoints; | ||
|
||
/// <summary> | ||
/// This represents the endpoint entity for resource details by admin | ||
/// </summary> | ||
public static class AdminResourceEndpoints | ||
{ | ||
/// <summary> | ||
/// Adds the admin resource endpoint | ||
/// </summary> | ||
/// <param name="app"><see cref="WebApplication"/> instance.</param> | ||
/// <returns>Returns <see cref="RouteHandlerBuilder"/> instance.</returns> | ||
public static RouteHandlerBuilder AddNewAdminResource(this WebApplication app) | ||
{ | ||
var builder = app.MapPost(AdminEndpointUrls.AdminResources, async ( | ||
[FromBody] AdminResourceDetails payload, | ||
IAdminEventService service, | ||
ILoggerFactory loggerFactory) => | ||
{ | ||
var logger = loggerFactory.CreateLogger(nameof(AdminResourceEndpoints)); | ||
logger.LogInformation("Received a new resource request"); | ||
if (payload is null) | ||
{ | ||
logger.LogError("No payload found"); | ||
return Results.BadRequest("Payload is null"); | ||
} | ||
return await Task.FromResult(Results.Ok()); | ||
}) | ||
.Accepts<AdminResourceDetails>(contentType: "application/json") | ||
.Produces<AdminResourceDetails>(statusCode: StatusCodes.Status200OK, contentType: "application/json") | ||
.Produces(statusCode: StatusCodes.Status400BadRequest) | ||
.Produces(statusCode: StatusCodes.Status401Unauthorized) | ||
.Produces<string>(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") | ||
.WithTags("admin") | ||
.WithName("CreateAdminResource") | ||
.WithOpenApi(operation => | ||
{ | ||
operation.Summary = "Create admin resource"; | ||
operation.Description = "Create admin resource"; | ||
return operation; | ||
}); | ||
|
||
return builder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/AzureOpenAIProxy.ApiApp/Models/DeploymentModelDetails.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
/// <summary> | ||
/// This represent the event detail data for response by admin event endpoint. | ||
/// </summary> | ||
public class DeploymentModelDetails | ||
{ | ||
/// <summary> | ||
/// Gets or sets the deployment model name. | ||
/// </summary> | ||
[JsonRequired] | ||
public string Name { get; set; } = string.Empty; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
@page "/" | ||
@using AzureOpenAIProxy.PlaygroundApp.Components.UI | ||
|
||
<PageTitle>Home</PageTitle> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
src/AzureOpenAIProxy.PlaygroundApp/Components/Pages/Tests.razor
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/AzureOpenAIProxy.PlaygroundApp/Components/UI/ApiKeyInputComponent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<FluentStack Id="@Id" Style="width: 100%;" Orientation="Orientation.Vertical" VerticalAlignment="VerticalAlignment.Top"> | ||
<FluentTextField Id="api-key-field" Label="API key" Required="true" | ||
TextFieldType="TextFieldType.Password" | ||
Placeholder="Enter API key" | ||
@bind-Value="apiKeyValue" | ||
@oninput="SetApiKey" /> | ||
</FluentStack> | ||
|
||
@code { | ||
private string? apiKeyValue { get; set; } | ||
|
||
[Parameter] | ||
public string? Id { get; set; } | ||
|
||
[Parameter] | ||
public EventCallback<string> OnKeyInput { get; set; } | ||
|
||
private async Task SetApiKey(ChangeEventArgs e) | ||
{ | ||
apiKeyValue = e.Value!.ToString(); | ||
if (string.IsNullOrWhiteSpace(apiKeyValue) == true) | ||
{ | ||
return; | ||
} | ||
|
||
await OnKeyInput.InvokeAsync(apiKeyValue); | ||
} | ||
} |
27 changes: 15 additions & 12 deletions
27
src/AzureOpenAIProxy.PlaygroundApp/Components/UI/ConfigTabComponent.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
<FluentTabs Id="config-tab" ActiveTabId="system-message" OnTabChange="ChangeTab"> | ||
<FluentTab Label="System message" Id="system-message-tab"> | ||
This is "System message" tab. | ||
</FluentTab> | ||
<FluentTab Label="Parameters" Id="parameters-tab"> | ||
This is "Parameters" tab. | ||
</FluentTab> | ||
</FluentTabs> | ||
|
||
<p id="active-tab">[TEST] Active tab changed to: @SelectedTab?.Id</p> | ||
<FluentStack Id="@Id" Style="width: 100%;" Orientation="Orientation.Vertical" VerticalAlignment="VerticalAlignment.Top"> | ||
<FluentTabs Id="config-tabs" Style="width: 100%;" ActiveTabId="system-message-tab" OnTabChange="ChangeTab"> | ||
<FluentTab Id="system-message-tab" Label="System message"> | ||
This is "System message" tab. | ||
</FluentTab> | ||
<FluentTab Id="parameters-tab" Label="Parameters"> | ||
This is "Parameters" tab. | ||
</FluentTab> | ||
</FluentTabs> | ||
</FluentStack> | ||
|
||
@code { | ||
FluentTab? SelectedTab; | ||
private FluentTab? selectedTab { get; set; } | ||
|
||
[Parameter] | ||
public string? Id { get; set; } | ||
|
||
private async Task ChangeTab(FluentTab tab) | ||
{ | ||
SelectedTab = tab; | ||
this.selectedTab = tab; | ||
await Task.CompletedTask; | ||
} | ||
} |
Oops, something went wrong.