Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
crickman committed Feb 10, 2024
1 parent 9b7b8dc commit ae4c87f
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 442 deletions.
18 changes: 1 addition & 17 deletions webapi/Controllers/MaintenanceController.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft. All rights reserved.

using System.Threading;
using System.Threading.Tasks;
using CopilotChat.WebApi.Models.Response;
using CopilotChat.WebApi.Options;
using CopilotChat.WebApi.Services.MemoryMigration;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -41,25 +39,11 @@ public MaintenanceController(
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<ActionResult<MaintenanceResult?>> GetMaintenanceStatusAsync(
[FromServices] IChatMigrationMonitor migrationMonitor,
public ActionResult<MaintenanceResult?> GetMaintenanceStatusAsync(
CancellationToken cancellationToken = default)
{
MaintenanceResult? result = null;

var migrationStatus = await migrationMonitor.GetCurrentStatusAsync(cancellationToken);

if (migrationStatus != ChatMigrationStatus.None)
{
result =
new MaintenanceResult
{
Title = "Migrating Chat Memory",
Message = "An upgrade requires that all non-document memories be migrated. This may take several minutes...",
Note = "Note: All document memories will need to be re-imported.",
};
}

if (this._serviceOptions.Value.InMaintenance)
{
result = new MaintenanceResult(); // Default maintenance message
Expand Down
20 changes: 0 additions & 20 deletions webapi/Extensions/ServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using CopilotChat.WebApi.Models.Storage;
using CopilotChat.WebApi.Options;
using CopilotChat.WebApi.Services;

Check warning on line 12 in webapi/Extensions/ServiceExtensions.cs

View workflow job for this annotation

GitHub Actions / check-format

Using directive is unnecessary.
using CopilotChat.WebApi.Services.MemoryMigration;
using CopilotChat.WebApi.Storage;
using CopilotChat.WebApi.Utilities;
using Microsoft.AspNetCore.Authentication;
Expand Down Expand Up @@ -129,25 +128,6 @@ internal static IServiceCollection AddPlugins(this IServiceCollection services,
return services;
}

internal static IServiceCollection AddMaintenanceServices(this IServiceCollection services)
{
// Inject migration services
services.AddSingleton<IChatMigrationMonitor, ChatMigrationMonitor>();
services.AddSingleton<IChatMemoryMigrationService, ChatMemoryMigrationService>();

// Inject actions so they can be part of the action-list.
services.AddSingleton<ChatMigrationMaintenanceAction>();
services.AddSingleton<IReadOnlyList<IMaintenanceAction>>(
sp =>
(IReadOnlyList<IMaintenanceAction>)
new[]
{
sp.GetRequiredService<ChatMigrationMaintenanceAction>(),
});

return services;
}

/// <summary>
/// Add CORS settings.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion webapi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public static async Task Main(string[] args)

// Add in the rest of the services.
builder.Services
.AddMaintenanceServices()
.AddEndpointsApiExplorer()
.AddSwaggerGen()
.AddCorsPolicy(builder.Configuration)
Expand Down
146 changes: 0 additions & 146 deletions webapi/Services/MemoryMigration/ChatMemoryMigrationService.cs

This file was deleted.

48 changes: 0 additions & 48 deletions webapi/Services/MemoryMigration/ChatMigrationMaintenanceAction.cs

This file was deleted.

Loading

0 comments on commit ae4c87f

Please sign in to comment.