Fix Historial de conversación
This commit is contained in:
@@ -154,7 +154,7 @@ namespace ChatbotApi.Services
|
||||
var sb = new StringBuilder();
|
||||
foreach (var article in articles.Take(15)) sb.AppendLine($"- {article.Title} ({article.Url})");
|
||||
context = sb.ToString();
|
||||
promptInstructions = "Actúa como un editor de noticias. Selecciona las 5 noticias más relevantes del <contexto>. Para cada una, escribe una frase breve y OBLIGATORIAMENTE incluye el enlace al final con formato [Título](URL). NO inventes noticias ni enlaces.";
|
||||
promptInstructions = "Responde la pregunta del usuario. Si la pregunta es sobre algo mencionado en el <historial_conversacion>, responde basándote en eso (por ejemplo, si pregunta 'dónde puedo leerla', proporciona el enlace mencionado anteriormente). Si la pregunta es sobre noticias actuales, selecciona las 3 más relevantes del <contexto>, escribe una frase breve para cada una e INCLUYE el enlace con formato [Título](URL).";
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -204,6 +204,14 @@ namespace ChatbotApi.Services
|
||||
|
||||
promptBuilder.AppendLine("</instrucciones_sistema>");
|
||||
|
||||
// Incluir historial de conversación para referencias contextuales
|
||||
if (!string.IsNullOrWhiteSpace(request.ConversationSummary))
|
||||
{
|
||||
promptBuilder.AppendLine("<historial_conversacion>");
|
||||
promptBuilder.AppendLine(SanitizeInput(request.ConversationSummary));
|
||||
promptBuilder.AppendLine("</historial_conversacion>");
|
||||
}
|
||||
|
||||
promptBuilder.AppendLine("<contexto>");
|
||||
promptBuilder.AppendLine(context);
|
||||
promptBuilder.AppendLine("</contexto>");
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Gemini": {
|
||||
"GeminiApiUrl": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:streamGenerateContent?alt=sse&key=",
|
||||
"GeminiApiUrl": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse&key=",
|
||||
"GeminiApiKey": ""
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
},
|
||||
"ConnectionStrings": {},
|
||||
"Jwt": {
|
||||
"Key": "",
|
||||
"Issuer": "",
|
||||
"Audience": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user