historico

This commit is contained in:
2026-05-21 11:49:56 +01:00
parent 2f411d08a4
commit 5bda59f7af
5 changed files with 742 additions and 61 deletions

View File

@@ -51,14 +51,19 @@ IMPORTANTE - RESPOSTAS COMPLETAS:
});
// PASSO 3 — BUSCAR MEMÓRIA DA CONVERSA NA Cloud Firestore
final conversationHistory = await ChatMemoryService.getRecentMessages(
limit: 20,
);
for (final msg in conversationHistory) {
messages.add({
'role': msg['role'] as String,
'content': msg['content'] as String,
});
final conversationId = ChatMemoryService.currentConversationId;
if (conversationId != null) {
final conversationHistory =
await ChatMemoryService.getConversationMessages(
conversationId: conversationId,
limit: 20,
);
for (final msg in conversationHistory) {
messages.add({
'role': msg['role'] as String,
'content': msg['content'] as String,
});
}
}
// PASSO 4 — BUSCAR PDFs DO PROFESSOR NO Firebase Storage (RAG CHUNK RETRIEVAL)
@@ -905,14 +910,19 @@ IMPORTANTE - RESPOSTAS COMPLETAS:
});
// PASSO 3 — BUSCAR MEMÓRIA DA CONVERSA NA Cloud Firestore (máx 4 para poupar heap)
final conversationHistory = await ChatMemoryService.getRecentMessages(
limit: 4,
);
for (final msg in conversationHistory) {
messages.add({
'role': msg['role'] as String,
'content': msg['content'] as String,
});
final conversationId = ChatMemoryService.currentConversationId;
if (conversationId != null) {
final conversationHistory =
await ChatMemoryService.getConversationMessages(
conversationId: conversationId,
limit: 4,
);
for (final msg in conversationHistory) {
messages.add({
'role': msg['role'] as String,
'content': msg['content'] as String,
});
}
}
// Log de confirmação de ordem do histórico