fix issues
This commit is contained in:
@@ -149,7 +149,7 @@ namespace ChatBot.Data.Repositories
|
|||||||
.ChatSessions.Where(s => s.LastUpdatedAt < cutoffTime)
|
.ChatSessions.Where(s => s.LastUpdatedAt < cutoffTime)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
if (sessionsToRemove.Any())
|
if (sessionsToRemove.Count > 0)
|
||||||
{
|
{
|
||||||
_context.ChatSessions.RemoveRange(sessionsToRemove);
|
_context.ChatSessions.RemoveRange(sessionsToRemove);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|||||||
@@ -153,10 +153,13 @@ try
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Регистрируем Health Checks
|
// Регистрируем Health Checks
|
||||||
|
var ollamaTags = new[] { "api", "ollama" };
|
||||||
|
var telegramTags = new[] { "api", "telegram" };
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.Services.AddHealthChecks()
|
.Services.AddHealthChecks()
|
||||||
.AddCheck<OllamaHealthCheck>("ollama", tags: new[] { "api", "ollama" })
|
.AddCheck<OllamaHealthCheck>("ollama", tags: ollamaTags)
|
||||||
.AddCheck<TelegramBotHealthCheck>("telegram", tags: new[] { "api", "telegram" });
|
.AddCheck<TelegramBotHealthCheck>("telegram", tags: telegramTags);
|
||||||
|
|
||||||
var host = builder.Build();
|
var host = builder.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ namespace ChatBot.Services
|
|||||||
when (ex.Message.Contains("database") && ex.Message.Contains("does not exist"))
|
when (ex.Message.Contains("database") && ex.Message.Contains("does not exist"))
|
||||||
{
|
{
|
||||||
// This is expected when database doesn't exist - MigrateAsync will create it
|
// This is expected when database doesn't exist - MigrateAsync will create it
|
||||||
_logger.LogInformation("Database does not exist, will be created during migration");
|
_logger.LogInformation(
|
||||||
|
ex,
|
||||||
|
"Database does not exist, will be created during migration"
|
||||||
|
);
|
||||||
await context.Database.MigrateAsync(cancellationToken);
|
await context.Database.MigrateAsync(cancellationToken);
|
||||||
_logger.LogInformation("Database initialization completed successfully");
|
_logger.LogInformation("Database initialization completed successfully");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace ChatBot.Services.Telegram.Commands
|
|||||||
var commandRegistry = _serviceProvider.GetRequiredService<CommandRegistry>();
|
var commandRegistry = _serviceProvider.GetRequiredService<CommandRegistry>();
|
||||||
var commands = commandRegistry.GetCommandsWithDescriptions().ToList();
|
var commands = commandRegistry.GetCommandsWithDescriptions().ToList();
|
||||||
|
|
||||||
if (!commands.Any())
|
if (commands.Count == 0)
|
||||||
{
|
{
|
||||||
return Task.FromResult("❌ Команды не найдены.");
|
return Task.FromResult("❌ Команды не найдены.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user