chore: refine Next.js configuration and improve error handling

- Simplified the Next.js webpack configuration to apply raw-loader for markdown files universally.
- Updated build script in package.json to ensure webpack is used during the build process.
- Enhanced error logging across various hooks to provide clearer messages when exceptions occur, improving debugging capabilities.
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-28 00:38:58 -03:00
1 parent 655d9c1b45
commit 55749c07e3
12 files changed
+44 -37

No files matched your search

+3 -2
View File
@@ -156,7 +156,7 @@ export async function extractKeyFacts(
entities: f.entities || [],
}));
} catch (error) {
chatLog.warn(`[ContextUnifier] Erro ao extrair fatos de ${entry.title}:`, error);
chatLog.warn(`[ContextUnifier] Erro ao extrair fatos de ${entry.title}: ${error instanceof Error ? error.message : String(error)}`);
// Fallback: criar fato básico do título
return [{
fact: entry.title,
@@ -273,7 +273,7 @@ export async function unifyContext(
// Criar texto unificado
const unifiedSections: string[] = [];
const sourceMap = new Map<string, { title: string; url: string; factsCount: number }>();
const sourceMap = new Map<string, { id: string; title: string; url: string; factsCount: number }>();
// Agrupar por fonte
for (const entry of entries) {
@@ -281,6 +281,7 @@ export async function unifyContext(
if (entryFacts.length > 0) {
sourceMap.set(entry.id, {
id: entry.id,
title: entry.title,
url: entry.sourceUrl,
factsCount: entryFacts.length,