Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
glahaye committed Feb 23, 2024
2 parents 9d28f4c + a0ccb68 commit 659339a
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 719 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
15 changes: 2 additions & 13 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;
using CopilotChat.WebApi.Services.MemoryMigration;
using CopilotChat.WebApi.Storage;
using CopilotChat.WebApi.Utilities;
using Microsoft.AspNetCore.Authentication;
Expand Down Expand Up @@ -129,19 +128,9 @@ internal static IServiceCollection AddPlugins(this IServiceCollection 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>();
// Inject action stub
services.AddSingleton<IReadOnlyList<IMaintenanceAction>>(
sp =>
(IReadOnlyList<IMaintenanceAction>)
new[]
{
sp.GetRequiredService<ChatMigrationMaintenanceAction>(),
});
sp => (IReadOnlyList<IMaintenanceAction>)Array.Empty<IMaintenanceAction>());

return services;
}
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 659339a

Please sign in to comment.