fixing flashcard generation error
This commit is contained in:
@@ -193,9 +193,10 @@ namespace Mindforge.API.Services
|
||||
var rawResult = await _agentService.ProcessRequestAsync(systemPrompt, userPrompt);
|
||||
var cards = ParseFlashcardsFromJson(rawResult);
|
||||
|
||||
if (cards.Count < amount)
|
||||
var minimumAcceptable = (int)Math.Ceiling(amount * 0.75);
|
||||
if (cards.Count < minimumAcceptable)
|
||||
{
|
||||
throw new Exception($"Quantidade insuficiente de flashcards gerados para {filePath}. Esperado: {amount}. Recebido: {cards.Count}.");
|
||||
throw new Exception($"Quantidade insuficiente de flashcards gerados para {filePath}. Esperado: {amount}. Minimo aceitavel: {minimumAcceptable}. Recebido: {cards.Count}.");
|
||||
}
|
||||
|
||||
if (cards.Count > amount)
|
||||
|
||||
Reference in New Issue
Block a user